Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. cross-compiling on Ubuntu to rpi B+ raspbian stretch
Forum Updated to NodeBB v4.3 + New Features

cross-compiling on Ubuntu to rpi B+ raspbian stretch

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 4 Posters 2.6k 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.
  • F Offline
    F Offline
    flemingp
    wrote on last edited by aha_1980
    #1

    With the help of a number of guides e.g.

    https://wiki.qt.io/RaspberryPi2EGLFS

    I made significant progress after building a new cross compiler as noted here:

    https://forum.qt.io/topic/93547/cross-compiling-full-qt-5-11-x-for-raspberry-pi-error-with-qgeomap-class-in-qt-location-module

    I managed to successfully build a system to a point where I can compile an existing Qt project I have on the Pi with one exception, namely getting the Bluetooth module to work. I had a similar problem with the mysql driver but managed to resolve that using.

    -sql-mysql MYSQL_INCDIR=~/raspi/sysroot/usr/include/mysql MYSQL_LIBDIR=~/raspi/sysroot/usr/lib/arm-linux-gnueabihf with ./configure
    
    

    Every time I run configure the summary reports:

    Qt Bluetooth:
      BlueZ .................................. no
      BlueZ Low Energy ....................... no
      Linux Crypto API ....................... no
      WinRT Bluetooth API (desktop & UWP) .... no
    
    

    I have tried adding -I~/raspi/sysroot/usr/include/bluetooth to the configure command however this does not help, and the config.log shows an inability to find the header file. Please note this is note the actual config.log with the addition of the include path.

    looking for library bluez
    Trying source 0 (type pkgConfig) of library bluez ...
    pkg-config use disabled globally.
      => source produced no result.
    Trying source 1 (type inline) of library bluez ...
    + cd /home/paul/raspi/qt5build/config.tests/bluez && /home/paul/raspi/qt5build/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/paul/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/paul/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/paul/raspi/sysroot" -early "CONFIG += cross_compile" 'LIBS += -lbluetooth' /home/paul/raspi/qt-everywhere-src-5.11.2/qtconnectivity/config.tests/bluez
    + cd /home/paul/raspi/qt5build/config.tests/bluez && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
    > rm -f main.o
    > rm -f *~ core *.core
    > arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/paul/raspi/sysroot --sysroot=/home/paul/raspi/sysroot -fpermissive -O2 -w -fPIC  -I/home/paul/raspi/qt-everywhere-src-5.11.2/qtconnectivity/config.tests/bluez -I. -I/home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -o main.o /home/paul/raspi/qt-everywhere-src-5.11.2/qtconnectivity/config.tests/bluez/main.cpp
    > /home/paul/raspi/qt-everywhere-src-5.11.2/qtconnectivity/config.tests/bluez/main.cpp:29:10: fatal error: bluetooth/bluetooth.h: No such file or directory
    >  #include <bluetooth/bluetooth.h>
    

    I should add I had a working system on Ubuntu 14.04 and raspbian Jessie, but wanted to update it to a documented and more modern installation hence the fresh installs.

    I have also experimented with qmake on the qt-connectivity module after building and compiling with little success. I feel sure it should be possible to configure and build the system in one go.

    I feels like there is something really simple, I know the headers and libs are in sysroot directory structure on the host.

    I don't fully understand what this section of the guides does:

    wget https://raw.githubusercontent.com/riscv/riscv-poky/priv-1.10/scripts/sysroot-relativelinks.py
    chmod +x sysroot-relativelinks.py
    ./sysroot-relativelinks.py sysroot
    

    I understand it is getting a script that creates some kind of links to make the sysroot structure usable, and I wonder if I am missing something there ?

    It would be great to have an example of what links are created and why.

    I have also tried this:

    env CPPFLAGS='~/raspi/sysroot/usr/include/bluetooth' LDFLAGS='-L~/raspi/sysroot/usr/lib/arm-linux-gnueabihf' 
    
    Again no progress.
    
    I am seriously stuck - and would appreciate some advice that will give me greater understanding, which will hopefully lead to a solution.
    
    jsulmJ 1 Reply Last reply
    0
    • F flemingp

      With the help of a number of guides e.g.

      https://wiki.qt.io/RaspberryPi2EGLFS

      I made significant progress after building a new cross compiler as noted here:

      https://forum.qt.io/topic/93547/cross-compiling-full-qt-5-11-x-for-raspberry-pi-error-with-qgeomap-class-in-qt-location-module

      I managed to successfully build a system to a point where I can compile an existing Qt project I have on the Pi with one exception, namely getting the Bluetooth module to work. I had a similar problem with the mysql driver but managed to resolve that using.

      -sql-mysql MYSQL_INCDIR=~/raspi/sysroot/usr/include/mysql MYSQL_LIBDIR=~/raspi/sysroot/usr/lib/arm-linux-gnueabihf with ./configure
      
      

      Every time I run configure the summary reports:

      Qt Bluetooth:
        BlueZ .................................. no
        BlueZ Low Energy ....................... no
        Linux Crypto API ....................... no
        WinRT Bluetooth API (desktop & UWP) .... no
      
      

      I have tried adding -I~/raspi/sysroot/usr/include/bluetooth to the configure command however this does not help, and the config.log shows an inability to find the header file. Please note this is note the actual config.log with the addition of the include path.

      looking for library bluez
      Trying source 0 (type pkgConfig) of library bluez ...
      pkg-config use disabled globally.
        => source produced no result.
      Trying source 1 (type inline) of library bluez ...
      + cd /home/paul/raspi/qt5build/config.tests/bluez && /home/paul/raspi/qt5build/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/paul/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/paul/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/paul/raspi/sysroot" -early "CONFIG += cross_compile" 'LIBS += -lbluetooth' /home/paul/raspi/qt-everywhere-src-5.11.2/qtconnectivity/config.tests/bluez
      + cd /home/paul/raspi/qt5build/config.tests/bluez && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
      > rm -f main.o
      > rm -f *~ core *.core
      > arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/paul/raspi/sysroot --sysroot=/home/paul/raspi/sysroot -fpermissive -O2 -w -fPIC  -I/home/paul/raspi/qt-everywhere-src-5.11.2/qtconnectivity/config.tests/bluez -I. -I/home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -o main.o /home/paul/raspi/qt-everywhere-src-5.11.2/qtconnectivity/config.tests/bluez/main.cpp
      > /home/paul/raspi/qt-everywhere-src-5.11.2/qtconnectivity/config.tests/bluez/main.cpp:29:10: fatal error: bluetooth/bluetooth.h: No such file or directory
      >  #include <bluetooth/bluetooth.h>
      

      I should add I had a working system on Ubuntu 14.04 and raspbian Jessie, but wanted to update it to a documented and more modern installation hence the fresh installs.

      I have also experimented with qmake on the qt-connectivity module after building and compiling with little success. I feel sure it should be possible to configure and build the system in one go.

      I feels like there is something really simple, I know the headers and libs are in sysroot directory structure on the host.

      I don't fully understand what this section of the guides does:

      wget https://raw.githubusercontent.com/riscv/riscv-poky/priv-1.10/scripts/sysroot-relativelinks.py
      chmod +x sysroot-relativelinks.py
      ./sysroot-relativelinks.py sysroot
      

      I understand it is getting a script that creates some kind of links to make the sysroot structure usable, and I wonder if I am missing something there ?

      It would be great to have an example of what links are created and why.

      I have also tried this:

      env CPPFLAGS='~/raspi/sysroot/usr/include/bluetooth' LDFLAGS='-L~/raspi/sysroot/usr/lib/arm-linux-gnueabihf' 
      
      Again no progress.
      
      I am seriously stuck - and would appreciate some advice that will give me greater understanding, which will hopefully lead to a solution.
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @flemingp Add -v to configure command and check the output - you should see what exactly is missing.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • F Offline
        F Offline
        flemingp
        wrote on last edited by
        #3

        Thank you for your reply, I am already using -v, and had posted the output above. I believe the problem relates specifically to:

        bluetooth/bluetooth.h: No such file or directory
        >  #include <bluetooth/bluetooth.h>
        

        I don't understand why it is not found when the file does exist in the sysroot, and as part of trying to resolve the error I have tried both an additional Include of -I~/raspi/sysroot/usr/include/ and also -I~/raspi/sysroot/usr/include/bluetooth.

        jsulmJ 1 Reply Last reply
        0
        • F flemingp

          Thank you for your reply, I am already using -v, and had posted the output above. I believe the problem relates specifically to:

          bluetooth/bluetooth.h: No such file or directory
          >  #include <bluetooth/bluetooth.h>
          

          I don't understand why it is not found when the file does exist in the sysroot, and as part of trying to resolve the error I have tried both an additional Include of -I~/raspi/sysroot/usr/include/ and also -I~/raspi/sysroot/usr/include/bluetooth.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @flemingp So, ~/raspi/sysroot/usr/include/bluetooth/bluetooth.h exists?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • F Offline
            F Offline
            flemingp
            wrote on last edited by
            #5

            Indeed it does along with the header file

            paul@paul-X200CA:~/raspi/sysroot/usr/include/bluetooth$ ls
            bluetooth.h  bnep.h  cmtp.h  hci.h  hci_lib.h  hidp.h  l2cap.h  rfcomm.h  sco.h  sdp.h  sdp_lib.h
            paul@paul-X200CA:~/raspi/sysroot/usr/include/bluetooth$ 
            
            

            And sysroot is passed in configure command, noting that the sql module builds and compiles with not problems:

            
            ../qt-everywhere-src-5.11.2/configure -opengl es2 -device rasp-pi3-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -I~/raspi/sysroot/usr/include/ -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -no-use-gold-linker -nomake examples -no-compile-examples -nomake tests  -skip qtwayland -skip qtwebengine -sql-mysql MYSQL_INCDIR=~/raspi/sysroot/usr/include/mysql MYSQL_LIBDIR=~/raspi/sysroot/usr/lib/arm-linux-gnueabihf --recheck-all
            ``
            sierdzioS 1 Reply Last reply
            0
            • F flemingp

              Indeed it does along with the header file

              paul@paul-X200CA:~/raspi/sysroot/usr/include/bluetooth$ ls
              bluetooth.h  bnep.h  cmtp.h  hci.h  hci_lib.h  hidp.h  l2cap.h  rfcomm.h  sco.h  sdp.h  sdp_lib.h
              paul@paul-X200CA:~/raspi/sysroot/usr/include/bluetooth$ 
              
              

              And sysroot is passed in configure command, noting that the sql module builds and compiles with not problems:

              
              ../qt-everywhere-src-5.11.2/configure -opengl es2 -device rasp-pi3-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -I~/raspi/sysroot/usr/include/ -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -no-use-gold-linker -nomake examples -no-compile-examples -nomake tests  -skip qtwayland -skip qtwebengine -sql-mysql MYSQL_INCDIR=~/raspi/sysroot/usr/include/mysql MYSQL_LIBDIR=~/raspi/sysroot/usr/lib/arm-linux-gnueabihf --recheck-all
              ``
              sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              @flemingp said in cross-compiling on Ubuntu to rpi B+ raspbian stretch:

              ~/

              Use full path, not ~ sign. It sometimes gets in the way.

              (Z(:^

              F 1 Reply Last reply
              0
              • F Offline
                F Offline
                flemingp
                wrote on last edited by
                #7

                Used full path for sysroot with configure, same problem:

                ../qt-everywhere-src-5.11.2/configure -opengl es2 -device rasp-pi3-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /home/paul/raspi/sysroot -opensource -confirm-license  -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -no-use-gold-linker -nomake examples -no-compile-examples -nomake tests  -skip qtwayland -skip qtwebengine -sql-mysql MYSQL_INCDIR=~/raspi/sysroot/usr/include/mysql MYSQL_LIBDIR=~/raspi/sysroot/usr/lib/arm-linux-gnueabihf --recheck-all
                
                1 Reply Last reply
                0
                • sierdzioS sierdzio

                  @flemingp said in cross-compiling on Ubuntu to rpi B+ raspbian stretch:

                  ~/

                  Use full path, not ~ sign. It sometimes gets in the way.

                  F Offline
                  F Offline
                  flemingp
                  wrote on last edited by
                  #8

                  @sierdzio

                  By adding -I/home/paul/raspi/sysroot/usr/include/ -L/home/paul/raspi/sysroot/usr/lib/arm-linux-gnueabihf I have overcome the build error and am currently compiling. I have not marked this as solved, because I believe sysroot should pass the path without having to add it manually. But I am a novice so happy to stand corrected.

                  sierdzioS 1 Reply Last reply
                  0
                  • F flemingp

                    @sierdzio

                    By adding -I/home/paul/raspi/sysroot/usr/include/ -L/home/paul/raspi/sysroot/usr/lib/arm-linux-gnueabihf I have overcome the build error and am currently compiling. I have not marked this as solved, because I believe sysroot should pass the path without having to add it manually. But I am a novice so happy to stand corrected.

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

                    @flemingp said in cross-compiling on Ubuntu to rpi B+ raspbian stretch:

                    I believe sysroot should pass the path without having to add it manually.

                    You're right, usually it is not necessary.

                    (Z(:^

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      flemingp
                      wrote on last edited by
                      #10

                      I spoke too soon, with the full paths I now get the following error when I run make:

                      /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp: In static member function ‘static bool QFileSystemEngine::renameFile(const QFileSystemEntry&, const QFileSystemEntry&, QSystemError&)’:
                      /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:1286:19: error: ‘AT_FDCWD’ was not declared in this scope
                           if (renameat2(AT_FDCWD, srcPath, AT_FDCWD, tgtPath, RENAME_NOREPLACE) == 0)
                                         ^~~~~~~~
                      /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:1286:19: note: suggested alternative: ‘QT_GETCWD’
                           if (renameat2(AT_FDCWD, srcPath, AT_FDCWD, tgtPath, RENAME_NOREPLACE) == 0)
                                         ^~~~~~~~
                                         QT_GETCWD
                      /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp: At global scope:
                      /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:115:12: warning: ‘int statx(int, const char*, int, unsigned int, statx*)’ defined but not used [-Wunused-function]
                       static int statx(int dirfd, const char *pathname, int flag, unsigned mask, struct statx *statxbuf)
                                  ^~~~~
                      /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:109:12: warning: ‘int renameat2(int, const char*, int, const char*, unsigned int)’ defined but not used [-Wunused-function]
                       static int renameat2(int oldfd, const char *oldpath, int newfd, const char *newpath, unsigned flags)
                                  ^~~~~~~~~
                      Makefile:30263: recipe for target '.obj/qfilesystemengine_unix.o' failed
                      make[3]: *** [.obj/qfilesystemengine_unix.o] Error 1
                      make[3]: Leaving directory '/home/paul/raspi/qt5build/qtbase/src/corelib'
                      Makefile:224: recipe for target 'sub-corelib-make_first' failed
                      make[2]: *** [sub-corelib-make_first] Error 2
                      make[2]: Leaving directory '/home/paul/raspi/qt5build/qtbase/src'
                      Makefile:48: recipe for target 'sub-src-make_first' failed
                      make[1]: *** [sub-src-make_first] Error 2
                      make[1]: Leaving directory '/home/paul/raspi/qt5build/qtbase'
                      Makefile:81: recipe for target 'module-qtbase-make_first' failed
                      make: *** [module-qtbase-make_first] Error 2
                      
                      Please can anyone help here ?
                      
                      F 1 Reply Last reply
                      0
                      • F flemingp

                        I spoke too soon, with the full paths I now get the following error when I run make:

                        /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp: In static member function ‘static bool QFileSystemEngine::renameFile(const QFileSystemEntry&, const QFileSystemEntry&, QSystemError&)’:
                        /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:1286:19: error: ‘AT_FDCWD’ was not declared in this scope
                             if (renameat2(AT_FDCWD, srcPath, AT_FDCWD, tgtPath, RENAME_NOREPLACE) == 0)
                                           ^~~~~~~~
                        /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:1286:19: note: suggested alternative: ‘QT_GETCWD’
                             if (renameat2(AT_FDCWD, srcPath, AT_FDCWD, tgtPath, RENAME_NOREPLACE) == 0)
                                           ^~~~~~~~
                                           QT_GETCWD
                        /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp: At global scope:
                        /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:115:12: warning: ‘int statx(int, const char*, int, unsigned int, statx*)’ defined but not used [-Wunused-function]
                         static int statx(int dirfd, const char *pathname, int flag, unsigned mask, struct statx *statxbuf)
                                    ^~~~~
                        /home/paul/raspi/qt-everywhere-src-5.11.2/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:109:12: warning: ‘int renameat2(int, const char*, int, const char*, unsigned int)’ defined but not used [-Wunused-function]
                         static int renameat2(int oldfd, const char *oldpath, int newfd, const char *newpath, unsigned flags)
                                    ^~~~~~~~~
                        Makefile:30263: recipe for target '.obj/qfilesystemengine_unix.o' failed
                        make[3]: *** [.obj/qfilesystemengine_unix.o] Error 1
                        make[3]: Leaving directory '/home/paul/raspi/qt5build/qtbase/src/corelib'
                        Makefile:224: recipe for target 'sub-corelib-make_first' failed
                        make[2]: *** [sub-corelib-make_first] Error 2
                        make[2]: Leaving directory '/home/paul/raspi/qt5build/qtbase/src'
                        Makefile:48: recipe for target 'sub-src-make_first' failed
                        make[1]: *** [sub-src-make_first] Error 2
                        make[1]: Leaving directory '/home/paul/raspi/qt5build/qtbase'
                        Makefile:81: recipe for target 'module-qtbase-make_first' failed
                        make: *** [module-qtbase-make_first] Error 2
                        
                        Please can anyone help here ?
                        
                        F Offline
                        F Offline
                        flemingp
                        wrote on last edited by
                        #11

                        I resolved my issue by adapting the configure statement at [link text]https://forum.qt.io/topic/91294/qt-on-raspberry-pi3/9(link url)

                        My final configure statement read:

                        ../qt-everywhere-src-5.11.2/configure -opengl es2 -device rasp-pi3-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /home/paul/raspi/sysroot -opensource -confirm-license \
                        -I/home/paul/raspi/sysroot/usr/include/  \
                        -L/home/paul/raspi/sysroot/usr/lib/arm-linux-gnueabihf -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -no-use-gold-linker -nomake examples -no-compile-examples -nomake tests \
                        -sql-mysql MYSQL_INCDIR=/home/paul/raspi/sysroot/usr/include/mysql \
                        MYSQL_LIBDIR=/home/paul/raspi/sysroot/usr/lib/arm-linux-gnueabihf \
                        -skip qtserialbus -skip qtscxml -skip qtscript -skip qtcharts -skip qt3d \
                        -skip qtdatavis3d -skip qtcanvas3d -skip qtgamepad -skip qtvirtualkeyboard \
                        -skip qtwayland -skip qtwebengine -skip qtwebchannel -skip qtwebglplugin \
                        -skip qtwebsockets --recheck-all
                        

                        I then needed to build my bluetooth module separately using a FRESH copy of qt-everywhere-src-5.11.2:

                        Before being able to build and compile the bluetooth module I found I needed to add some paths so qmake can find the headers and libraries.

                        ~/raspi/qt5/bin/qmake -query 
                        

                        gives a list of values for the properties of qmake in the new directory ~/raspi/qt5

                        including QMAKE_XSPEC:devices/linux-rasp-pi3-g++

                        With that information the relevant qmake.conf file can be found : ~/raspi/qt5/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf

                        This can then be edited so that qmake can find the relevant header and library files in sysroot (assuming they are there of course)

                        INCLUDEPATH+=/home/paul/raspi/sysroot/usr/include
                        
                        LIBS +=-L/home/paul/raspi/sysroot/usr/lib/arm-linux-gnueabihf
                        

                        After the file is edited, simply run ~/raspi/qt5/bin/qmake in the required module directory in my case 'qtconnectivity'

                        Then issue the commands

                        make -j

                        make install

                        Finally sync the newly created qt5pi directory with the one on the pi.

                        rsync -avz qt5pi pi@192.168.1.18:/usr/local
                        

                        QT creator then configured and I was able to compile my app for the pi knowing far more about the cross compile process.

                        I

                        B 1 Reply Last reply
                        2
                        • sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #12

                          Great, thanks for sharing the solution!

                          Please consider updating the wiki with your new info. https://wiki.qt.io/RaspberryPi2EGLFS

                          (Z(:^

                          1 Reply Last reply
                          0
                          • F flemingp

                            I resolved my issue by adapting the configure statement at [link text]https://forum.qt.io/topic/91294/qt-on-raspberry-pi3/9(link url)

                            My final configure statement read:

                            ../qt-everywhere-src-5.11.2/configure -opengl es2 -device rasp-pi3-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /home/paul/raspi/sysroot -opensource -confirm-license \
                            -I/home/paul/raspi/sysroot/usr/include/  \
                            -L/home/paul/raspi/sysroot/usr/lib/arm-linux-gnueabihf -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v -no-use-gold-linker -nomake examples -no-compile-examples -nomake tests \
                            -sql-mysql MYSQL_INCDIR=/home/paul/raspi/sysroot/usr/include/mysql \
                            MYSQL_LIBDIR=/home/paul/raspi/sysroot/usr/lib/arm-linux-gnueabihf \
                            -skip qtserialbus -skip qtscxml -skip qtscript -skip qtcharts -skip qt3d \
                            -skip qtdatavis3d -skip qtcanvas3d -skip qtgamepad -skip qtvirtualkeyboard \
                            -skip qtwayland -skip qtwebengine -skip qtwebchannel -skip qtwebglplugin \
                            -skip qtwebsockets --recheck-all
                            

                            I then needed to build my bluetooth module separately using a FRESH copy of qt-everywhere-src-5.11.2:

                            Before being able to build and compile the bluetooth module I found I needed to add some paths so qmake can find the headers and libraries.

                            ~/raspi/qt5/bin/qmake -query 
                            

                            gives a list of values for the properties of qmake in the new directory ~/raspi/qt5

                            including QMAKE_XSPEC:devices/linux-rasp-pi3-g++

                            With that information the relevant qmake.conf file can be found : ~/raspi/qt5/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf

                            This can then be edited so that qmake can find the relevant header and library files in sysroot (assuming they are there of course)

                            INCLUDEPATH+=/home/paul/raspi/sysroot/usr/include
                            
                            LIBS +=-L/home/paul/raspi/sysroot/usr/lib/arm-linux-gnueabihf
                            

                            After the file is edited, simply run ~/raspi/qt5/bin/qmake in the required module directory in my case 'qtconnectivity'

                            Then issue the commands

                            make -j

                            make install

                            Finally sync the newly created qt5pi directory with the one on the pi.

                            rsync -avz qt5pi pi@192.168.1.18:/usr/local
                            

                            QT creator then configured and I was able to compile my app for the pi knowing far more about the cross compile process.

                            I

                            B Offline
                            B Offline
                            blazej222
                            wrote on last edited by
                            #13

                            @flemingp Sorry for bumping, but I have exactly the same problem - I'm trying to cross-compile qt5 for raspberry pi and encounter error

                            io/qfilesystemengine_unix.cpp: In function ‘int qt_statx(const char*, statx*)’:
                            io/qfilesystemengine_unix.cpp:321:26: error: ‘AT_FDCWD’ was not declared in this scope
                              321 |     return qt_real_statx(AT_FDCWD, pathname, 0, statxBuffer);
                                  |                          ^~~~~~~~
                            io/qfilesystemengine_unix.cpp: In function ‘int qt_lstatx(const char*, statx*)’:
                            io/qfilesystemengine_unix.cpp:326:26: error: ‘AT_FDCWD’ was not declared in this scope
                              326 |     return qt_real_statx(AT_FDCWD, pathname, AT_SYMLINK_NOFOLLOW, statxBuffer);
                                  |                          ^~~~~~~~
                            io/qfilesystemengine_unix.cpp:326:46: error: ‘AT_SYMLINK_NOFOLLOW’ was not declared in this scope
                              326 |     return qt_real_statx(AT_FDCWD, pathname, AT_SYMLINK_NOFOLLOW, statxBuffer);
                                  |                                              ^~~~~~~~~~~~~~~~~~~
                            io/qfilesystemengine_unix.cpp: In function ‘int qt_fstatx(int, statx*)’:
                            io/qfilesystemengine_unix.cpp:331:34: error: ‘AT_EMPTY_PATH’ was not declared in this scope
                              331 |     return qt_real_statx(fd, "", AT_EMPTY_PATH, statxBuffer);
                                  |                                  ^~~~~~~~~~~~~
                            io/qfilesystemengine_unix.cpp: In static member function ‘static bool QFileSystemEngine::renameFile(const QFileSystemEntry&, const QFileSystemEntry&, QSystemError&)’:
                            io/qfilesystemengine_unix.cpp:1447:19: error: ‘AT_FDCWD’ was not declared in this scope
                             1447 |     if (renameat2(AT_FDCWD, srcPath, AT_FDCWD, tgtPath, RENAME_NOREPLACE) == 0)
                                  |                   ^~~~~~~~
                            

                            However, I don't understand your soultion. My configure script is:

                            ./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /mnt/linux_hdd/sysroot -opensource -confirm-license -I/mnt/linux_hdd/sysroot/usr/include/ -L/mnt/linux_hdd/sysroot/usr/lib/arm-linux-gnueabihf -skip qtserialbus -skip qtscxml -skip qtscript -skip qtcharts -skip qt3d -skip qtdatavis3d -skip qtcanvas3d -skip qtgamepad -skip qtvirtualkeyboard -skip qtwayland -skip qtwebengine -skip qtwebchannel -skip qtwebglplugin -skip qtwebsockets -make libs -prefix /usr/local/qt5pi -extprefix /mnt/linux_hdd/qt_rasp/qt5pi -hostprefix /mnt/linux_hdd/qt_rasp/qt5 -no-use-gold-linker -v -no-gbm
                            

                            You said that after running configure you ran

                            ~/raspi/qt5/bin/qmake -query
                            

                            Yeah... except there's nothing inside my hostprefix directory. /mnt/linux_hdd/qt_rasp is empty. I've found the qmake binary inside qt-everywhere-src-5.15.1/qtbase/bin.

                            I've also added

                            INCLUDEPATH+=/mnt/linux_hdd/sysroot/usr/include/
                            
                            LIBS +=-L/mnt/linux_hdd/sysroot/usr/lib/arm-linux-gnueabihf
                            

                            to qtbase/mkspecs/devices/linux-rasp-pi3-g++/qmake.conf.
                            No difference. Compilation still fails with the same error.
                            I'm really losing my mind because I can't find a solution.
                            Would be really thankful for any suggestions

                            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