We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm using arm-gnu-toolchain-10.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz to cross-compilefrom host LSW running Ubunti 22.04 and target BBB running Debian Bullseye.
To cross-compile I must use sysroot, but it don't work. Running a simple hello world,
/usr/local/arm/gcc10.3/bin/arm-none-linux-gnueabihf-g++ -v --sysroot=/home/krister/bbb-sysroot hello.c -o hello10yields:
/home/krister/bbb-sysroot/usr/include/stdio.h:27:10: fatal error: bits/libc-header-start.h: No such file or directory 27 | #include <bits/libc-header-start.h>
The reason for this is that only /home/krister/bbb-sysroot/usr/include is added.Correct would be:/home/krister/bbb-sysroot/usr/include/arm-linux-gnueabihf/home/krister/bbb-sysroot/usr/include
Adding the path my self:/usr/local/arm/gcc10.3/bin/arm-none-linux-gnueabihf-g++ -v --sysroot=/home/krister/bbb-sysroot hello.c -o hello10 -I/home/krister/bbb-sysroot/usr/include/arm-linux-gnueabihf
yields:/usr/local/arm/gcc10.3/bin/../lib/gcc/arm-none-linux-gnueabihf/10.3.1/../../../../arm-none-linux-gnueabihf/bin/ld:cannot find crt1.o: No such file or directory/usr/local/arm/gcc10.3/bin/../lib/gcc/arm-none-linux-gnueabihf/10.3.1/../../../../arm-none-linux-gnueabihf/bin/ld:cannot find crti.o: No such file or directory
The reason for this is that crt1.o and crti.o is not prefixed with the path:
/usr/local/arm/gcc10.3/bin/../libexec/gcc/arm-none-linux-gnueabihf/10.3.1/collect2 -plugin /usr/local/arm/gcc10.3/bin/../libexec/gcc/arm-none-linux-gnueabihf/10.3.1/liblto_plugin.so -plugin-opt=/usr/local/arm/gcc10.3/bin/../libexec/gcc/arm-none-linux-gnueabihf/10.3.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccnejzOj.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/home/krister/bbb-sysroot --eh-frame-hdr -dynamic-linker /lib/ld-linux-armhf.so.3 -X -m armelf_linux_eabi -o hello10 crt1.o crti.o/usr/local/arm/gcc10.3/bin/../lib/gcc/arm-none-linux-gnueabihf/10.3.1/crtbegin.o -L/usr/local/arm/gcc10.3/bin/../lib/gcc/arm-none-linux-gnueabihf/10.3.1 -L/usr/local/arm/gcc10.3/bin/../lib/gcc -L/usr/local/arm/gcc10.3/bin/../lib/gcc/arm-none-linux-gnueabihf/10.3.1/../../../../arm-none-linux-gnueabihf/lib -L/home/krister/bbb-sysroot/lib -L/home/krister/bbb-sysroot/usr/lib /tmp/ccpVc2CC.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/arm/gcc10.3/bin/../lib/gcc/arm-none-linux-gnueabihf/10.3.1/crtend.o crtn.o
correct would be: /home/krister/bbb-sysroot/usr/lib/arm-linux-gnueabihf/crt1.o /home/krister/bbb-sysroot/usr/lib/arm-linux-gnueabihf/crti.o
Is this a bug in the compiler or is it just me ?Is there anyway to get around this ?
The latest 12.3 have the same problem.