QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm
-
Compiling QT on Ubuntu 16.04 - 64Bit
I'm running in to issue, when trying to install to cross compile, Any suggestion to fix this issue?
./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -no-use-gold-linker
Error:
target compiler)> arm-linux-gnueabihf
test config.qtbase.tests.machineTuple succeeded
Checking for valid makespec...- cd /home/nbabu/raspi/qt-everywhere-src-5.10.0/config.tests/verifyspec && /home/nbabu/raspi/qt-everywhere-src-5.10.0/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/nbabu/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/nbabu/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/nbabu/raspi/sysroot" -early "CONFIG += cross_compile" /home/nbabu/raspi/qt-everywhere-src-5.10.0/qtbase/config.tests/verifyspec
- cd /home/nbabu/raspi/qt-everywhere-src-5.10.0/config.tests/verifyspec && MAKEFLAGS= /usr/bin/make
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/nbabu/raspi/sysroot -O2 -std=gnu++11 -w -fPIC -I/home/nbabu/raspi/qt-everywhere-src-5.10.0/qtbase/config.tests/verifyspec -I. -I/home/nbabu/raspi/qt-everywhere-src-5.10.0/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -o verifyspec.o /home/nbabu/raspi/qt-everywhere-src-5.10.0/qtbase/config.tests/verifyspec/verifyspec.cpp
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/nbabu/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/nbabu/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/nbabu/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/nbabu/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
collect2: error: ld returned 1 exit status
Makefile:66: recipe for target 'verifyspec' failed
make: *** [verifyspec] Error 1
Note: Also available for Linux: linux-clang linux-iccAny help appreciated.
-
Try setting the CROSS_COMPILE to x64:
-device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
Because otherwise it all looks good. Or maybe your toolchain is broken.
-
Tried with -x64 still same
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/nbabu/raspi/sysroot -O2 -std=gnu++11 -w -fPIC -I. -I/home/nbabu/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -o verifyspec.o verifyspec.cpp
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/nbabu/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/nbabu/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/nbabu/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/nbabu/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
/home/nbabu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
collect2: error: ld returned 1 exit status
Makefile:66: recipe for target 'verifyspec' failed
make: *** [verifyspec] Error 1
Note: Also available for Linux: linux-clang linux-icc -
Then it is a broken toolchain or sysroot. Make sure you have all the dependencies installed on Raspbian and run sysroot + symlink fix on your toolchain. Then
git pull
in your toolchain dir to make sure it's up to date. -
Hi,
may you have to execute rsync on ~/raspi folder
raspberrypi.local is the ip of the pi3, example 192.168.1.10mkdir sysroot sysroot/usr sysroot/opt
rsync -avz pi@raspberrypi.local:/lib sysroot
rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr
rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr
rsync -avz pi@raspberrypi.local:/opt/vc sysroot/opt -
@ab_en said in QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm:
Why is rsync necessary for correct build?
To synchronise the sysroot (which is basically copy of the RPi file system).
Strictly speaking rsync is not necessary, you can simply copy the content of /usr from your RPi to your host machine. But rsync is convenient to synchronise the sysroot if you change something on RPi. -
@jsulm Ok! I was able to copy the the usr/ folder from the RPi and I got through that issue, but now it is saying the file or file format is not recognized:
> /home/abenezerargaw/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/abenezerargaw/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/abenezerargaw/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o > /home/abenezerargaw/raspi/sysroot/usr/lib/crt1.o: file not recognized: File format not recognized > collect2: error: ld returned 1 exit status > Makefile:68: recipe for target 'verifyspec' failed > gmake: *** [verifyspec] Error 1 Note: Also available for Linux: linux-clang linux-icc ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
I assume I would need to rebuild the file but I am unsure how to do this. Any suggestions or guidance? (the more detailed the better! -- Thank you in advance)
-
@ab_en said in QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm:
raspbian-x64
Do you have 64b Raspbian installed on that RPi? If not, then you should not compile your Qt using 64b compiler.
-
@ab_en said in QT 5.10 Cross Compilation raspberry Pi Issue cannot find crt1.o & cannot find -lm:
Poky Yocto Project Distribution image for RPi4 64b
So are you sure the cross-compiler you use (i.e. ~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-) which seems to come from Rasbperry Foundation repo is Ok/compatible with such OS/distribution?