This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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...




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]