<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-144144203868823174</id><updated>2011-12-16T09:15:08.060-08:00</updated><title type='text'>Blog.print(cristo.getThoughts());</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ccristoo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144144203868823174/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ccristoo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Carlos Alegría</name><uri>http://www.blogger.com/profile/17960903583244452010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-144144203868823174.post-4531286114560165634</id><published>2011-06-01T23:04:00.000-07:00</published><updated>2011-06-03T07:20:57.602-07:00</updated><title type='text'>Cross-compiling gtk+ applications</title><content type='html'>&lt;div style="text-align: justify;"&gt;I have recently cross compiled a small GTK+ application for Windows as part of a multiplatform project I am working on. In this post I will try to detail how I got Eclipse and MinGW working together to produce executable files for both Linux and Windows, by just switching in Eclipse the current build configuration.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;All the following instructions were executed in Arch Linux using the following software:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Eclipse Helios SR2 for C/C++Developers&lt;/li&gt;&lt;li&gt;MinGW 2.21 &lt;/li&gt;&lt;li&gt;GTK+ 2.24 &lt;/li&gt;&lt;li style="text-align: justify;"&gt;Windows XP (virtual machine on VirtualBox 4.0.8 OSE) with GTK+ 2.22 for testing purposes&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="color: #e69138;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Setting up Eclipse to compile GTK+ apps&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Installing GTK+ and Eclipse&lt;/b&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Install  GTK+ libraries using your distribution's package manager. Install also  the development libraries if your distribution separates GTK+ in more  than one package. I installed these libraries using the following  command:&lt;/div&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed #a2c4c9; margin: auto; padding: 3pt 5pt; width: 90%;"&gt;# pacman -S gtk2&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;If  your distribution doesn't provide the C/C++ version of Eclipse, don't  be afraid to download the newest stable release from the &lt;a href="http://www.eclipse.org/downloads/"&gt;Eclipse  download site&lt;/a&gt; instead. You could also install the necessary plugins in your current installation of Eclipse, but I think it is better to have an installation  per "purpose" (i.e. one for C/C++ development, one for Java development,  etc.), otherwise you could end up with a very memory and processor  consuming IDE. After the installation, don't forget to update Eclipse.&lt;/div&gt;&lt;br /&gt;&lt;b&gt;pkg-config&lt;/b&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The GTK+ package comes with &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;pkg-config&lt;/span&gt; configuration files to tell you which flags and libraries should be included in the command line when building GTK+ manually:&lt;/div&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed #a2c4c9; margin: auto; padding: 3pt 5pt; width: 90%;"&gt;# pkg-config --cflags gtk+-2.0&lt;br /&gt;-pthread -I/usr/include/gtk-2.0&lt;br /&gt;-I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0&lt;br /&gt;-I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0&lt;br /&gt;-I/usr/include/pango-1.0 -I/usr/include/glib-2.0&lt;br /&gt;-I/usr/lib/glib-2.0/include -I/usr/include/pixman-1&lt;br /&gt;-I/usr/include/freetype2 -I/usr/include/libpng14&lt;br /&gt;&lt;br /&gt;# pkg-config --libs gtk+-2.0&lt;br /&gt;-pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0&lt;br /&gt;-lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0&lt;br /&gt;-lgdk_pixbuf-2.0 -lpng14 -lm -lcairo -lpango-1.0&lt;br /&gt;-lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0&lt;br /&gt;-lgthread-2.0 -lrt -lglib-2.0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In order to compile GTK+ code in Eclipse, we will insert those flags into the Eclipse environment. In the following steps we consider that you have previously created a C project in Eclipse with some GTK+ source code. &lt;/div&gt;&lt;br /&gt;&lt;b&gt;CFlags&lt;/b&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Go to "Project -&amp;gt; Settings -&amp;gt; C/C++ General -&amp;gt; Paths and Symbols". Select the "GNU C" option of the "Languages" list in the "Includes" tab. Now add the include directories that we got from the first &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;pkg-config&lt;/span&gt; command (the ones prefixed with "I").&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-q4xHnQInCpI/Tefe-VPSbfI/AAAAAAAAANE/QhSI4kSrwJk/s1600/includes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="193" src="http://3.bp.blogspot.com/-q4xHnQInCpI/Tefe-VPSbfI/AAAAAAAAANE/QhSI4kSrwJk/s320/includes.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Now go to "Project -&amp;gt; Settings -&amp;gt; C/C++ Build -&amp;gt; Settings". Select "Tool Settings -&amp;gt; GCC C Compiler -&amp;gt; Miscellaneous". Append to the text of the "Other flags" field, all the flags that precede the include directories we got in the first &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;pkg-config&lt;/span&gt; command (-pthread in this case).&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-I0igS3HYZ6M/TeflF9g_aKI/AAAAAAAAANI/_gkhdZGp1p4/s1600/other_flags.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="193" src="http://3.bp.blogspot.com/-I0igS3HYZ6M/TeflF9g_aKI/AAAAAAAAANI/_gkhdZGp1p4/s320/other_flags.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Libraries&lt;/b&gt; &lt;br /&gt;&lt;div style="text-align: justify;"&gt;In the last Dialog of the previous section, select "Tool Settings -&amp;gt; GCC C Linker -&amp;gt; Miscellaneous". Write in the "Linker flags" text field the second &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;pkg-config&lt;/span&gt; command, i.e.&lt;/div&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed #a2c4c9; margin: auto; padding: 3pt 5pt; width: 90%;"&gt;`pkg-config --libs gtk+-2.0`&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Be sure to write correctly the "``" symbols around the command, so it could expand to the libraries and linker flags appropriately.&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-boyRQPctMJs/TegNOSzVtEI/AAAAAAAAANM/HtNzhpE0lQM/s1600/libraries.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="193" src="http://3.bp.blogspot.com/-boyRQPctMJs/TegNOSzVtEI/AAAAAAAAANM/HtNzhpE0lQM/s320/libraries.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;You should probably be wandering why we didn't use a &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;pkg-config&lt;/span&gt;  command to insert the include directories and other cflags in the  previous section. This is because we want to have a the code completion  and definitions navigation feature of Eclipse. If we use the &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;pkg-config&lt;/span&gt; command they won't work.&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Testing&lt;/b&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Now you should be able to compile and execute GTK+ code in your Eclipse C project. When compiling, be sure to use the same build configuration you used in the previous steps. If you used the default settings, this configuration should be &lt;i&gt;Debug&lt;/i&gt;. I called mine &lt;i&gt;linux-debug&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-PcGNS2SzuQM/TegPaHm8o_I/AAAAAAAAANQ/VJRods-RWLY/s1600/testing_1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="193" src="http://2.bp.blogspot.com/-PcGNS2SzuQM/TegPaHm8o_I/AAAAAAAAANQ/VJRods-RWLY/s320/testing_1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;GTK+ code compilation&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-_ddMR3itLUI/TegQhsWHQgI/AAAAAAAAANU/NiNikwBnaD4/s1600/testing_2.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-_ddMR3itLUI/TegQhsWHQgI/AAAAAAAAANU/NiNikwBnaD4/s320/testing_2.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Executing the GTK+ application&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style="color: #e69138;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #e69138;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Setting up MinGW in Eclipse to cross compile GTK+ apps&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Installing MinGW and GTK+ for Windows&lt;/b&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Install MinGW using your distribution's package manager:&lt;/div&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed #a2c4c9; margin: auto; padding: 3pt 5pt; width: 90%;"&gt;# pacman -S mingw32-gcc&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Be sure to install the compiler family, binutils, runtime, and win32 API. In Arch, the package &lt;b&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;mingw32-&lt;/span&gt;gcc&lt;/b&gt;  depends on all needed packages (ming32-binutils, ming32-runtime and  ming32-win32api). After the installation, these packages create a  minimal build tree in &lt;b style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/usr/i486-mingw32/&lt;/b&gt;,  containing Windows versions of various standard header files and other  files required to compile against Windows libraries. They also  install mingw32 versions of the GNU compiler and binutils commands (gcc,  cpp, as, etc.) with the same names, but prefixed with "i486-mingw32".&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;For  you to be able to compile your GTK+ app in this build environment, the  Windows GTK+ development files need to be placed there. You can get  these from the &lt;a href="http://www.gtk.org/download/win32.php"&gt;GTK+ for Windows download page&lt;/a&gt;, where you should download the  developer packages and runtimes. You could download just the libraries  you need or download the all-in-one bundle. After downloading, decompress the files in &lt;b style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/usr/i486-mingw32/&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Once  they're in place, you need to execute the following commands to make  sure the pkg-config files are all OK and have the correct prefixes:&lt;/div&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed #a2c4c9; margin: auto; padding: 3pt 5pt; width: 90%;"&gt;# cd /usr/i486-mingw32&lt;br /&gt;# sed -i 's|^prefix=.*$|prefix=/usr/i486-mingw32|g'&lt;br /&gt; lib/pkgconfig/*.pc&lt;br /&gt;# cd ./lib&lt;br /&gt;# for f in *.lib; do mv $f lib${f%%lib}a; done&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Create a &lt;b&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;i486-mingw32-pkg-config&lt;/span&gt;&lt;/b&gt; script in your $PATH containing the following code:&lt;/div&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed #a2c4c9; margin: auto; padding: 3pt 5pt; width: 90%;"&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;PKG_CONFIG_LIBDIR=/usr/i486-mingw32/lib/pkgconfig \&lt;br /&gt;PKG_CONFIG_PATH=/usr/i486-mingw32/lib/pkgconfig \&lt;br /&gt;pkg-config $*&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;As the MinGW  packages don't come with their own version of pkg-config, this ensures  that the compiler and linker are given the correct arguments for the  build environment we've created. It is not mandatory to put the code on a  script, but saves a lot of typing.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Finally, there is a Windows installer for the GTK+ runtime environment that you can  download &lt;a href="http://sourceforge.net/userapps/mediawiki/alex-sh/index.php?title=Main_Page"&gt;here&lt;/a&gt;. Unless you want to &lt;a href="http://ricardo.ecn.wfu.edu/%7Ecottrell/cross-gtk/#installer"&gt;embed GTK+ in your application&lt;/a&gt;,  this is the easiest way to get GTK+ apps running on Windows.&lt;/div&gt;&lt;br /&gt;&lt;b&gt;pkg-config&lt;/b&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;As before, we will use pkg-config to know which flags and libraries are necessary to compile GTK+ applications using our MinGW build environment.&lt;/div&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed #a2c4c9; margin: auto; padding: 3pt 5pt; width: 90%;"&gt;# i486-mingw32-pkg-config --cflags gtk+-2.0&lt;br /&gt;-mms-bitfields -I/usr/i486-mingw32/include/gtk-2.0&lt;br /&gt;-I/usr/i486-mingw32/lib/gtk-2.0/include&lt;br /&gt;-I/usr/i486-mingw32/include/atk-1.0&lt;br /&gt;-I/usr/i486-mingw32/include/cairo&lt;br /&gt;-I/usr/i486-mingw32/include/gdk-pixbuf-2.0&lt;br /&gt;-I/usr/i486-mingw32/include/pango-1.0&lt;br /&gt;-I/usr/i486-mingw32/include/glib-2.0&lt;br /&gt;-I/usr/i486-mingw32/lib/glib-2.0/include&lt;br /&gt;-I/usr/i486-mingw32/include&lt;br /&gt;-I/usr/i486-mingw32/include/freetype2&lt;br /&gt;-I/usr/i486-mingw32/include/libpng14&lt;br /&gt;&lt;br /&gt;# i486-mingw32-pkg-config --libs gtk+-2.0&lt;br /&gt;-L/usr/i486-mingw32/lib -lgtk-win32-2.0 -lgdk-win32-2.0&lt;br /&gt;-latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32&lt;br /&gt;-lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo&lt;br /&gt;-lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0&lt;br /&gt;-lintl&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We will also add the following flags to our configuration:&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;"-Wl,-subsystem,windows" to stop Windows launching a console every time your application is executed.&lt;/li&gt;&lt;li&gt;"-DWIN32" to allow you to change build rules for Windows in your makefiles, or to change prepossessing macros in&amp;nbsp; your C code&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Eclipse configuration &lt;/b&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;To be able to switch configurations and build your code for either Linux or Windows, you need to create a new build configuration. There are several ways to do this. For example, you can go to "Project -&amp;gt; Settings -&amp;gt; C/C++ Build -&amp;gt; Settings", and click on "Manage Configurations". My configuration for cross compilation is called &lt;i&gt;windows-release&lt;/i&gt;.&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-DiLLeFnCWCU/TegfwChoMRI/AAAAAAAAANY/2lrasCWI98s/s1600/new_configuration.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="200" src="http://2.bp.blogspot.com/-DiLLeFnCWCU/TegfwChoMRI/AAAAAAAAANY/2lrasCWI98s/s320/new_configuration.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Strictly speaking, we should be able to cross compile by selecting MinGW as the toolchain for our new configuration in "Project -&amp;gt; Settings -&amp;gt; C/C++ Build -&amp;gt; Tool Chain Editor", and then insert the cflags and libraries in Eclipse as we did in the previous section. However, the way Eclipse looks for the selected toolchain files in the system seems to be hardcoded so, as far as I know, MinGW GCC toolchain can only be selected in this way in Windows.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Thus, we will use the default toolchain and make a small tweak in its configuration. First insert the cflags and libraries in the same way we did in the previous section. Then go to "Project -&amp;gt; Settings -&amp;gt; C/C++ Build -&amp;gt; Settings", and then to "Tool Settings -&amp;gt; GCC C Linker -&amp;gt; Miscellaneus". Append the options "-Wl,-subsystem,windows" to the text on the "Linker flags" text field.&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-I0CC2Cis81M/Tegiq1INczI/AAAAAAAAANc/8mSF_M-FZss/s1600/cross_compile_1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="193" src="http://2.bp.blogspot.com/-I0CC2Cis81M/Tegiq1INczI/AAAAAAAAANc/8mSF_M-FZss/s320/cross_compile_1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In the same Dialog go to "Tool Settings -&amp;gt; GCC C Compiler -&amp;gt; Symbols" and add "WIN32" to the "Defined symbols" list.&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-86WCvXJ3HzA/TegkkEmWjSI/AAAAAAAAANg/l6y99ZZFUjk/s1600/cross_compile_2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="193" src="http://2.bp.blogspot.com/-86WCvXJ3HzA/TegkkEmWjSI/AAAAAAAAANg/l6y99ZZFUjk/s320/cross_compile_2.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Then insert the prefix "i486-mingw32-" to the text in the "Command" text field in "GCC C Compiler", "GCC C Linker", and "GCC Assembler". Finally, add "PE Windows Parser" to the parsers lists in "Binary Parsers".&lt;/div&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-yvivAgxrVUE/TegmVqv2DOI/AAAAAAAAANk/qc_5UzBSWcE/s1600/cross_compile_3.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="193" src="http://4.bp.blogspot.com/-yvivAgxrVUE/TegmVqv2DOI/AAAAAAAAANk/qc_5UzBSWcE/s320/cross_compile_3.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Appending i486-mingw32- to gcc&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-kl8tbh78e5E/TegmWBpk5BI/AAAAAAAAANo/RLYKfo1GNwA/s1600/cross_compile_4.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="193" src="http://3.bp.blogspot.com/-kl8tbh78e5E/TegmWBpk5BI/AAAAAAAAANo/RLYKfo1GNwA/s320/cross_compile_4.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Adding PE Windows binary parser&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;b&gt;Testing&lt;/b&gt; &lt;br /&gt;&lt;div style="text-align: justify;"&gt;Now you should be able to build applications for Windows by selecting the appropriate build configuration in Eclipse. To test your application, just transfer it to windows and execute it. If the result file of your building doesn't have the "exe" extension, you can configure Eclipse to add it in "Project -&amp;gt; Settings -&amp;gt; C/C++ Build -&amp;gt; Settings -&amp;gt; Build Artifact".&lt;/div&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-Y4ToWqgfnTY/TegpQB0C3AI/AAAAAAAAANs/HRh7EHQos5Q/s1600/cross_compile_5.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="193" src="http://3.bp.blogspot.com/-Y4ToWqgfnTY/TegpQB0C3AI/AAAAAAAAANs/HRh7EHQos5Q/s320/cross_compile_5.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Successful cross compilation&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-21YX49EQjRQ/TegpRQE1TKI/AAAAAAAAANw/GR46oIK9E4E/s1600/cross_compile_6.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="193" src="http://2.bp.blogspot.com/-21YX49EQjRQ/TegpRQE1TKI/AAAAAAAAANw/GR46oIK9E4E/s320/cross_compile_6.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Execution in Windows&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div style="color: #e69138;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;References and final remarks&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;I mostly used the following pages to create this post:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://live.gnome.org/GTK%2B/Win32/Apps"&gt;http://live.gnome.org/GTK%2B/Win32/Apps&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.embedded-linux.co.uk/tutorial/eclipse-cross-compile"&gt;http://www.embedded-linux.co.uk/tutorial/eclipse-cross-compile&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ogre3d.org/tikiwiki/Eclipse+MingW"&gt;http://www.ogre3d.org/tikiwiki/Eclipse+MingW&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://zetcode.com/articles/eclipsecdevelopment/"&gt;http://zetcode.com/articles/eclipsecdevelopment/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;In the MinGW installation section, I textually added&amp;nbsp; some fragments of the previous references instead of using its links for the sake of clarity. The GTK+ source code I used is based on the &lt;a href="http://developer.gnome.org/gtk-tutorial/stable/"&gt;GTK+ official tutorial&lt;/a&gt; Hello World application, and the examples found &lt;a href="http://tadeboro.blogspot.com/2009/09/glade3-tutorial-1-introduction.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Finally, note that you can cross compile non GTK+ applications following the instructions we explained. You'd just need to add the appropriate Windows libraries to the MinGW build environment, and add the needed flags and libraries to Eclipse as we did with GTK+.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144144203868823174-4531286114560165634?l=ccristoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ccristoo.blogspot.com/feeds/4531286114560165634/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ccristoo.blogspot.com/2011/06/cross-compiling-gtk-applications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144144203868823174/posts/default/4531286114560165634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144144203868823174/posts/default/4531286114560165634'/><link rel='alternate' type='text/html' href='http://ccristoo.blogspot.com/2011/06/cross-compiling-gtk-applications.html' title='Cross-compiling gtk+ applications'/><author><name>Carlos Alegría</name><uri>http://www.blogger.com/profile/17960903583244452010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-q4xHnQInCpI/Tefe-VPSbfI/AAAAAAAAANE/QhSI4kSrwJk/s72-c/includes.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144144203868823174.post-2342251298231427815</id><published>2011-06-01T18:53:00.000-07:00</published><updated>2011-06-02T08:40:50.776-07:00</updated><title type='text'>Setting up Quartus II v8.1 under Ubuntu 8.04</title><content type='html'>&lt;div style="text-align: justify;"&gt;When I was about to write a post about a project I'm working on, I remembered that about a two years ago I wrote a tutorial on how to setup Quartus II under Ubuntu using only Quartus' evaluation version; i.e. full board programming for free (no cracking nor hacking any software).&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;You can find the tutorial &lt;a href="https://help.ubuntu.com/community/QuartusII"&gt;here&lt;/a&gt;. It's a little bit outdated, but the general idea should still work.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;P.S.&lt;/b&gt; By the way, when I was looking for the link of the tutorial I noticed that a user of the Ubuntu Documentation Community made some updates. Thanks to &lt;/span&gt;&lt;span style="font-size: x-small;" title="https://login.launchpad.net/+id/ByrCsdA @ ug-uyst-s-0003.student.uni-goettingen.de[134.76.61.233]"&gt;&lt;a class="interwiki" href="https://launchpad.net/%7Ejengelh" title="https://login.launchpad.net/+id/ByrCsdA @ ug-uyst-s-0003.student.uni-goettingen.de[134.76.61.233]"&gt;j.eng&lt;/a&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; for his (her?) contributions.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144144203868823174-2342251298231427815?l=ccristoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ccristoo.blogspot.com/feeds/2342251298231427815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ccristoo.blogspot.com/2011/06/setting-up-quartus-ii-v81-under-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144144203868823174/posts/default/2342251298231427815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144144203868823174/posts/default/2342251298231427815'/><link rel='alternate' type='text/html' href='http://ccristoo.blogspot.com/2011/06/setting-up-quartus-ii-v81-under-ubuntu.html' title='Setting up Quartus II v8.1 under Ubuntu 8.04'/><author><name>Carlos Alegría</name><uri>http://www.blogger.com/profile/17960903583244452010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144144203868823174.post-3943812079065639085</id><published>2011-05-31T13:27:00.000-07:00</published><updated>2011-06-02T07:55:09.690-07:00</updated><title type='text'>We are just sculptors</title><content type='html'>I was watching Eddie Murphy's episode of &lt;a href="http://www.bravotv.com/inside-the-actors-studio"&gt;Inside the Actors Studio&lt;/a&gt; and I loved the quote he wrote at the age of sixteen for his yearbook:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;"In reality all men are sculptors constantly chipping away the  unwanted parts of their lives trying to create their idea of the  masterpiece"&lt;/i&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://2.gvt0.com/vi/iJ-IhYgrcj4/0.jpg" height="266" width="320"&gt;&lt;param name="movie" value="http://www.youtube.com/v/iJ-IhYgrcj4&amp;fs=1&amp;source=uds" /&gt;&lt;param name="bgcolor" value="#FFFFFF" /&gt;&lt;embed width="320" height="266" src="http://www.youtube.com/v/iJ-IhYgrcj4&amp;fs=1&amp;source=uds" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;(You can find the quote at minute 5:11) &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144144203868823174-3943812079065639085?l=ccristoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ccristoo.blogspot.com/feeds/3943812079065639085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ccristoo.blogspot.com/2011/05/we-are-just-sculptors.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144144203868823174/posts/default/3943812079065639085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144144203868823174/posts/default/3943812079065639085'/><link rel='alternate' type='text/html' href='http://ccristoo.blogspot.com/2011/05/we-are-just-sculptors.html' title='We are just sculptors'/><author><name>Carlos Alegría</name><uri>http://www.blogger.com/profile/17960903583244452010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-144144203868823174.post-869755355961702573</id><published>2011-05-31T12:11:00.000-07:00</published><updated>2011-10-06T12:33:36.196-07:00</updated><title type='text'>Warrior-scholars and Scholar-Warriors</title><content type='html'>&lt;div style="text-align: justify;"&gt;I was reading an &lt;a href="http://jimmac.musichall.cz/log/?p=1084"&gt;older post&lt;/a&gt; on Jimmac's blog, and by traversing its links I found a cool quote in &lt;a href="http://www.azarask.in/blog/post/be-a-designer/"&gt;this post&lt;/a&gt; that remind me a discussion I had with some of my classmates:&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;...&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;2,500   years ago, a Greek writer told us something about creating  software:   Thucydides wrote, “The society that separates its scholars  from its   warriors will have its thinking done by cowards and its  fighting by   fools.”&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;...&lt;/i&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Currently I am about to finish my M.S. in Computer Science. My research area is &lt;a href="http://en.wikipedia.org/wiki/Computational_geometry"&gt;Computational&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Discrete_geometry"&gt;Discrete&lt;/a&gt; Geometry. During my master studies I've met a lot of mathematicians (students and professors) which avoid any engineering related knowledge. Some of them even look down on engineers or, afraid of not being taken seriously, have forsaken and are reluctant to accept their engineering background.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;I got my B.S. on Computer Engineering (i.e. I am an engineer) and have found no substantial difference between my and my classmates' capacity for solving geometric problems or designing algorithms. The obvious difference is my lack of background on some topics and my lack of experience in mathematical writing. However, when I talked about this with my advisor, he told me that among the best of his students were a couple of engineers, that I should not worry about that, and that I just have to work a little bit harder on those matters.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;It is well known among computer engineers and discrete mathematicians that the best results in both fields comes from multi-discipline (&lt;a href="http://compgeom.cs.uiuc.edu/%7Ejeffe/compgeom/taskforce.html"&gt;here&lt;/a&gt; you can find a very interesting discussion about this matter in computational geometry). I even found very recently that the computer engineer-scientist is a very valuable profile in companies such as Facebook, Google or Cisco, and also found some success stories about this approach in a very recent research field called &lt;a href="http://en.wikipedia.org/wiki/Human_computation"&gt;Human Computation&lt;/a&gt; (google on ReCaptcha or Gwap for some cool Human Computation projects).&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;When I worked together with some foreign researchers, I found that because of my background, I could propose a very different insight into problems that turned out to be very useful.  I think, as Thucydides suggests, that the best results will be achieved when we decide (or not be reluctant) to mix different fields of knowledge. I strongly believe that, as long as we embrace the scholar-warrior (or warrior-scholar) profile, we will be able to solve more difficult and interesting problems in the future.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/144144203868823174-869755355961702573?l=ccristoo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ccristoo.blogspot.com/feeds/869755355961702573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ccristoo.blogspot.com/2011/05/warrior-scholars-and-scholar-warriors.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/144144203868823174/posts/default/869755355961702573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/144144203868823174/posts/default/869755355961702573'/><link rel='alternate' type='text/html' href='http://ccristoo.blogspot.com/2011/05/warrior-scholars-and-scholar-warriors.html' title='Warrior-scholars and Scholar-Warriors'/><author><name>Carlos Alegría</name><uri>http://www.blogger.com/profile/17960903583244452010</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
