Cross Compiling GTK+ (almost, i hope)



/*
 * Its stronggly recommended to read this mail under some really happy music.
*/

Hi! I'm building an application and I've been trying for days but with no results that may draw a smile in my face.
What I have done so far in favor of the "damn-lost-in-cross-compiling project" is:

- I started reading the docs for cross compiling application that uses gtk provided by gtk.org "Building GTK apps for MS Windows on Linux".

- There where a few problems compiling binutils-whatever, but it finally compile (the problem was "undefined reference to yyparser". The solution? i move to a computer with mandrake 10, install bison and bison-devel (the other one has ubuntu, but could find the devel package) .
After that i was happy, i swear that i could see the light at the end of the.. tunnel (sorry, i'm kind of bored at this point) but no, gcc-3.4.2 manage to not compile. The error was that it couldn't find the lib stdio.h (#include <stidio.h>) which.. i don't know what it means yet.

-So.. I download the ubuntu deb packages for mingw32, mingw32-gcc and mingw32-binutils from the repositories and install them. After that i created something like a cross directory in /opt/cross-tools and under the mingw32 directory i unpack every single win32-zip-file i found in ftp://ftp.gtk.org/pub/gtk/v2.8/win32. These zip files are:

atk-1.10.3.zip
atk-dev-1.10.3.zip
cairo-1.2.4.zip
cairo-dev-1.2.4.zip
glib-2.8.6.zip                  (Should it be 2.10?)
glib-dev-2.8.6.zip
gtk+-dev-2.8.20.zip
pango-1.10.3.zip
pango-dev-1.10.3.zip
gtk+-2.8.20.zip

and its dependencies...

fontconfig-2.2.2-20040412.zip
fontconfig-dev-2.2.2-20040412.zip
freetype-2.1.10.zip
gettext-0.14.5.tar.gz
gettext-0.14.5.zip
gettext-dev-0.14.5.zip
libiconv-1.9.1.bin.woe32.zip
libiconv-1.9.1.tar.gz
libpng-1.2.8-bin.zip
pkg-config-0.20.zip
zlib123-dll.zip

Then i modified the prefix line in all pkgconfig files under /opt/cross-tools/mingw32/lib/pkgconfig from prefix=c:/devel/target to prefix=/opt/cross-tools/mingw32.

I used and modified a little script to set the environment variables available in the docs mentioned above:

PREFIX=/opt/cross-tools
TARGET=mingw32
export CC="i586-mingw32msvc-gcc -mms-bitfields"
export CXX="i586-mingw32msvc-g++ -mms-bitfields"
export CFLAGS="-O2 -march=i586 -mms-bitfields"
export CXXFLAGS="-O2 -march=i586 -mms-bitfields"
export PKG_CONFIG_PATH=$PREFIX/$TARGET/lib/pkgconfig
export PATH=$PREFIX/$TARGET/bin:/bin:/usr/bin
export LD_LIBRARY_PATH=$PREFIX/$TARGET/lib
export LDFLAGS=-L$PREFIX/$TARGET/lib
export OBJDUMP=$PREFIX/$TARGET/bin/mingw32-objdump
export HOST_CC=/usr/bin/gcc

Now.. I was ready to compile a simple helloworld application.

So.. i exec this:
i586-mingw32msvc-gcc -o helloworld `pkg-config --libs --cflags gtk+-2.0` helloworld.c
Its answer was:
    
/tmp/ccb35C7l.o:helloworld.c:(.text+0x3f): referencia a `_gtk_init_abi_check' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0x4f): referencia a `_gtk_label_new' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0x5f): referencia a `_gtk_frame_new' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0x76): referencia a `_gtk_container_get_type' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0x82): referencia a `_g_type_check_instance_cast' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0x8b): referencia a `_gtk_container_add' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0x98): referencia a `_gtk_window_new' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0xaf): referencia a `_gtk_container_get_type' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0xbb): referencia a `_g_type_check_instance_cast' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0xc4): referencia a `_gtk_container_add' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0xdc): referencia a `_gtk_widget_set_size_request' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0xea): referencia a `_gtk_widget_show_all' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0xfb): referencia a `_gtk_main_quit' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0x10d): referencia a `_g_type_check_instance_cast' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0x116): referencia a `_g_signal_connect_data' sin definir
/tmp/ccb35C7l.o:helloworld.c:(.text+0x11e): referencia a `_gtk_main' sin definir


So i exec the following just to ... well....i don't know it may have work!
i586-mingw32msvc-gcc -o helloworld `pkg-config --static --libs --cflags gtk+-2.0` helloworld.c,
And kindly answer this:
/usr/lib/gcc/i586-mingw32msvc/3.4.4/../../../../i586-mingw32msvc/bin/ld: no se puede encontrar -lpng12
collect2: ld returned 1 exit status











[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]