Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt 5.11.3 Cross Compile RPI3 MAC OSX - crt1.o



  • I'm attempting to cross compile Qt 5.11.3 for a raspberry Pi 3 B (Ubuntu Mate) using Mac OSX 10.13 / Xcode 9 and running into this error related to crt1.o:

    Configure string:

    ./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/Volumes/RPI-TOOLS/bin/armv8-rpi3-linux-gnueabihf- -sysroot $SYSROOT -opensource -confirm-license -make libs -prefix /usr/local/qt5.11.3 -extprefix /Users/jondoe/Documents/raspiQt/qt5.11.3_pi -hostprefix /Users/jondoe/Documents/raspiQt/qt5.11.3_host -v -no-use-gold-linker -fontconfig -nomake examples -nomake tests -no-compile-examples -no-gbm -skip qtwayland -skip qtlocation -skip qtvirtualkeyboard -skip qtscript -skip qtwebengine
    

    Output / Error:

    ---snip---
    This is the Qt Open Source Edition.
    
    You have already accepted the terms of the Open Source license.
    
    Running configuration tests...
    Checking for machine tuple... 
    + /Volumes/RPI-TOOLS/bin/armv8-rpi3-linux-gnueabihf-g++ -dumpmachine | sed 's/v8-rpi3//'
    > arm-linux-gnueabihf
    test config.qtbase.tests.machineTuple succeeded
    Checking for valid makespec... 
    + cd /Users/jondoe/Documents/raspiQt/qt-everywhere-src-5.11.3/config.tests/verifyspec && /Users/jondoe/Documents/raspiQt/qt-everywhere-src-5.11.3/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/Users/jondoe/Documents/raspiQt/sysroot" "QMAKE_CXXFLAGS += --sysroot=/Users/jondoe/Documents/raspiQt/sysroot" "QMAKE_LFLAGS += --sysroot=/Users/jondoe/Documents/raspiQt/sysroot" -early "CONFIG += cross_compile" /Users/jondoe/Documents/raspiQt/qt-everywhere-src-5.11.3/qtbase/config.tests/verifyspec
    + cd /Users/jondoe/Documents/raspiQt/qt-everywhere-src-5.11.3/config.tests/verifyspec && MAKEFLAGS= /usr/local/bin/gmake
    > /Volumes/RPI-TOOLS/bin/armv8-rpi3-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/Users/jondoe/Documents/raspiQt/sysroot -O2 -w -fPIC  -I/Users/jondoe/Documents/raspiQt/qt-everywhere-src-5.11.3/qtbase/config.tests/verifyspec -I. -I/Users/jondoe/Documents/raspiQt/qt-everywhere-src-5.11.3/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -o verifyspec.o /Users/jondoe/Documents/raspiQt/qt-everywhere-src-5.11.3/qtbase/config.tests/verifyspec/verifyspec.cpp
    > /Volumes/RPI-TOOLS/bin/armv8-rpi3-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/Users/jondoe/Documents/raspiQt/sysroot -Wl,-O1 -Wl,-rpath-link,/Users/jondoe/Documents/raspiQt/sysroot/opt/vc/lib -Wl,-rpath-link,/Users/jondoe/Documents/raspiQt/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/Users/jondoe/Documents/raspiQt/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o    
    > /Volumes/RPI-TOOLS/bin/../lib/gcc/armv8-rpi3-linux-gnueabihf/7.2.0/../../../../armv8-rpi3-linux-gnueabihf/bin/ld.bfd: cannot find crt1.o: No such file or directory
    > /Volumes/RPI-TOOLS/bin/../lib/gcc/armv8-rpi3-linux-gnueabihf/7.2.0/../../../../armv8-rpi3-linux-gnueabihf/bin/ld.bfd: cannot find crti.o: No such file or directory
    > /Volumes/RPI-TOOLS/bin/../lib/gcc/armv8-rpi3-linux-gnueabihf/7.2.0/../../../../armv8-rpi3-linux-gnueabihf/bin/ld.bfd: cannot find -lm
    > collect2: error: ld returned 1 exit status
    > gmake: *** [Makefile:66: verifyspec] Error 1
    ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
    

    crt1.o exists on the device sys root:

    jondoe@mac:~/Documents/raspiQt/qt-everywhere-src-5.11.3$ find $SYSROOT -name crt1.o
    /Users/jondoe/Documents/raspiQt/sysroot/usr/lib/arm-linux-gnueabi/crt1.o
    /Users/jondoe/Documents/raspiQt/sysroot/usr/lib/arm-linux-gnueabihf/crt1.o
    

    Cross Compiler Toolchain output:

    jondoe@mac:/Volumes/RPI-TOOLS/bin$ ./arm*g++ -v
    Using built-in specs.
    COLLECT_GCC=./armv8-rpi3-linux-gnueabihf-g++
    COLLECT_LTO_WRAPPER=/Volumes/RPI-TOOLS/bin/../libexec/gcc/armv8-rpi3-linux-gnueabihf/7.2.0/lto-wrapper
    Target: armv8-rpi3-linux-gnueabihf
    Configured with: /Users/jonathancastillo/projects/crosstool-ng/.build/armv8-rpi3-linux-gnueabihf/src/gcc/configure --build=x86_64-build_apple-darwin17.2.0 --host=x86_64-build_apple-darwin17.2.0 --target=armv8-rpi3-linux-gnueabihf --prefix=/Users/jonathancastillo/x-tools/armv8-rpi3-linux-gnueabihf --with-sysroot=/Users/jonathancastillo/x-tools/armv8-rpi3-linux-gnueabihf/armv8-rpi3-linux-gnueabihf/sysroot --enable-languages=c,c++ --with-cpu=cortex-a53 --with-fpu=neon-vfpv4 --with-float=hard --with-pkgversion='crosstool-NG crosstool-ng-1.23.0-242-g521d6c17-dirty' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --disable-libmpx --with-gmp=/Users/jonathancastillo/projects/crosstool-ng/.build/armv8-rpi3-linux-gnueabihf/buildtools --with-mpfr=/Users/jonathancastillo/projects/crosstool-ng/.build/armv8-rpi3-linux-gnueabihf/buildtools --with-mpc=/Users/jonathancastillo/projects/crosstool-ng/.build/armv8-rpi3-linux-gnueabihf/buildtools --with-isl=/Users/jonathancastillo/projects/crosstool-ng/.build/armv8-rpi3-linux-gnueabihf/buildtools --enable-lto --enable-threads=posix --enable-target-optspace --enable-plugin --enable-gold --disable-nls --disable-multilib --with-local-prefix=/Users/jonathancastillo/x-tools/armv8-rpi3-linux-gnueabihf/armv8-rpi3-linux-gnueabihf/sysroot --enable-long-long
    Thread model: posix
    gcc version 7.2.0 (crosstool-NG crosstool-ng-1.23.0-242-g521d6c17-dirty) 
    

    Patch applied to qtbase/configure.pri:
    Compiler -dumpmachine outputs 'armv8-rpi3-linux-gnueabihf' instead of 'arm-linux-gnueabihf'

    defineTest(qtConfTest_machineTuple) {
        qtRunLoggedCommand("$$QMAKE_CXX -dumpmachine | sed 's/v8-rpi3//'", $${1}.tuple)|return(false)
        $${1}.cache += tuple
        export($${1}.cache)
        return(true)
    }
    

    Any help much appreciated.



  • try to download systoor-glibc...linux-gnueabihf and use it with parameter --sysroot=<path to sysroot_dir>



  • @r3d9u11 From what I understand, I need to pass in the device's rsync'd sysroot as I am doing so that Qt compiles against the libraries that are present on the device?
    I'll look into this though.



  • @bcam Try to see my scripts https://github.com/r3d9u11/env-maker/tree/master/Qt/Qt5-imx6, I think that it can be used for RPi (just change gcc-8 to linaro compiler)


Log in to reply