crosstool-ng / crosstool-ng

A versatile (cross-)toolchain generator.
Other
2.13k stars 664 forks source link

cannot find -lgcc -lgcc_s when aarch64 builds with ilp32, though MULTILIB was turned on before ct-ng build #1363

Open xiaokaoy opened 4 years ago

xiaokaoy commented 4 years ago

zac@zac-VirtualBox:~/32bit-app/crosstool-ng$ ~/x-tools/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-gcc ~/test/test.c -mabi=ilp32 /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: skipping incompatible /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/libgcc.a when searching for -lgcc /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: cannot find -lgcc /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: skipping incompatible /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/lib/../lib64/libgcc_s.so when searching for -lgcc_s /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: skipping incompatible /home/zac/x-tools/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot/lib/../lib64/libgcc_s.so when searching for -lgcc_s /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: cannot find -lgcc_s /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: skipping incompatible /home/zac/x-tools/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot/usr/lib/../lib64/libc.so when searching for -lc /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: skipping incompatible /home/zac/x-tools/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot/usr/lib/../lib64/libc.a when searching for -lc /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: cannot find -lc /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: skipping incompatible /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/libgcc.a when searching for -lgcc /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: cannot find -lgcc /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: skipping incompatible /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/lib/../lib64/libgcc_s.so when searching for -lgcc_s /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: skipping incompatible /home/zac/x-tools/aarch64-unknown-linux-gnu/aarch64-unknown-linux-gnu/sysroot/lib/../lib64/libgcc_s.so when searching for -lgcc_s /home/zac/x-tools/aarch64-unknown-linux-gnu/lib/gcc/aarch64-unknown-linux-gnu/8.3.0/../../../../aarch64-unknown-linux-gnu/bin/ld.bfd: cannot find -lgcc_s collect2: error: ld returned 1 exit status

config-and-build.log.zip

Issue submission guidelines

See detaled guidelines. In short:

xiaokaoy commented 4 years ago

That was possibly because CC_GCC_MULTILIB_LIST wasn't set.

However, if CC_GCC_MULTILIB_LIST [=ilp32,lp64] was set, ct-ng buildwould fail with the error ../include/setjmp.h:50:3: error: static assertion failed: "offset of __saved_mask field of struct __jmp_buf_tag != 184" as shown on https://github.com/crosstool-ng/crosstool-ng/issues/1364