Page 1 of 1

GTK CrossCompile in Windows

Posted: Tue Mar 19, 2013 6:26 pm
by danidelrr

I have managed to set up the environment for cross compiling applications using Eclipse + Cygwin for standard C/C++ applications. I have also managed to cross-compile some libraries like lusb but now I am trying to set up an environment for GTK.

I have solved lots of errors but now I am stucked with -lffi not found error. I have check that the library is correct in /usr/lib but I get this error

Code: Select all

19:24:06 **** Build of configuration Debug for project raspTest_gtk ****
make all 
Building file: ../src/raspTest.c
Invoking: Cygwin C Compiler
arm-unknown-linux-gnueabi-g++ -I"/cygdrive/c/cygwin/opt/cross/x-tools/arm-unknown-linux-gnueabi-test/arm-unknown-linux-gnueabi/sysroot/usr/lib/arm-linux-gnueabihf/glib-2.0/include/" -I"/cygdrive/c/cygwin/opt/cross/x-tools/arm-unknown-linux-gnueabi-test/arm-unknown-linux-gnueabi/sysroot/usr/include/gtk-3.0" -I"/cygdrive/c/cygwin/opt/cross/x-tools/arm-unknown-linux-gnueabi-test/arm-unknown-linux-gnueabi/sysroot/usr/include" -I"C:\Users\dani\workspace\raspTest_gtk\include" -O0 -g3 -Wall -c -fmessage-length=0 `pkg-config --cflags gtk+-3.0 gmodule-export-2.0` -MMD -MP -MF"src/raspTest.d" -MT"src/raspTest.d" -o "src/raspTest.o" "../src/raspTest.c"
Finished building: ../src/raspTest.c
Building target: raspTest_gtk.a
Invoking: Cygwin C++ Linker
arm-unknown-linux-gnueabi-g++ `pkg-config --libs gtk+-3.0 gmodule-export-2.0` -L"/cygdrive/c/cygwin/opt/cross/x-tools/arm-unknown-linux-gnueabi-test/arm-unknown-linux-gnueabi/sysroot/usr/lib" -L"/cygdrive/c/cygwin/opt/cross/x-tools/arm-unknown-linux-gnueabi-test/arm-unknown-linux-gnueabi/sysroot/lib/arm-linux-gnueabihf" -L"/cygdrive/c/cygwin/opt/cross/x-tools/arm-unknown-linux-gnueabi-test/arm-unknown-linux-gnueabi/sysroot/lib" -L"/cygdrive/c/cygwin/opt/cross/x-tools/arm-unknown-linux-gnueabi-test/arm-unknown-linux-gnueabi/sysroot/usr/lib/arm-linux-gnueabihf" -o "raspTest_gtk.a"  ./src/raspTest.o   
/opt/cross/x-tools/arm-unknown-linux-gnueabi-test/bin/../lib/gcc/arm-unknown-linux-gnueabi/4.6.3/../../../../arm-unknown-linux-gnueabi/bin/ld: cannot find -lffi
collect2: ld returned 1 exit status
makefile:45: recipe for target `raspTest_gtk.a' failed
make: *** [raspTest_gtk.a] Error 1
Has anybody manged to set up a Windows Cross Compilation environment for GTK applications?

Thank you in advance,

Daniel del Río

Re: GTK CrossCompile in Windows [SOLVED]

Posted: Wed Mar 20, 2013 10:16 am
by danidelrr
Solved! i don't know why pkg-config did not ask for -lffi if I compiled in the raspberry PI and using the Cygwin version of pkg-config it needed.

I installed the libfffi-dev in the raspberry Pi and copied the libraries to my folder in Windows using rsync and now It works fine. Later I met some problems with the linker but there is another post in the forum with that problem.

The linker does not find some libraries. So it is necessary to use the -rpath-link option for the linker.

Code: Select all

-Xlinker -rpath-link=/home/phate/rpi/chroot-raspbian-armhf/usr/lib/arm-linux-gnueabihf 
-Xlinker -rpath-link=/home/phate/rpi/chroot-raspbian-armhf/lib/arm-linux-gnueabihf
So now I can Cross Compile GTK in Windows using Cygwin and Eclipse. If somebody needs help could ask here. I folowed some instructions in Internet and solved some problems during compilation and linking: ... ng-eclipse ... -compiler/ ... 33&t=37658

To avoid cross-compile the whole gtk I installed all the needed libraries in Raspberry PI and then copied into my computer using rsync to preserve the links.


Re: GTK CrossCompile in Windows

Posted: Tue May 14, 2013 9:23 pm
by gtbh2001
Hi Daniel, I´m trying to do the same on linux(Ubuntu) but I don´t know with files ( libs and includes ) I need to copy to linux and to where ( directories ). Please can you give some tips?

Thank in advantage,


Re: GTK CrossCompile in Windows

Posted: Wed May 15, 2013 11:04 am
by danidelrr
Hi Geraldo,

I installed rsync in the raspberry PI and run rsync daemon to copy all the files and preserve the links

You should rsync the /lib and /usr/lib folders to your Ubuntu path.

You can take a look to this link in step 3:


Re: GTK CrossCompile in Windows

Posted: Wed May 15, 2013 5:45 pm
by gtbh2001
Hi Daniel,

Thanks a lot! I´ll try on weekend!