Cross compile from 64bit linux to 32bit problem lazarus / 13-General ---------------------------------------------------------------------- osp · 2014-02-19 22:18 Hi, I followed cross compile instructions for building 32bit linux binary on 64bit from here: http://wiki.lazarus.freepascal.org/Cross_compiling#From_Linux And when I try build project, it compiles fine, but linking fails: Code: [Select]/usr/bin/ld: warning: link.res contains output sections; did you forget -T? /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux- gnu/4.7/crtbegin.o when searching for /usr/lib/gcc/x86_64-linux- gnu/4.7/crtbegin.o /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux- gnu/4.7/crtbegin.o when searching for /usr/lib/gcc/x86_64-linux- gnu/4.7/crtbegin.o /usr/bin/ld: cannot find /usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o I have debian wheezy and this is content of directory /usr/lib/gcc: Code: [Select]ls -l /usr/lib/gcc celkem 8 drwxr-xr-x 3 root root 4096 úno 19 13:03 i486-linux-gnu drwxr-xr-x 4 root root 4096 úno 18 22:51 x86_64-linux-gnu And i486 is empty: Code: [Select]find /usr/lib/gcc/i486-linux-gnu/ -ls 1615942    4 drwxr-xr-x   3 root     root         4096 úno 19 13:03 /usr/lib/gcc/i486-linux-gnu/ 1615944    4 drwxr-xr-x   2 root     root         4096 led  7  2013 /usr/lib/gcc/i486-linux-gnu/4.7 1615945    0 lrwxrwxrwx   1 root     root            3 led  7  2013 /usr/lib/gcc/i486-linux-gnu/4.7.2 -> 4.7 I tried install gcc:i386, but dependency failed, and because I didn't know if it is necessary, I let that go for a moment and resolved to ask for a help. Cross compiling to win32 and win64 works and is very nice and I really want to have such ability to do the same for linux 32bit. Thanks advance, for any help P.S. This is my first post, not english native - this three steps verifications are kind of crazy, no? Can I reduce that somewhere? I think one captcha is enough... ---------------------------------------------------------------------- osp · 2014-02-24 02:02 Till now nothing, sad.. So I partially helped by myself: I installed gcc-multilib and edited fpc.cfg: Code: [Select]# path to the gcclib #ifdef cpui386 -Fl/usr/lib/gcc/x86_64-linux-gnu/4.7/32           <<<<<<<<<<< here I added 32 #endif #ifdef cpux86_64 -Fl/usr/lib/gcc/x86_64-linux-gnu/4.7 #endif But still I am unable build 32bit gui applications because from mine try-and-miss help-yourself experiments I guessed that I need dev packages for libgtk and others, which is unresolvable due to the same destination paths. Code: [Select]/usr/bin/ld: cannot find -lgdk_pixbuf-2.0 /usr/bin/ld: cannot find -lgtk-x11-2.0 /usr/bin/ld: cannot find -lgdk-x11-2.0 /usr/bin/ld: cannot find -lgobject-2.0 /usr/bin/ld: cannot find -lglib-2.0 /usr/bin/ld: cannot find -lgthread-2.0 /usr/bin/ld: cannot find -lgmodule-2.0 /usr/bin/ld: cannot find -lpango-1.0 /usr/bin/ld: cannot find -lcairo /usr/bin/ld: cannot find -latk-1.0 Only libx11-dev was able to install in both versions (amd64 and i386) and one error line disappeared. So, is there a way to resolve this? ---------------------------------------------------------------------- BigChimp · 2014-02-24 07:48 Dev packages sounds good. The standard way used in cross compiling is to keep copying over .sos from a 32 bit system into a directory you use to see/link your sos at compile time until the warnings go away... (see e.g. the fpcup wiki page which has instructions on how to do this for windows - you'll see a step involving copying linux graphical .so files, e.g. from raspbian pi or odroid) Of course this won't work if you expect to run 32 bit GUI apps on your 64/32 bit system. TBH, don't know if this is normally possible either.