Compiling QT on windows for cross compilation with raspberry, fails. Project ERROR: Cannot run target compiler



  • Hello,

    I am running windows on my computer, trying to build QT 5.10.1 for cross compilation on my Raspberry Pi Zero Wireless.

    I am trying to follow the tutorial here: https://wiki.qt.io/RaspberryPi2EGLFS

    I came all the way until step 10, and stuck there.

    Running the following command:

    configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=C:/qt/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot C:/qt/raspi/sysroot -no-use-gold-linker -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix C:/qt/raspi/qt5pi -hostprefix C:/qt/raspi/qt5 -v
    

    the output is:

    C:\qt\raspi\qtbase>configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=C:/qt/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot C:/qt/raspi/sysroot -no-use-gold-linker -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix C:/qt/raspi/qt5pi -hostprefix C:/qt/raspi/qt5 -v
    Running syncqt ...
    <srcbase> = C:/qt/raspi/qtbase
    <outbase> = C:/qt/raspi/qtbase
    Bootstrapping qmake ...
    mingw32-make: Nothing to be done for 'first'.
    Command line: -release -opengl es2 -device linux-rasp-pi3-g++ -device-option "CROSS_COMPILE=C:/qt/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-" -sysroot C:/qt/raspi/sysroot -no-use-gold-linker -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix C:/qt/raspi/qt5pi -hostprefix C:/qt/raspi/qt5 -v
    Project ERROR: Cannot run target compiler 'C:/qt/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++'. Output:
    ===================
    'C:/qt/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++' is not recognized as an internal or external command,
    operable program or batch file.
    ===================
    Maybe you forgot to setup the environment?
    

    I checked, and the file exists but windows doesnt let me to run it this way. any help appreciated.

    Thanks in advance.


  • Qt Champions 2019

    @cskr You compiler executable looks like the one for Linux. Is it possible you installed Linux tool chain on your Windows? The link you posted describes how to do it on Linux. I highly recommend to do cross compilation on Linux (can be a virtual machine) instead on Windows - it is way easier.



  • @jsulm thank you for your help.

    I set up a virtual box ubuntu, and followed the same tutorial. And I am stuck at the same step.

    I run the command:

    ./configure -release -opengl es2 -device linux-rasp-pi3-g++ -no-use-gold-linker -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v
    

    The end of the output is:

    Info: creating cache file /home/sakir/qtbase/.qmake.cache
    Command line: -release -opengl es2 -device linux-rasp-pi3-g++ -no-use-gold-linker -device-option CROSS_COMPILE=/home/sakir/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -sysroot /home/sakir/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /home/sakir/raspi/qt5pi -hostprefix /home/sakir/raspi/qt5 -v
    Project ERROR: Cannot run target compiler '/home/sakir/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++'. Output:
    ===================
    sh: 1: /home/sakir/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++: not found
    ===================
    Maybe you forgot to setup the environment?
    
    

    The file exists, I made sure of it.

    0_1519308252592_ss.png

    I tried the clean command and run it again. It didn't work. I tried to run the same command with sudo, it didn't work.

    Is the tutorial missing a step? What am I doing wrong?



  • All right, I managed to overcome that error by changing to x64 compiler. But that command still does not work.

    My config.log is as follows:

    Command line: -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=/home/sakir/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot /home/sakir/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /home/sakir/raspi/qt5pi -hostprefix /home/sakir/raspi/qt5 -v -no-use-gold-linker
    executing config test machineTuple
    + /home/sakir/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -dumpmachine
    > arm-linux-gnueabihf
    test config.qtbase.tests.machineTuple succeeded
    executing config test verifyspec
    + cd /home/sakir/qtbase/config.tests/verifyspec && /home/sakir/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/sakir/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/sakir/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/sakir/raspi/sysroot" -early "CONFIG += cross_compile" /home/sakir/qtbase/config.tests/verifyspec
    > Info: creating stash file /home/sakir/qtbase/config.tests/.qmake.stash
    + cd /home/sakir/qtbase/config.tests/verifyspec && MAKEFLAGS= /usr/bin/make
    > /home/sakir/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/sakir/raspi/sysroot -O2 -std=gnu++11 -w -fPIC  -I. -I/home/sakir/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -o verifyspec.o verifyspec.cpp
    > /home/sakir/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/sakir/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/sakir/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/sakir/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/sakir/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o    
    > /home/sakir/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/sakir/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/sakir/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
    

    Any help appreciated. Thanks in advance.


  • Qt Champions 2019



  • @cskr
    Hello, Did you find any solution for this problem???



  • @cskr said in Compiling QT on windows for cross compilation with raspberry, fails. Project ERROR: Cannot run target compiler:

    a virtual box ubuntu, and followed the same tutorial. And I am stuck a

    I'm stuck at the same place. Any luck on a solution?



  • @FluxDice said in Compiling QT on windows for cross compilation with raspberry, fails. Project ERROR: Cannot run target compiler:

    I'm stuck at the same place.

    What place/step is that?
    What error message you've got?



  • I'm see the same error the original poster encountered. Qt's configure script seems to not be able to run the cross compiler but I can running it manually.

    vbox:~/qt-everywhere-src-5.13.0$ ./configure -release -static -verbose -opensource -device linux-imx6-g++ -device-option CROSS_COMPILE=/home/ghguest/Toolchain/arm-linux-gnueabihf- -sysroot /home/ghguest/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x -hostprefix $PWD/build
    + cd qtbase
    + /home/ghguest/qt-everywhere-src-5.13.0/qtbase/configure -top-level -release -static -verbose -opensource -device linux-imx6-g++ -device-option CROSS_COMPILE=/home/ghguest/Toolchain/arm-linux-gnueabihf- -sysroot /home/ghguest/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x -hostprefix /home/ghguest/qt-everywhere-src-5.13.0/build
    Creating qmake...
    make: Nothing to be done for 'first'.
    Command line: -release -static -verbose -opensource -device linux-imx6-g++ -device-option CROSS_COMPILE=/home/ghguest/Toolchain/arm-linux-gnueabihf- -sysroot /home/ghguest/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x -hostprefix /home/ghguest/qt-everywhere-src-5.13.0/build
    Project ERROR: Cannot run target compiler '/home/ghguest/Toolchain/arm-linux-gnueabihf-g++'. Output:
    ===================
    ===================
    Maybe you forgot to setup the environment?
    
    vbox:~/qt-everywhere-src-5.13.0$ /home/ghguest/Toolchain/arm-linux-gnueabihf-g++ --version
    arm-linux-gnueabihf-g++ (Debian 6.3.0-18) 6.3.0 20170516
    Copyright (C) 2016 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

  • Lifetime Qt Champion

    @mjohn

    Maybe you forgot to setup the environment?

    Have you?



  • I also stuck in that place with error:

    Project ERROR: Cannot run target compiler '<path>/arm-linux-gnueabihf-g++'.

    but indeed as @aha_1980 said:

    @aha_1980 said in Compiling QT on windows for cross compilation with raspberry, fails. Project ERROR: Cannot run target compiler:

    Maybe you forgot to setup the environment?

    The best checkout if compiler is accessible is to run in root dir where Qt sources are:

    // with entry in bashrc
    $ arm-linux-gnueabihf-g++ --version
    //or with absolute path:
    $ /home/<user_name>/<path-to-bin-where-compiler-is-located>/arm-linux-gnueabihf-g++ --version

    NOTE: replace <user_name> with your's user name, and replace <path-to-bin-where-compiler-is-located> with proper path as stated below.

    And then we should get info:

    arm-linux-gnueabihf-g++ (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) 4.8.3 20140303 (prerelease)
    ...

    The problem was with path to compiler: paths with "~" don't work, the best is to provide absolute path, for example:

    /home/<user_name>/<path-to-bin-where-compiler-is-located>
    // in my case:
    /home/<user_name>/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin

    Or add in .bashrc path to compiler by adding at the end of file:

    export PATH=$PATH:/home/<user_name>/<path-to-bin-where-compiler-is-located>
    // in my case:
    export PATH=$PATH:/home/<user_name>/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin

    Then running configure script we have:

    • with absolute path:

    $ ./configure <other options> -device-option CROSS_COMPILE=/home/<user_name>/<path-to-bin-where-compiler-is-located>/arm-linux-gnueabihf- <other options>
    // in my case:
    $ ./configure <other options> -device-option CROSS_COMPILE=/home/<user_name>/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- <other options>

    • with entry in bashrc:

    $ ./configure <other options> -device-option CROSS_COMPILE=/home/<user_name>/<path-to-bin-where-compiler-is-located>/arm-linux-gnueabihf- <other options>
    //in my case:
    $ ./configure <other options> -device-option CROSS_COMPILE=arm-linux-gnueabihf- <other options>

    Tested on RPi3 (with Raspbian from 2019-09-26) and Qt 5.12.6, on Ubuntu 18.03.4

    Cheers!