Problem cross-compiling Qt5 from Ubuntu to Raspbian(Raspberry pi3)



  • Hello everyone,

    I am cross-compiling Qt5 following the instruction from the wiki at https://wiki.qt.io/Raspberry_Pi_Beginners_Guide, but I had some troubles.

    I followed all the previous instruction and I had no errors but when i run the command:

    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi make -j 4 sudo make install
    

    The result was this:

    <srcbase> = /opt/qt5/qtbase 
    <outbase> = /opt/qt5/qtbase 
    Creating qmake...
    .Done.
    ERROR: Invalid command line parameter 'make'.
    

    Is this result correct? I have Ubuntu 16.04. Thank you in advance


  • Lifetime Qt Champion

    Hi,

    Looks like you don't have make installed which means that you are missing the basic tools for development.

    You should install the build-essential package.



  • Thank you for your reply, well I have already installed the build-essential package:

    michele@michele-SATELLITE-C660:~$ sudo apt-get install build-essential
    [sudo] password for michele: 
    Lettura elenco dei pacchetti... Fatto
    Generazione albero delle dipendenze       
    Lettura informazioni sullo stato... Fatto
    build-essential è già alla versione più recente. //I have build-essential most recent version
    I seguenti pacchetti sono stati installati automaticamente e non sono più richiesti:
      linux-headers-3.19.0-80 linux-headers-3.19.0-80-generic
      linux-image-3.19.0-80-generic linux-image-extra-3.19.0-80-generic
    Usare "apt-get autoremove" per rimuoverli.
    0 aggiornati, 0 installati, 0 da rimuovere e 1 non aggiornati.
    

    Well, i would like to post all the passages I made to be as clear as possible with problem I had during the passagges to know if I missed something.

    First of all, I am working as michele user, in the directory /home/michele/opt as the guide in the wiki says.

    1)Downloading files

    a)Raspbian
    Then I installed Raspbian

    wget http://downloads.raspberrypi.org/raspbian_latest -O wheezy-raspbian-latest.zip
    unzip wheezy-raspbian-latest.zip
    

    Before mounting it on the new directory /mnt/rasp-bi-rootfs I pay attention to the name and offset of the image. In my case they were:

    Name: 2017-04-10-raspbian-jessie.img
    Offset: 47185920

    So commands were:

    sudo mkdir /mnt/rasp-pi-rootfs 
    sudo mount -o loop,offset=47185920  2017-04-10-raspbian-jessie.img /mnt/rasp-pi-rootfs
    

    b) Cross-compilator
    I downloaded the cross compiling toolchain, but with the commands:

    wget https://www.dropbox.com/s/sl919ly0q79m1e6/gcc-4.7-linaro-rpi-gnueabihf.tbz
    

    or

    wgethttp://de.sourceforge.jp/projects/sfnet_rfidmonitor/downloads/crosscompilation-resources/gcc-4.7-linaro-rpi-gnueabihf.tbz
    

    What i downloaded was an incomplete .tbz file that i wasn' t able to unzip. I needed to download the file trought the browser at :

    http://de.sourceforge.jp/projects/sfnet_rfidmonitor/downloads/crosscompilation-resources/gcc-4.7-linaro-rpi-gnueabihf.tbz
    

    However I moved it in ~/opt (that is, in my case /home/michele/opt)and I unzip it with:

    tar -xf gcc-4.7-linaro-rpi-gnueabihf.tbz
    

    c) Libraries
    Next i had to install libraries ia32-libs, as I have a 64 bit version (Ubuntu 16.04)
    Try installing lib32z1 lib32ncurses5 lib32bz2-1.0 instead. run the commands:

    sudo apt-get install lib32z1 
    sudo apt-get install lib32ncurses5
    sudo apt-get install lib32bz2-1.0
    

    but with the last I had problems, the message was this:

    sudo apt-get install lib32bz2-1.0
    [sudo] password for michele: 
    Lettura elenco dei pacchetti... Fatto
    Generazione albero delle dipendenze       
    Lettura informazioni sullo stato... Fatto
    E: Impossibile trovare il pacchetto lib32bz2-1.0
    E: Impossibile trovare alcun pacchetto tramite l'espressione regolare "lib32bz2-1.0"
    

    "Impossible to find the library." I could install only the first ones.(lib32z1 and lib32ncurses)

    d) Cross Compiling Tools

    I download them with the command:

    git clone https://github.com/darius-kim/cross-compile-tools.git
    

    e) Qt5

    git clone git://code.qt.io/qt/qt5.git
    cd qt5
    

    As I had firewall problems I run:

    sed -i 's/git:/https:git./' .gitmodules
    ./init-repository -f
    

    This command tooe several time.

    2) Compiling qt base

    First of all I run the command:

    cd ~/opt/cross-compile-tools sudo ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/ ~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
    

    Then I run the command in directory ~/opt/qt5/qtbase:

    /configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi make -j 4 sudo make install
    

    It returns the same error than other time. Then I noticed that there was an error in the guide, it isn' t:

    make **-j 4** sudo make install
    

    but j and 4 must be near, so it is

    make **-j4** sudo make install
    

    Or am I wrong?

    However even with this change, the command returned me the same error. Regarding this command I have a a doubt for the parts:

    -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi

    the directory /usr/local/qt5pi was in the /home/michele/opt/qt5/qtbase directory. Is it normal? Or does the director refer to the image mounted on /mnt?

    Thank you very much, any suggestion would be appreciated.


  • Lifetime Qt Champion

    Why such an old version of the compiler ? IIRC, the RPi folks are currently providing the cross-compiler on GitHub.



  • Could you give me the link, or the name of the version of the cross-compiler? And is there something wrong with what I did?


  • Lifetime Qt Champion

    https://github.com/raspberrypi/tools

    It's best to use the same generation of compiler that was used for building the distribution.



  • I did:

    git clone https://github.com/raspberrypi/tools
    

    In my ~/opt repository.
    but now i don' t know how to exactly use this cross-compiler. Could give me any advice?


  • Lifetime Qt Champion

    The same way you use your other cross-compiler.



  • The problem is that I found 5 different folder that seem to be cross-compiler and I don' t know which to chose:

    In the folder /tools/arm-bcm2708 i found these folders:

    arm-bcm2708hardfp-linux-gnueabi  gcc-linaro-arm-linux-gnueabihf-raspbian
    arm-bcm2708-linux-gnueabi        gcc-linaro-arm-linux-gnueabihf-raspbian-x64
    arm-rpi-4.9.3-linux-gnueabihf
    

    which should I use? Moreover Could you tell me even the reason of your choice, because I would like to know in which case i should use other cross compilers. Thank you so much.

    PS: I have a raspberry pi3, and I downloaded the 2017-04-10-raspbian-jessie.img image from http://downloads.raspberrypi.org/raspbian_latest


  • Lifetime Qt Champion

    I usually select the cross-compiler that matches what was used to build the distribution running on the given device.

    In the case of the tools, 4.9.3 is the most recent, the others are several years old and don't make sense to use since you are running the latest image on your device.

    Technically 4.9.3 is also not the most recent version of GCC but AFAIK it matches the one used to build the raspbian image.



  • thank you SGaist, but how could you know the compiler used to build the distribution?

    However as now I have the cross-compiler I used the cross-compile-tools I downloaded from the wiki to fix symlinks(what are they?) and lib paths(as the wiki says) . So I command:

    cd ~/opt/cross-compile-tools sudo ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/ ~/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
    
    

    But i don' think there was some changes, because I tried to modify the path, and I inserted a wrong one, but the command didn' t return any error. Moreover it seemed no time spended to execute the command.


  • Lifetime Qt Champion

    Usually looking at the compiler package provided by the distribution provides that info.

    The script itself is pretty fast.

    Which version of the script did you use exactly ?



  • I don' t know. The script is called fixQualifiedLibraryPaths and I have only the code, no infos about the version:

    #!/bin/bash
    #This script is ugly, feel free to fix it
    
    if [ "$#" -ne 1 ]; then
        echo "usage ./cmd target-rootfs"
        exit -1
    fi
    
    #passed args
    ROOTFS=$1
    TOOLCHAIN=arm-linux-gnueabihf
    
    INITIAL_DIR=$PWD
    
    function adjustSymLinks
    {
        echo "Adjusting the symlinks in $1 to be relative"
        cd $1
        find . -maxdepth 1 -type l | while read i;
        do qualifies=$(file $i | sed -e "s/.*\`\(.*\)'/\1/g" | grep ^/lib)
        if [ -n "$qualifies" ]; then
        newPath=$(file $i | sed -e "s/.*\`\(.*\)'/\1/g" | sed -e "s,\`,,g" | sed -e "s,',,g" | sed -e "s,^/lib,$2/lib,g");
        echo $i
        echo $newPath;
        sudo rm $i;
        sudo ln -s $newPath $i;
        fi
        done
        cd $INITIAL_DIR
    }
    
    adjustSymLinks $ROOTFS/usr/lib "../.."
    
    echo "Testing for existence of potential debian multi-arch dir: $DEB_MULTI_ARCH_MADNESS"
    
    if [ -n "$DEB_MULTI_ARCH_MADNESS" -a -e "$DEB_MULTI_ARCH_MADNESS" ]; then
        echo "Debian multiarch dir exists, adjusting"
        adjustSymLinks $DEB_MULTI_ARCH_MADNESS "../../.."
    fi
    

    Have you a script you are sure that it will work well? I am trying to cross-compile Qt5


  • Lifetime Qt Champion

    You should have some feedback. One thing I'd do use the full path rather than ~.



  • Hi SGaist,

    yes I tried to use the full path by command:

    ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
    

    and what I receiced was this error:

    usage ./cmd target-rootfs
    

    Well at that poiint I tried to run this command without the cross compiler path:

    ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs
    

    And I received this:

    Adjusting the symlinks in /mnt/rasp-pi-rootfs/usr/lib to be relative
    Testing for existence of potential debian multi-arch dir:
    

    But I don' t think it is right as I didn' t use any cross compiler in the command, infact when I after run the command to cross compile, it happened:

    <srcbase> = /home/michele/opt/qt5/qtbase 
    <outbase> = /home/michele/opt/qt5/qtbase 
    Creating qmake...
    .Done.
    
    This is the Qt Open Source Edition.
    
    You have already accepted the terms of the Open Source license.
    
    Running configuration tests...
    Done running configuration tests.
    
    Configure summary:
    
    Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
    Building for: devices/linux-rasp-pi-g++ (arm, CPU features: <none>)
    Configuration: cross_compile compile_examples enable_new_dtags largefile precompile_header shared rpath accessibility release c++11 concurrent dbus mremap reduce_exports release_tools stl
    Build options:
      Mode ................................... release; optimized tools
      Building shared libraries .............. yes
      Using C++ standard ..................... C++11
      Using gold linker ...................... no
      Using new DTAGS ........................ yes
      Using precompiled headers .............. yes
      Using LTCG ............................. no
      Target compiler supports:
        NEON ................................. no
      Build parts ............................ libs
    Qt modules and options:
      Qt Concurrent .......................... yes
      Qt D-Bus ............................... yes
      Qt D-Bus directly linked to libdbus .... no
      Qt Gui ................................. yes
      Qt Network ............................. yes
      Qt Sql ................................. yes
      Qt Testlib ............................. yes
      Qt Widgets ............................. yes
      Qt Xml ................................. yes
    Support enabled for:
      Accessibility .......................... yes
      Using pkg-config ....................... yes
      QML debugging .......................... yes
      udev ................................... no
      Using system zlib ...................... yes
    Qt Core:
      DoubleConversion ....................... yes
        Using system DoubleConversion ........ no
      GLib ................................... no
      iconv .................................. yes
      ICU .................................... no
      Logging backends:
        journald ............................. no
        syslog ............................... no
        slog2 ................................ no
      Using system PCRE ...................... no
    Qt Network:
      getaddrinfo() .......................... yes
      getifaddrs() ........................... yes
      IPv6 ifname ............................ yes
      libproxy ............................... no
      OpenSSL ................................ no
        Qt directly linked to OpenSSL ........ no
      SCTP ................................... no
      Use system proxies ..................... yes
    Qt Sql:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    Qt Gui:
      FreeType ............................... yes
        Using system FreeType ................ yes
      HarfBuzz ............................... yes
        Using system HarfBuzz ................ no
      Fontconfig ............................. no
      Image formats:
        GIF .................................. no
        ICO .................................. no
        JPEG ................................. no
          Using system libjpeg ............... no
        PNG .................................. yes
          Using system libpng ................ yes
      OpenGL:
        EGL .................................. yes
        Desktop OpenGL ....................... no
        OpenGL ES 2.0 ........................ yes
        OpenGL ES 3.0 ........................ no
        OpenGL ES 3.1 ........................ no
      Session Management ..................... yes
    Features used by QPA backends:
      evdev .................................. yes
      libinput ............................... no
      mtdev .................................. no
      tslib .................................. no
      xkbcommon-evdev ........................ no
    QPA backends:
      DirectFB ............................... no
      EGLFS .................................. yes
      EGLFS details:
        EGLFS i.Mx6 .......................... no
        EGLFS i.Mx6 Wayland .................. no
        EGLFS EGLDevice ...................... no
        EGLFS GBM ............................ no
        EGLFS Mali ........................... no
        EGLFS Raspberry Pi ................... yes
        EGL on X11 ........................... no
      LinuxFB ................................ yes
      Mir client ............................. no
    Qt Widgets:
      GTK+ ................................... no
      Styles ................................. Fusion Windows
    Qt PrintSupport:
      CUPS ................................... no
    
    Note: Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
    
    Note: -optimized-tools is not useful in -release mode.
    
    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into '/mnt/rasp-pi-rootfs/usr/local/qt5pi'.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    
    

    Then i run make -j4 and I receveid this error:

    cd src/ && ( test -e Makefile || /home/michele/opt/qt5/qtbase/bin/qmake -o Makefile /home/michele/opt/qt5/qtbase/src/src.pro ) && make -f Makefile 
    cd qmake/ && ( test -e Makefile.qmake-aux || /home/michele/opt/qt5/qtbase/bin/qmake -o Makefile.qmake-aux /home/michele/opt/qt5/qtbase/qmake/qmake-aux.pro ) && make -f Makefile.qmake-aux 
    cd doc/ && ( test -e Makefile || /home/michele/opt/qt5/qtbase/bin/qmake -o Makefile /home/michele/opt/qt5/qtbase/doc/doc.pro ) && make -f Makefile 
    make[1]: Entering directory '/home/michele/opt/qt5/qtbase/qmake'
    make binary
    make[1]: Entering directory '/home/michele/opt/qt5/qtbase/doc'
    /home/michele/opt/qt5/qtbase/bin/qmake -o Makefile doc.pro
    make[2]: Entering directory '/home/michele/opt/qt5/qtbase/qmake'
    g++ -c -o qlibraryinfo_final.o  -pipe -std=c++11 -ffunction-sections -O2 -g  -I/home/michele/opt/qt5/qtbase/qmake -I/home/michele/opt/qt5/qtbase/qmake/library -I/home/michele/opt/qt5/qtbase/qmake/generators -I/home/michele/opt/qt5/qtbase/qmake/generators/unix -I/home/michele/opt/qt5/qtbase/qmake/generators/win32 -I/home/michele/opt/qt5/qtbase/qmake/generators/mac -I../include -I../include/QtCore -I../include/QtCore/5.8.1 -I../include/QtCore/5.8.1/QtCore -I../src/corelib/global -I/home/michele/opt/qt5/qtbase/mkspecs/linux-g++ -DQT_VERSION_STR=\"5.8.1\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=8 -DQT_VERSION_PATCH=1 -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_FOREACH /home/michele/opt/qt5/qtbase/src/corelib/global/qlibraryinfo.cpp
    make[1]: Entering directory '/home/michele/opt/qt5/qtbase/src'
    /home/michele/opt/qt5/qtbase/bin/qmake -o Makefile src.pro
    Failure to open file: /home/michele/opt/qt5/qtbase/doc/Makefile
    Unable to generate makefile for: doc.pro
    Makefile:152: recipe for target 'Makefile' failed
    make[1]: *** [Makefile] Error 5
    make[1]: Leaving directory '/home/michele/opt/qt5/qtbase/doc'
    Makefile:146: recipe for target 'sub-doc-make_first' failed
    make: *** [sub-doc-make_first] Error 2
    make: *** Waiting for unfinished jobs....
    Failure to open file: /home/michele/opt/qt5/qtbase/src/Makefile
    Unable to generate makefile for: src.pro
    Makefile:780: recipe for target 'Makefile' failed
    make[1]: *** [Makefile] Error 5
    make[1]: Leaving directory '/home/michele/opt/qt5/qtbase/src'
    Makefile:46: recipe for target 'sub-src-make_first' failed
    make: *** [sub-src-make_first] Error 2
    g++ -o "../qmake/qmake" project.o option.o property.o main.o ioutils.o proitems.o qmakevfs.o qmakeglobals.o qmakeparser.o qmakeevaluator.o qmakebuiltins.o makefile.o unixmake2.o unixmake.o mingw_make.o winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o qringbuffer.o qdebug.o qmalloc.o qglobal.o qarraydata.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfiledevice.o qfile.o qfilesystementry.o qfilesystemengine.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror.o qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlinkedlist.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o qlogging.o qjson.o qjsondocument.o qjsonparser.o qjsonarray.o qjsonobject.o qjsonvalue.o qfilesystemengine_unix.o qfilesystemiterator_unix.o qfsfileengine_unix.o qlocale_unix.o  qlibraryinfo_final.o   -Wl,--gc-sections
    make[2]: Leaving directory '/home/michele/opt/qt5/qtbase/qmake'
    make[1]: Leaving directory '/home/michele/opt/qt5/qtbase/qmake'
    

    Note:
    (The path of the cross-compiler is consistent as i tried to do:

    cd /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin
    

    )


  • Lifetime Qt Champion

    Your log is not complete, please restart without the -j parameter so you can have the exact point of failure.



  • @BadBlood The sample commands are wrong. Either you need to && between the individual commands, or run then individually. For example:

    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi && make -j 4 && sudo make install
    

    OR

    > ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
    > make -j 4
    > sudo make install
    

    Also, maybe try to git from github:

    > git clone https://github.com/qt/qtbase.git -b 5.8
    

    Change 2) Compiling qt base:

    > cd ~/opt/cross-compile-tools
    > sudo ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/ ~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
    

    Also, take a look at this bug if you're using raspberrypi/tools:
    Update toolchain to support gcc 4.9 raspi3/jessie #73



  • Thank you very much guys,

    I had some problems with cross-compiling and I couldn' t to reply to SGaist. Thank you for && advice, i didn' t know that, and thank you for the link.

    I couldn' t reply to SGaist beacuse I wanted to repeat all passages: I had problems with the cross compiling configuration command. In particular when I run the command:

    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
    

    I received this error:

    <srcbase> = /home/michele/opt/qt5/qtbase 
    <outbase> = /home/michele/opt/qt5/qtbase 
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/animation/ { qabstractanimation.h (1), qabstractanimation_p.h (1), qanimationgroup.h (1), qanimationgroup_p.h (1), qparallelanimationgroup.h (1), qparallelanimationgroup_p.h (1), qpauseanimation.h (1), qpropertyanimation.h (1), qpropertyanimation_p.h (1), qsequentialanimationgroup.h (1), qsequentialanimationgroup_p.h (1), qvariantanimation.h (1), qvariantanimation_p.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/arch/ { qatomic_bootstrap.h (1), qatomic_cxx11.h (1), qatomic_msvc.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/codecs/ { cp949codetbl_p.h (1), qbig5codec_p.h (1), qeucjpcodec_p.h (1), qeuckrcodec_p.h (1), qgb18030codec_p.h (1), qiconvcodec_p.h (1), qicucodec_p.h (1), qisciicodec_p.h (1), qjiscodec_p.h (1), qjpunicode_p.h (1), qlatincodec_p.h (1), qsimplecodec_p.h (1), qsjiscodec_p.h (1), qtextcodec.h (1), qtextcodec_p.h (1), qtsciicodec_p.h (1), qutfcodec_p.h (1), qwindowscodec_p.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/global/ { qcompilerdetection.h (1), qconfig-bootstrapped.h (1), qendian.h (2), qflags.h (1), qglobal.h (2), qglobal_p.h (1), qglobalstatic.h (1), qhooks_p.h (1), qisenum.h (1), qlibraryinfo.h (1), qlogging.h (1), qnamespace.h (2), qnumeric.h (2), qnumeric_p.h (1), qprocessordetection.h (1), qsysinfo.h (1), qsystemdetection.h (1), qt_pch.h (1), qt_windows.h (1), qtypeinfo.h (1), qtypetraits.h (1), qversiontagging.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/io/ { qabstractfileengine_p.h (1), qbuffer.h (1), qdatastream.h (1), qdatastream_p.h (1), qdataurl_p.h (1), qdebug.h (2), qdebug_p.h (1), qdir.h (1), qdir_p.h (1), qdiriterator.h (1), qfile.h (1), qfile_p.h (1), qfiledevice.h (1), qfiledevice_p.h (1), qfileinfo.h (1), qfileinfo_p.h (1), qfileselector.h (1), qfileselector_p.h (1), qfilesystemengine_p.h (1), qfilesystementry_p.h (1), qfilesystemiterator_p.h (1), qfilesystemmetadata_p.h (1), qfilesystemwatcher.h (1), qfilesystemwatcher_fsevents_p.h (1), qfilesystemwatcher_inotify_p.h (1), qfilesystemwatcher_kqueue_p.h (1), qfilesystemwatcher_p.h (1), qfilesystemwatcher_polling_p.h (1), qfilesystemwatcher_win_p.h (1), qfsfileengine_iterator_p.h (1), qfsfileengine_p.h (1), qiodevice.h (1), qiodevice_p.h (1), qipaddress_p.h (1), qlockfile.h (1), qlockfile_p.h (1), qloggingcategory.h (1), qloggingregistry_p.h (1), qnoncontiguousbytedevice_p.h (1), qprocess.h (1), qprocess_p.h (1), qresource.h (1), qresource_iterator_p.h (1), qresource_p.h (1), qsavefile.h (1), qsavefile_p.h (1), qsettings.h (1), qsettings_p.h (1), qstandardpaths.h (1), qstorageinfo.h (1), qstorageinfo_p.h (1), qtemporarydir.h (1), qtemporaryfile.h (1), qtemporaryfile_p.h (1), qtextstream.h (1), qtextstream_p.h (1), qtldurl_p.h (1), qurl.h (1), qurl_p.h (1), qurlquery.h (1), qurltlds_p.h (1), qwindowspipereader_p.h (1), qwindowspipewriter_p.h (1), qwinoverlappedionotifier_p.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/itemmodels/ { qabstractitemmodel.h (1), qabstractitemmodel_p.h (1), qabstractproxymodel.h (1), qabstractproxymodel_p.h (1), qidentityproxymodel.h (1), qitemselectionmodel.h (1), qitemselectionmodel_p.h (1), qsortfilterproxymodel.h (1), qstringlistmodel.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/json/ { qjson_p.h (1), qjsonarray.h (1), qjsondocument.h (1), qjsonobject.h (1), qjsonparser_p.h (1), qjsonvalue.h (1), qjsonwriter_p.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/kernel/ { qabstracteventdispatcher.h (1), qabstracteventdispatcher_p.h (1), qabstractnativeeventfilter.h (1), qbasictimer.h (1), qcfsocketnotifier_p.h (1), qcore_mac_p.h (1), qcore_unix_p.h (1), qcoreapplication.h (1), qcoreapplication_p.h (1), qcorecmdlineargs_p.h (1), qcoreevent.h (1), qcoreglobaldata_p.h (1), qdeadlinetimer.h (1), qdeadlinetimer_p.h (1), qelapsedtimer.h (1), qeventdispatcher_cf_p.h (1), qeventdispatcher_glib_p.h (1), qeventdispatcher_unix_p.h (1), qeventdispatcher_win_p.h (1), qeventdispatcher_winrt_p.h (1), qeventloop.h (1), qeventloop_p.h (1), qfunctions_fake_env_p.h (1), qfunctions_nacl.h (1), qfunctions_p.h (1), qfunctions_vxworks.h (1), qfunctions_winrt.h (1), qjni_p.h (1), qjnihelpers_p.h (1), qmath.h (1), qmetaobject.h (1), qmetaobject_moc_p.h (1), qmetaobject_p.h (1), qmetaobjectbuilder_p.h (1), qmetatype.h (1), qmetatype_p.h (1), qmetatypeswitcher_p.h (1), qmimedata.h (1), qobject.h (1), qobject_impl.h (1), qobject_p.h (1), qobjectcleanuphandler.h (1), qobjectdefs.h (1), qobjectdefs_impl.h (1), qpointer.h (1), qpoll_p.h (1), qppsattribute_p.h (1), qppsattributeprivate_p.h (1), qppsobject_p.h (1), qppsobjectprivate_p.h (1), qsharedmemory.h (1), qsharedmemory_p.h (1), qsignalmapper.h (1), qsocketnotifier.h (1), qsystemerror_p.h (1), qsystemsemaphore.h (1), qsystemsemaphore_p.h (1), qtimer.h (1), qtimerinfo_unix_p.h (1), qtranslator.h (1), qtranslator_p.h (1), qvariant.h (4), qvariant_p.h (1), qwineventnotifier.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/mimetypes/ { qmimedatabase.h (1), qmimedatabase_p.h (1), qmimeglobpattern_p.h (1), qmimemagicrule_p.h (1), qmimemagicrulematcher_p.h (1), qmimeprovider_p.h (1), qmimetype.h (1), qmimetype_p.h (1), qmimetypeparser_p.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/plugin/ { qelfparser_p.h (1), qfactoryinterface.h (1), qfactoryloader_p.h (1), qlibrary.h (1), qlibrary_p.h (1), qmachparser_p.h (1), qplugin.h (2), qpluginloader.h (1), qsystemlibrary_p.h (1), quuid.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/statemachine/ { qabstractstate.h (1), qabstractstate_p.h (1), qabstracttransition.h (1), qabstracttransition_p.h (1), qeventtransition.h (1), qeventtransition_p.h (1), qfinalstate.h (1), qfinalstate_p.h (1), qhistorystate.h (1), qhistorystate_p.h (1), qsignaleventgenerator_p.h (1), qsignaltransition.h (1), qsignaltransition_p.h (1), qstate.h (1), qstate_p.h (1), qstatemachine.h (1), qstatemachine_p.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/thread/ { qatomic.h (1), qbasicatomic.h (1), qexception.h (1), qfuture.h (1), qfutureinterface.h (1), qfutureinterface_p.h (1), qfuturesynchronizer.h (1), qfuturewatcher.h (1), qfuturewatcher_p.h (1), qgenericatomic.h (1), qmutex.h (1), qmutex_p.h (1), qmutexpool_p.h (1), qorderedmutexlocker_p.h (1), qreadwritelock.h (1), qreadwritelock_p.h (1), qresultstore.h (1), qrunnable.h (1), qsemaphore.h (1), qthread.h (1), qthread_p.h (1), qthreadpool.h (1), qthreadpool_p.h (1), qthreadstorage.h (1), qwaitcondition.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/tools/ { qalgorithms.h (2), qarraydata.h (1), qarraydataops.h (1), qarraydatapointer.h (1), qbitarray.h (1), qbytearray.h (1), qbytearray_p.h (1), qbytearraylist.h (1), qbytearraymatcher.h (1), qbytedata_p.h (1), qcache.h (1), qchar.h (1), qcollator.h (1), qcollator_p.h (1), qcommandlineoption.h (1), qcommandlineparser.h (1), qcontainerfwd.h (2), qcontiguouscache.h (1), qcryptographichash.h (1), qdatetime.h (1), qdatetime_p.h (1), qdatetimeparser_p.h (1), qdoublescanprint_p.h (1), qeasingcurve.h (1), qfreelist_p.h (1), qharfbuzz_p.h (1), qhash.h (1), qhashfunctions.h (1), qiterator.h (1), qline.h (1), qlinkedlist.h (1), qlist.h (1), qlocale.h (1), qlocale_data_p.h (1), qlocale_p.h (1), qlocale_tools_p.h (1), qmap.h (1), qmargins.h (1), qmessageauthenticationcode.h (1), qpair.h (1), qpodlist_p.h (1), qpoint.h (1), qqueue.h (1), qrect.h (1), qrefcount.h (1), qregexp.h (1), qregularexpression.h (1), qringbuffer_p.h (1), qscopedpointer.h (1), qscopedpointer_p.h (1), qscopedvaluerollback.h (1), qset.h (1), qshareddata.h (1), qsharedpointer.h (1), qsharedpointer_impl.h (1), qsimd_p.h (1), qsize.h (1), qstack.h (1), qstring.h (1), qstringalgorithms_p.h (1), qstringbuilder.h (1), qstringiterator_p.h (1), qstringlist.h (1), qstringmatcher.h (1), qtextboundaryfinder.h (1), qtimeline.h (1), qtimezone.h (1), qtimezoneprivate_data_p.h (1), qtimezoneprivate_p.h (1), qtools_p.h (1), qunicodetables_p.h (1), qunicodetools_p.h (1), qvarlengtharray.h (1), qvector.h (1), qversionnumber.h (1) }
    QtCore: created fwd-include header(s) for <srcbase>/src/corelib/xml/ { qxmlstream.h (1), qxmlstream_p.h (1), qxmlutils_p.h (1) }
    Creating qmake...
    .......................................................................................Done.
    Info: creating cache file /home/michele/opt/qt5/qtbase/.qmake.cache
    Info: creating stash file /home/michele/opt/qt5/qtbase/.qmake.stash
    
    This is the Qt Open Source Edition.
    
    You have already accepted the terms of the Open Source license.
    
    Running configuration tests...
    Checking for gold linker... no
    Checking for machine tuple... yes
    Checking for valid makespec... Note: Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
    
    ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
    
    Check config.log for details.
    

    So I check the config.log and his content is this:

    config.log

    Command line: -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
    executing config test use_gold_linker
    + cd /home/michele/opt/qt5/qtbase/config.tests && /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -fuse-ld=gold -o conftest-out conftest.cpp
    > collect2: fatal error: cannot find 'ld'
    > compilation terminated.
    test config.qtbase.tests.use_gold_linker FAILED
    executing config test machineTuple
    + /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -dumpmachine
    > arm-linux-gnueabihf
    test config.qtbase.tests.machineTuple succeeded
    executing config test verifyspec
    + cd /home/michele/opt/qt5/qtbase/config.tests/common/verifyspec && /home/michele/opt/qt5/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared console" "QMAKE_CFLAGS += --sysroot=/mnt/rasp-pi-rootfs" "QMAKE_CXXFLAGS += --sysroot=/mnt/rasp-pi-rootfs" "QMAKE_LFLAGS += --sysroot=/mnt/rasp-pi-rootfs" -early "CONFIG += cross_compile" /home/michele/opt/qt5/qtbase/config.tests/common/verifyspec
    > Info: creating stash file /home/michele/opt/qt5/qtbase/config.tests/.qmake.stash
    + cd /home/michele/opt/qt5/qtbase/config.tests/common/verifyspec && MAKEFLAGS= /usr/bin/make
    > /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -c -pipe -marm -mfpu=vfp -mtune=arm1176jzf-s -march=armv6zk -mabi=aapcs-linux -mfloat-abi=hard --sysroot=/mnt/rasp-pi-rootfs -O2 -std=gnu++11 -Wall -W -fPIC  -I. -I/home/michele/opt/qt5/qtbase/mkspecs/devices/linux-rasp-pi-g++ -o verifyspec.o verifyspec.cpp
    > /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -Wl,-rpath-link,/mnt/rasp-pi-rootfs/opt/vc/lib -Wl,-rpath-link,/mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/mnt/rasp-pi-rootfs/lib/arm-linux-gnueabihf -mfloat-abi=hard --sysroot=/mnt/rasp-pi-rootfs -Wl,-O1 -o verifyspec verifyspec.o    
    > /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
    > /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
    > /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lm
    > collect2: error: ld returned 1 exit status
    > Makefile:64: recipe for target 'verifyspec' failed
    > make: *** [verifyspec] Error 1
    


  • @SGaist said in Problem cross-compiling Qt5 from Ubuntu to Raspbian(Raspberry pi3):

    Your log is not complete, please restart without the -j parameter so you can have the exact point of failure.

    Hi SGaist, sorry for delay

    The problem was the cross compiler, if I made the configuration with 4.9.3 v. It returned me the error I attached, but if I use the other one(4.7) cross compiling configuration works fine.

    However when i run "make" I had the error. As the log is too big to attach here, i will send you the one drive link to the log file containng the error I received.

    https://1drv.ms/f/s!As3fa8j7GVzZl3jMIGjxQEDF-nuJ


  • Lifetime Qt Champion

    I can't see any error in the file you shared.



  • Sorry but the files was cutted. Now i have the correct one:

    https://1drv.ms/u/s!As3fa8j7GVzZl3pQPdL3ROQsNCpe


  • Lifetime Qt Champion

    You can try the workaround described here.



  • Hi SGaist,

    I had another error but the last disappered, i will link the log file.

    https://1drv.ms/u/s!As3fa8j7GVzZl3som_ciawx9hu50

    First lines were cutted, but there are the most important about the error.


  • Lifetime Qt Champion

    I'd still opt for changing to a more recent version of gcc like 4.9



  • I tried to use gcc 4.9, but it returns the error during cross compiling configuration, I linked few weeks ago. The cross compiler I chose is in the directory:

    /home/michele/opt/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin
    

Log in to reply