Thank you very much! I searched a lot for an article like that but I wasn't able to find one! And that solve the problem, however I think that recompiling all gcc also for i386 will work, but your is a better method I think. However `file test_32' command (test_32 is binary produced with -m32 -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32 flags) return this: "test_32: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 10.1, not stripped", so I think that it will work correctly under a 32-bit freebsd10.1 system. Thank you another time! Niccolò F. ---------------------------------------- > Date: Thu, 19 Mar 2015 18:34:38 +0200 > From: kai.ruottu@xxxxxxxxxxx > To: niccolo.ferrari@xxxxxxxxxx; gcc-help@xxxxxxxxxxx > Subject: Re: FW: Trying to build gcc cross compiler from linux to freebsd > > 19.3.2015, 3:44, Niccolò Ferrari kirjoitti: >> Hi another time, >> The toolchain built works fine for 64bit instruction set, but if I specify -m32 it return errors: >> $ x86_64-freebsd10.1-gcc -m32 test.c -o test >> /usr/local/cross/lib/gcc/x86_64-freebsd10.1/4.9.2/../../../../x86_64-freebsd10.1/bin/ld: >> skipping incompatible >> /usr/local/cross/lib/gcc/x86_64-freebsd10.1/4.9.2/libgcc.a when >> searching for -lgcc >> /usr/local/cross/lib/gcc/x86_64-freebsd10.1/4.9.2/../../../../x86_64-freebsd10.1/bin/ld: >> skipping incompatible /usr/local/sysroot/freebsd10.1/usr/lib/libgcc.a >> when searching for -lgcc >> /usr/local/cross/lib/gcc/x86_64-freebsd10.1/4.9.2/../../../../x86_64-freebsd10.1/bin/ld: >> skipping incompatible /usr/local/sysroot/freebsd10.1/usr/lib/libgcc.a >> when searching for -lgcc >> /usr/local/cross/lib/gcc/x86_64-freebsd10.1/4.9.2/../../../../x86_64-freebsd10.1/bin/ld: >> cannot find -lgcc > > I tried this myself and saw the same thing happening. When looking at > what was built and installed and > at the config settings for the target, it is obvious that there isn't > any multilib or bi-arch support in the GCC > sources for the 'x86_64-freebsd10.1' target :( > > When googleing about this issue, the advice in : > https://forums.freebsd.org/threads/dumb-32-vs-64bit-questions.22872/ > to use : > -m32 -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32 > with the native FreeBSD compiler seemed to help but the absolute > addresses to the $sysroot were needed : > -m32 -L$SYSROOT/usr/lib32 -B$SYSROOT/usr/lib32 > My try with a 32-bit "Hello World" C program succeeded after using > these. The final link used what it found > in the 'SYSROOT/usr/lib32' like the 'libgcc.a', 'crtbegin.o', > 'crtend.o',... None of them produced with gcc-4.9.2 > because nothing was produced in the gcc-4.9.2 for the 32-bit case. > Whether the linked app would work I cannot > say much. > > I one wants the 32-bit arch support in gcc-4-9.2 for x86_64-freebsd10.1 > then hacking the config files a little > is required... > > >