Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Cross-compiling QT5.7 for linux ARM setting linker path

Cross-compiling QT5.7 for linux ARM setting linker path

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 3 Posters 6.2k Views 2 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.
  • S Offline
    S Offline
    SimonB
    wrote on last edited by
    #1

    Hello QT community,

    This is my first post here, I hope I will get the answers I need !! I have been struggling for a week , trying to compile QT for an ARM device ( based on AM335 ) just like the beaglebone.
    I ran across all the qmake.conf files and its includes friends. I am still not ble to find a way to include the proper directory into my build.
    The compilation works fine with my toolchain, when it gets to the linker part it can't find : ld-linux.so.3:

    "/media/projects/myfolder/toolchain/arm-cortex_a8-linux-gnueabi/bin/../lib/gcc/arm-cortex_a8-linux-gnueabi/4.9.1/../../../../arm-cortex_a8-linux-gnueabi/bin/ld: cannot find /lib/ld-linux.so.3: No such file or directory
    collect2: error: ld returned 1 exit status
    make: *** [../bin/qmake] Error 1
    Error configuring Qt!"
    

    Here is the command used by the linker

    
    arm-cortex_a8-linux-gnueabi-g++ -o "../bin/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 cesdkhandler.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 qvector.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 qlibraryinfo.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 -Wl,-rpath-link,/media/projects/myfolder/toolchain/arm-cortex_a8-linux-gnueabi/arm-cortex_a8-linux-gnueabi/sysroot/usr/lib/ -Wl,-rpath-link,/media/projects/myfolder/toolchain/arm-cortex_a8-linux-gnueabi/arm-cortex_a8-linux-gnueabi/sysroot/lib/ -Wl,-rpath-link,/media/projects/myfolder/toolchain/arm-cortex_a8-linux-gnueabi/arm-cortex_a8-linux-gnueabi/sysroot/ -Wl,-rpath-link,$[QT_SYSROOT]/usr/lib/ -Wl,-rpath-link,$[QT_SYSROOT]/lib/ -mfloat-abi=hard -mfloat-abi=softfp -Wl,--gc-sections
    
    

    My qmake.conf :

    #
    # qmake configuration for the our project
    #
    
    include(../common/linux_device_pre.conf)
    
    QT_SYSROOT            =/media/projects/myproject/toolchain/arm-cortex_a8-linux-gnueabi/arm-cortex_a8-linux-gnueabi/sysroot
    
    #Compile and link flags
    QMAKE_CFLAGS           = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
    QMAKE_CXXFLAGS         = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
    #QMAKE_LFLAGS           += -v -Wl,-rpath-link,/media/projectsmyproject/toolchain/arm-cortex_a8-linux-gnueabi/arm-cortex_a8-linux-gnueabi/sysroot/lib -Wl,-rpath-link,/media/projects/myproject/toolchain/arm-cortex_a8-linux-gnueabi/arm-cortex_a8-linux-gnueabi/sysroot/usr/lib
    
    QMAKE_LFLAGS           += -Wl,-rpath-link,$${QT_SYSROOT}/usr/lib/$${GCC_MACHINE_DUMP} \
                          -Wl,-rpath-link,$${QT_SYSROOT}/lib/$${GCC_MACHINE_DUMP} \
                          -Wl,-rpath-link,$${QT_SYSROOT}/$${GCC_MACHINE_DUMP}
                          
    #Modification to linux_device_pre that came from g++-unix.conf
    
    QMAKE_CC               = arm-cortex_a8-linux-gnueabi-gcc
    QMAKE_CXX              = arm-cortex_a8-linux-gnueabi-g++
    QMAKE_LINK             = arm-cortex_a8-linux-gnueabi-g++
    QMAKE_LINK_SHLIB       = arm-cortex_a8-linux-gnueabi-g++
    QMAKE_AR               = arm-cortex_a8-linux-gnueabi-ar cqs
    QMAKE_OBJCOPY          = arm-cortex_a8-linux-gnueabi-objcopy
    QMAKE_STRIP            = arm-cortex_a8-linux-gnueabi-strip
    QMAKE_NM               = arm-cortex_a8-linux-gnueabi-nm -P
    
    QMAKE_INCDIR           = /opt/tslib/include/
    QMAKE_LIBDIR           = /opt/tslib/lib/
    
    QMAKE_RPATHDIR        += /opt/tslib/lib
    
    # Extra stuff (OpenGL, DirectFB, ...)
    QMAKE_INCDIR_EGL        =
    QMAKE_LIBDIR_EGL        =
    QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
    QMAKE_LIBDIR_OPENGL_ES2 = $${QMAKE_LIBDIR_EGL}
    QMAKE_INCDIR_OPENVG     = $${QMAKE_INCDIR_EGL}
    QMAKE_LIBDIR_OPENVG     = $${QMAKE_LIBDIR_EGL}
    
    QMAKE_LIBS_EGL          = -lEGL -lIMGegl -lsrv_um
    QMAKE_LIBS_OPENGL_ES2   = -lGLESv2 $${QMAKE_LIBS_EGL}
    QMAKE_LIBS_OPENVG       = -lOpenVG $${QMAKE_LIBS_EGL}
    
    # No need for any special EGL device integration.
    # Prioritize the default, compiled-in integration over any plugins.
    EGLFS_DEVICE_INTEGRATION = none
    
    include(../common/linux_arm_device_post.conf)
    
    load(qt_config)
    

    Even after telling it to look in my toolchain folder, ld seems to look into the /lib/ folder anyway.

    Any chance someone ran into this problem before ??? ( p.s. ) my folder /lib/ in the toolchain contain the actual file that I need.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What options are you passing to your configure call ?

      Note that if your device is like a BBB, you should use the BBB mkspec as a base for yours and pass the proper information to configure.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SimonB
        wrote on last edited by SimonB
        #3
        BASE_DIR=$(pwd)
        TOOLCHAIN_DIR=$BASE_DIR/../toolchain/arm-cortex_a8-linux-gnueabi
        HOST_TYPE=arm-cortex_a8-linux-gnueabi
        SYSROOT_DIR=$BASE_DIR/../toolchain/arm-cortex_a8-linux-gnueabi/arm-cortex_a8-linux-gnueabi/sysroot
        TARGET_DIR=$BASE_DIR/../buildroot/board/tornatech/filesystem/opt
        PREFIX='qt-embedded'
        EXTPREFIX=$TARGET_DIR/$PREFIX
        
        
        CONFIGURE_CMD="./configure -v -xplatform linux-arm-gnueabi-g++ -device linux-brio-tor019-++ -sysroot $SYSROOT_DIR -extprefix $EXTPREFIX -device-option COSS_COMPILE=$TOOLCHAIN_DIR/bin/$HOST_TYPE- -make libs -confirm-license -release -opensource -force-pkg-config -no-icu -no-dbus -no-xcb -no-gif -no-xkbcommon-evdev -no-evdev -tslib -no-mtdev -qt-libjpeg -qt-zlib -no-harfbuzz -no-libproxy -no-xinput2 -no-xcb-xlib -no-pulseaudio -no-alsa -no-largefile -no-iconv -no-pch -no-sse2 -no-glib -no-cups -rpath "
        

        The "device" stated here exist, that's the name of our folder containing the qmake file. My example for the qconf ( in mkspec ) was the beagleboard, the file is almost identical to the beagleboard one, except for the soft floating point

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SimonB
          wrote on last edited by
          #4

          Actually, I have to revise my question.
          qmake is able to be built, but at the runtime when I try to launch the QT compilation, it ask for

          /lib/ld-linux.so.3: No such file or directory
          
          jsulmJ 1 Reply Last reply
          0
          • S SimonB

            Actually, I have to revise my question.
            qmake is able to be built, but at the runtime when I try to launch the QT compilation, it ask for

            /lib/ld-linux.so.3: No such file or directory
            
            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @SimonB What does

            ldd qmake
            

            say?

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

            S 1 Reply Last reply
            0
            • S Offline
              S Offline
              SimonB
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • jsulmJ jsulm

                @SimonB What does

                ldd qmake
                

                say?

                S Offline
                S Offline
                SimonB
                wrote on last edited by
                #7

                @jsulm
                It says :

                        not a dynamic executable
                

                I guess I am missing a flag or something at compile time, I tried a lot of combinaison for including my "fakeroot" folder. I tought that it was the point of having --sysroot in the configure script

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  What do you get if your call file qmake ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  S 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    What do you get if your call file qmake ?

                    S Offline
                    S Offline
                    SimonB
                    wrote on last edited by SimonB
                    #9

                    @SGaist - Thanks for your quick reply

                    qmake: ERROR: cannot open `qmake' (No such file or directory)
                    

                    I am still looking for a "missing flag" in the conf file ... is there anywhere else I should look ?

                    I just had a tought,
                    I want to cross-compile QT to have the libraries on my embedded platform. Am I doing this wrong by building qmake with the cross-compiler app ?
                    since qmake is used to build the makefile for QT, I have to run it on my host system right ? So, that being said, do I need to have qmake cross-compiled ? sor sure it won't work on my system

                    my reference was :
                    Building Qt for Embedded Linux
                    but it says that this is obsolete and it's only good for QT4, I bet this is good for QT5 as well ??

                    ( This is my first time compiling QT )

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Ok... When someone suggest to call ldd on a file, you are supposed to give the full path that file or change your current folder to where that file is otherwise the command won't work. The same for file.

                      As for your qmake.conf i'd remove the QT_SYSROOT assignment, it should be done for you through the configure script and the parameters you give it.

                      qmake is a host tool that is not cross-compiled.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      S 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Ok... When someone suggest to call ldd on a file, you are supposed to give the full path that file or change your current folder to where that file is otherwise the command won't work. The same for file.

                        As for your qmake.conf i'd remove the QT_SYSROOT assignment, it should be done for you through the configure script and the parameters you give it.

                        qmake is a host tool that is not cross-compiled.

                        S Offline
                        S Offline
                        SimonB
                        wrote on last edited by SimonB
                        #11

                        The file and ldd worked, but the binary was a arm compiled binary, that's why it wasn't working. May I suggest updating the http://wiki.qt.io/Building_Qt_for_Embedded_Linux#The_Host_Build to specify that it's still the actual way to to it, even in qt5

                        @SGaist said in Cross-compiling QT5.7 for linux ARM setting linker path:

                        qmake is a host tool that is not cross-compiled.

                        I figured that out today !! I am still wondering why it is trying to compile qmake with the cross compiler when I make the second configure ( the one with the option -device CROSSC_COMPILE= ....

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Are you doing your second call to configure in a clean state ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            The article you mention is really specific to Qt 4. So no, it should not be modified. There's even a link at the top for Qt 5.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            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