Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. Cross-compiling RPi application using Qt Creator
Forum Updated to NodeBB v4.3 + New Features

Cross-compiling RPi application using Qt Creator

Scheduled Pinned Locked Moved Unsolved QtonPi
30 Posts 3 Posters 6.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Pavel_47P Pavel_47

    So, what about original problem: what location use in bulding command - linux-rasp-pi-g++ or linux-rasp-pi2-g++ ?

    sierdzioS Offline
    sierdzioS Offline
    sierdzio
    Moderators
    wrote on last edited by
    #14

    @Pavel_47 said in Cross-compiling RPi application using Qt Creator:

    So, what about original problem: what location use in bulding command - linux-rasp-pi-g++ or linux-rasp-pi2-g++ ?

    All your input so far suggest you are actually compiling Qt 5.5. Please make sure you're working with the 5.12.3 source you downloaded.

    (Z(:^

    1 Reply Last reply
    0
    • Pavel_47P Offline
      Pavel_47P Offline
      Pavel_47
      wrote on last edited by
      #15

      Yes !!! Misunderstanding with my colleague - I believed that folder qt-everywhere-opensource-src-5.5.0 corresponds to the latest source of Qt. Indeed there are new device folder that correspond to RPi3: linux-rasp-pi3-g++ and linux-rasp-pi3-vc4-g++. What is the difference between them ?
      Thanks.

      Pavel_47P 1 Reply Last reply
      0
      • Pavel_47P Pavel_47

        Yes !!! Misunderstanding with my colleague - I believed that folder qt-everywhere-opensource-src-5.5.0 corresponds to the latest source of Qt. Indeed there are new device folder that correspond to RPi3: linux-rasp-pi3-g++ and linux-rasp-pi3-vc4-g++. What is the difference between them ?
        Thanks.

        Pavel_47P Offline
        Pavel_47P Offline
        Pavel_47
        wrote on last edited by
        #16

        @Pavel_47 Ok, I see - OpenGL support

        1 Reply Last reply
        0
        • Pavel_47P Offline
          Pavel_47P Offline
          Pavel_47
          wrote on last edited by
          #17

          Error while building !

          Preparing build tree...
          Creating qmake...
          ..............................c:/Users/pyo/Downloads/qt-everywhere-src-5.12.3/qtbase/src/corelib/global/qglobal.cpp:
          In function 'QString qEnvironmentVariable(const char*, const QString&)':
          c:/Users/pyo/Downloads/qt-everywhere-src-5.12.3/qtbase/src/corelib/global/qglobal.cpp:3346:49: error: '_wgetenv_s' was not declared in this scope
               _wgetenv_s(&requiredSize, 0, 0, wname.data());
                                                           ^
          make.exe: *** [qglobal.o] Error 1
          
          1 Reply Last reply
          0
          • Pavel_47P Offline
            Pavel_47P Offline
            Pavel_47
            wrote on last edited by
            #18

            Indeed, I've hierarchically searched for _wgetenv_s through whole qt-everywhere-src-5.12.3 (.cpp and .h) and found that it's referenced only in qglobal.cpp ... and declared/defined nowhere.

            1 Reply Last reply
            0
            • Pavel_47P Offline
              Pavel_47P Offline
              Pavel_47
              wrote on last edited by
              #19

              On this link the author propose a workaround (although I'm not sure if this workaround is valid for my case).
              Anyway I've added this instruction (i.e. defined MINGW_HAS_SECURE_API flag as suggested)
              DEFINES += UNICODE _UNICODE WIN32 MINGW_HAS_SECURE_API=1
              in ...\win32-g++\qmake.conf
              Unfortunately it didn't help

              1 Reply Last reply
              0
              • Pavel_47P Offline
                Pavel_47P Offline
                Pavel_47
                wrote on last edited by
                #20

                Well, I reported this issue as bug on
                https://bugreports.qt.io/

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #21

                  Sounds like something that would not happen on Linux. I have never encountered this error, so I can only wish you luck :D

                  (Z(:^

                  1 Reply Last reply
                  0
                  • Pablo J. RoginaP Pablo J. Rogina

                    @Pavel_47 you may want to try this guide, in particular the section to setup Qt Creator

                    Pavel_47P Offline
                    Pavel_47P Offline
                    Pavel_47
                    wrote on last edited by
                    #22

                    @Pablo-J.-Rogina said in Cross-compiling RPi application using Qt Creator:

                    @Pavel_47 you may want to try this guide, in particular the section to setup Qt Creator

                    Well, having problem with building toolchain under Windows, I decided to switch to Linux.
                    But in Linux I've also met problem while configuring Qt. Here is the result if executing ./configure:

                    Project ERROR: Cannot run target compiler 'g++'. Output:
                    ===================
                    Using built-in specs.
                    COLLECT_GCC=g++
                    g++: error: unrecognized command line option '-mfpu=crypto-neon-fp-armv8'
                    g++: error: unrecognized command line option '-mfloat-abi=hard'
                    Target: x86_64-linux-gnu
                    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
                    Thread model: posix
                    gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) 
                    ===================
                    Maybe you forgot to setup the environment?
                    
                    sierdzioS 1 Reply Last reply
                    0
                    • Pavel_47P Pavel_47

                      @Pablo-J.-Rogina said in Cross-compiling RPi application using Qt Creator:

                      @Pavel_47 you may want to try this guide, in particular the section to setup Qt Creator

                      Well, having problem with building toolchain under Windows, I decided to switch to Linux.
                      But in Linux I've also met problem while configuring Qt. Here is the result if executing ./configure:

                      Project ERROR: Cannot run target compiler 'g++'. Output:
                      ===================
                      Using built-in specs.
                      COLLECT_GCC=g++
                      g++: error: unrecognized command line option '-mfpu=crypto-neon-fp-armv8'
                      g++: error: unrecognized command line option '-mfloat-abi=hard'
                      Target: x86_64-linux-gnu
                      Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
                      Thread model: posix
                      gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) 
                      ===================
                      Maybe you forgot to setup the environment?
                      
                      sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #23

                      @Pavel_47 said in Cross-compiling RPi application using Qt Creator:

                      gcc version 4.8.4

                      Ancient stuff... I hope RPi will update their toolchain finally some day.

                      --target=x86_64-linux-gnu

                      Looks like you are not building for ARM. Either wrong toolchain or wrong ./configure flags.

                      (Z(:^

                      1 Reply Last reply
                      0
                      • Pavel_47P Offline
                        Pavel_47P Offline
                        Pavel_47
                        wrote on last edited by
                        #24

                        Here is configure I've just used:

                        ./configure -release -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS-COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v
                        
                        sierdzioS 1 Reply Last reply
                        0
                        • Pavel_47P Pavel_47

                          Here is configure I've just used:

                          ./configure -release -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS-COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v
                          
                          sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #25

                          @Pavel_47 said in Cross-compiling RPi application using Qt Creator:

                          CROSS-COMPILE

                          Should be CROSS_COMPILE.

                          Also, on some systems (very rarely) ~/ does not work correctly, in such case use $HOME/ or full path instead.

                          (Z(:^

                          1 Reply Last reply
                          0
                          • Pavel_47P Offline
                            Pavel_47P Offline
                            Pavel_47
                            wrote on last edited by
                            #26

                            Indeed, there was typo.
                            I corrected and rerun configure. New error:

                            pyo@AREStest:~/raspi/qt-everywhere-src-5.12.3/qtbase$ ./configure -release -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v
                            Creating qmake...
                            make: Nothing to be done for `first'.
                            Command line: -release -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS_COMPILE=/home/pyo/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot /home/pyo/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /home/pyo/raspi/qt5pi -hostprefix /home/pyo/raspi/qt5 -no-use-gold-linker -v
                            
                            This is the Qt Open Source Edition.
                            
                            You have already accepted the terms of the Open Source license.
                            
                            Running configuration tests...
                            
                            + /home/pyo/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -dumpmachine
                            > arm-linux-gnueabihf
                            Checking for valid makespec... 
                            + cd /home/pyo/raspi/qt-everywhere-src-5.12.3/qtbase/config.tests/verifyspec && /home/pyo/raspi/qt-everywhere-src-5.12.3/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/pyo/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/pyo/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/pyo/raspi/sysroot" -early "CONFIG += cross_compile" /home/pyo/raspi/qt-everywhere-src-5.12.3/qtbase/config.tests/verifyspec
                            + cd /home/pyo/raspi/qt-everywhere-src-5.12.3/qtbase/config.tests/verifyspec && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
                            > rm -f verifyspec.o
                            > rm -f *~ core *.core
                            > /home/pyo/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/pyo/raspi/sysroot -O2 -std=gnu++11 -w -fPIC  -I. -I/home/pyo/raspi/qt-everywhere-src-5.12.3/qtbase/mkspecs/devices/linux-rasp-pi3-vc4-g++ -o verifyspec.o verifyspec.cpp
                            > /home/pyo/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/pyo/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/pyo/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/pyo/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o      
                            > /home/pyo/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:/home/pyo/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/lib/libstdc++.so: file format not recognized; treating as linker script
                            > /home/pyo/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:/home/pyo/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/lib/libstdc++.so:1: syntax error
                            > collect2: error: ld returned 1 exit status
                            > make: *** [verifyspec] Error 1
                            Note: Also available for Linux: linux-clang linux-icc
                            
                            ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
                            
                            1 Reply Last reply
                            0
                            • sierdzioS Offline
                              sierdzioS Offline
                              sierdzio
                              Moderators
                              wrote on last edited by
                              #27

                              Don't rerun configure. Clear your build directory completely and then run configure again. Easiest way to do it is to build outside of source dir.

                              Also, contrary to what the guide says, it's recommended to build using main configure script, not one located in qtbase. But ignore that for now, let's first get qtbase built :-)

                              (Z(:^

                              1 Reply Last reply
                              0
                              • Pavel_47P Offline
                                Pavel_47P Offline
                                Pavel_47
                                wrote on last edited by
                                #28

                                In the manual cleaning is performed with following command
                                git clean -dfx
                                In my case I didn't use git because my Linux machine has no connection to internet.
                                So, I downloaded source in Windows, then moved it to Linux machine.
                                So, should I just remove bin folder ?

                                sierdzioS 1 Reply Last reply
                                0
                                • Pavel_47P Pavel_47

                                  In the manual cleaning is performed with following command
                                  git clean -dfx
                                  In my case I didn't use git because my Linux machine has no connection to internet.
                                  So, I downloaded source in Windows, then moved it to Linux machine.
                                  So, should I just remove bin folder ?

                                  sierdzioS Offline
                                  sierdzioS Offline
                                  sierdzio
                                  Moderators
                                  wrote on last edited by
                                  #29

                                  @Pavel_47 said in Cross-compiling RPi application using Qt Creator:

                                  In the manual cleaning is performed with following command
                                  git clean -dfx
                                  In my case I didn't use git because my Linux machine has no connection to internet.
                                  So, I downloaded source in Windows, then moved it to Linux machine.
                                  So, should I just remove bin folder ?

                                  Configure and make spew out files in many other places. Move it again, start fresh.

                                  I'm not 100% sure it will help, but it very well might.

                                  (Z(:^

                                  1 Reply Last reply
                                  0
                                  • Pavel_47P Offline
                                    Pavel_47P Offline
                                    Pavel_47
                                    wrote on last edited by
                                    #30

                                    @sierdzio said in Cross-compiling RPi application using Qt Creator:

                                    Configure and make spew out files in many other places.

                                    I removed source folder and copied the fresh one.
                                    Then I created new folder fro where I executed configure.
                                    This new attempt also failed with similar error message:

                                    Command line: -release -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS_COMPILE=/home/pyo/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot /home/pyo/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix /home/pyo/raspi/qt5pi -hostprefix /home/pyo/raspi/qt5 -no-use-gold-linker -v
                                    Info: creating stash file /home/pyo/raspi/qt5/.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 machine tuple... 
                                    + /home/pyo/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
                                    Checking for valid makespec... 
                                    + cd /home/pyo/raspi/qt5/config.tests/verifyspec && /home/pyo/raspi/qt5/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/pyo/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/pyo/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/pyo/raspi/sysroot" -early "CONFIG += cross_compile" /home/pyo/raspi/qt-everywhere-src-5.12.3/qtbase/config.tests/verifyspec
                                    > Info: creating stash file /home/pyo/raspi/qt5/config.tests/.qmake.stash
                                    + cd /home/pyo/raspi/qt5/config.tests/verifyspec && MAKEFLAGS= /usr/bin/make
                                    > /home/pyo/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/pyo/raspi/sysroot -O2 -std=gnu++11 -w -fPIC  -I/home/pyo/raspi/qt-everywhere-src-5.12.3/qtbase/config.tests/verifyspec -I. -I/home/pyo/raspi/qt-everywhere-src-5.12.3/qtbase/mkspecs/devices/linux-rasp-pi3-vc4-g++ -o verifyspec.o /home/pyo/raspi/qt-everywhere-src-5.12.3/qtbase/config.tests/verifyspec/verifyspec.cpp
                                    > /home/pyo/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/pyo/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/pyo/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/pyo/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o      
                                    > /home/pyo/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:/home/pyo/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/lib/libstdc++.so: file format not recognized; treating as linker script
                                    > /home/pyo/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:/home/pyo/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/lib/libstdc++.so:1: syntax error
                                    > collect2: error: ld returned 1 exit status
                                    > make: *** [verifyspec] Error 1
                                    Note: Also available for Linux: linux-clang linux-icc
                                    
                                    ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
                                    
                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved