# lang/gcc for cross-compilation i386 on amd64



## YuryG (Jan 3, 2017)

I just tried to compile i386 binary with -m32 key to gcc installed from ports lang/gcc on amd64 machine. But there I've got a bunch of errors:

```
/usr/local/bin/ld: skipping incompatible /usr/local/lib/gcc49/gcc/x86_64-portbld-freebsd10.3/4.9.4/libgcc.a when searching for -lgcc
/usr/local/bin/ld: skipping incompatible //usr/lib/libgcc.a when searching for -lgcc
/usr/local/bin/ld: cannot find -lgcc
/usr/local/bin/ld: skipping incompatible /usr/local/lib/gcc49/gcc/x86_64-portbld-freebsd10.3/4.9.4/../../../libgcc_s.so when searching for -lgcc_s
/usr/local/bin/ld: skipping incompatible //usr/lib/libgcc_s.so when searching for -lgcc_s
/usr/local/bin/ld: cannot find -lgcc_s
/usr/local/bin/ld: skipping incompatible /lib/libc.so.7 when searching for /lib/libc.so.7
/usr/local/bin/ld: cannot find /lib/libc.so.7
/usr/local/bin/ld: skipping incompatible /usr/lib/libc_nonshared.a when searching for /usr/lib/libc_nonshared.a
/usr/local/bin/ld: cannot find /usr/lib/libc_nonshared.a
/usr/local/bin/ld: skipping incompatible /usr/lib/libssp_nonshared.a when searching for /usr/lib/libssp_nonshared.a
/usr/local/bin/ld: cannot find /usr/lib/libssp_nonshared.a
collect2: error: ld returned 1 exit status
```
If I am doing the same compilation with system `cc` or port's `clang37` (or `clang39`) everything goes O.K.

If there's any way to cross-compile for i386 on amd64 using lang/gcc (or lang/gcc5, lang/gcc6…)?


----------



## SirDice (Jan 3, 2017)

Yes, this has nothing to do with installing or upgrading FreeBSD. Moved it to "Userland Programming and Scripting".


----------

