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. Crosscompile app using external library

Crosscompile app using external library

Scheduled Pinned Locked Moved Solved Mobile and Embedded
embedded linuxexternal librarlinaro
5 Posts 2 Posters 3.4k Views
  • 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.
  • A Offline
    A Offline
    Antonio Ortiz
    wrote on last edited by
    #1

    Hi, I want to crosscompile a Qt app to linux armv8.
    The app uses libusb to communicate with a periferic device and I need qmake use the right library version depending on the cpu architecture.
    I was reading the qmake Variables and Advanced Usage section for anwser and only found how to crosscompile between linux, mac and windows.
    Right now I'm using Ubuntu 16 x86_64, QtCreator 3.5.1 and Qt5.8. I already crosscompile Qt5.8 and libusb with linaro and set QtCreator to use the arm kit.
    Thanks in advance.

    K 1 Reply Last reply
    0
    • A Antonio Ortiz

      Hi, I want to crosscompile a Qt app to linux armv8.
      The app uses libusb to communicate with a periferic device and I need qmake use the right library version depending on the cpu architecture.
      I was reading the qmake Variables and Advanced Usage section for anwser and only found how to crosscompile between linux, mac and windows.
      Right now I'm using Ubuntu 16 x86_64, QtCreator 3.5.1 and Qt5.8. I already crosscompile Qt5.8 and libusb with linaro and set QtCreator to use the arm kit.
      Thanks in advance.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @Antonio-Ortiz

      You are probably missing something like this in your pro-file:

      win32:{
      include (../CompileSettings/BoostLib.inc)
      }
      linux:{
      INCLUDEPATH += . \
          "/home/xxxx/Source/boost_1_52_0"
      }
      linux-*:{
      INCLUDEPATH += . \
          "/home/xxxx/Source/boost_1_52_0"
      }
      

      You find several specifications for setups in mspecs folder of your specofoc Qt setup
      Here an example from windows

      c:\Qt\5.6\mingw49_32\mkspecs\linux-arm-gnueabi-g++ 
      

      It shows to the linux-arm-gnueabi-g++, which is a general specs for a cross compiler. For cross compiling your Qt you have used this or a similar. You have to give this name already during your configuration of the cross-compile. The example given above is basically distinguishing between a plain win32, a plain linux and a specific linux-* setup. The specific setup is a cross-compile setup, but I was simply too lazy to type the complete name and used a wildcard for qmake.

      As you see I am adding here the include path for the booth libs to the compilation. For you it has to be a specific path for the libraries.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      2
      • A Offline
        A Offline
        Antonio Ortiz
        wrote on last edited by
        #3

        Sorry for the late reply.
        I was trying with these lines on the pro, but still QtCreator load the x86_64 version of the library

        unix
        {
            armv8l
            {
                LIBS += -L$$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/lib/ -lusb-1.0
                INCLUDEPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
                DEPENDPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
            }
            armeabi-v8l
            {
                LIBS += -L$$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/lib/ -lusb-1.0
                INCLUDEPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
                DEPENDPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
            }
            armveabi-v7a
            {
                LIBS += -L$$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/lib/ -lusb-1.0
                INCLUDEPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
                DEPENDPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
            }
            gnueabihf
            {
                LIBS += -L$$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/lib/ -lusb-1.0
                INCLUDEPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
                DEPENDPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
            }
            gnueabihf-v8l
            {
                LIBS += -L$$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/lib/ -lusb-1.0
                INCLUDEPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
                DEPENDPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
            }
            beagle
            {
                LIBS += -L$$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/lib/ -lusb-1.0
                INCLUDEPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
                DEPENDPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
            }
            armhf
            {
                LIBS += -L$$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/lib/ -lusb-1.0
                INCLUDEPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
                DEPENDPATH += $$PWD/../../../../../Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
            }
            x86_64
            {
                LIBS += -L"/usr/local/lib" -lusb-1.0
                INCLUDEPATH += /usr/include/libusb-1.0
                DEPENDPATH += /usr/include/libusb-1.0
            }
        
        }
        
        
        1 Reply Last reply
        1
        • A Offline
          A Offline
          Antonio Ortiz
          wrote on last edited by
          #4

          Thans to your advice @koahnig I could find the solution. I write the g++ version I want to use in the .pro file and QtCreator star loading the right library's version. I put here the final .pro file

          linux-beagleboard-g++:{
              LIBS += -L /home/antonio/Aplicaciones/crosscompile/sysroot/usr/opt/libusb/lib/ -lusb-1.0
              INCLUDEPATH += /home/antonio/Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
              DEPENDPATH += /home/antonio/Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
          }
          unix:{
              LIBS += -L"/usr/local/lib" -lusb-1.0
              INCLUDEPATH += /usr/include/libusb-1.0
              DEPENDPATH += /usr/include/libusb-1.0
          }
          
          K 1 Reply Last reply
          0
          • A Antonio Ortiz

            Thans to your advice @koahnig I could find the solution. I write the g++ version I want to use in the .pro file and QtCreator star loading the right library's version. I put here the final .pro file

            linux-beagleboard-g++:{
                LIBS += -L /home/antonio/Aplicaciones/crosscompile/sysroot/usr/opt/libusb/lib/ -lusb-1.0
                INCLUDEPATH += /home/antonio/Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
                DEPENDPATH += /home/antonio/Aplicaciones/crosscompile/sysroot/usr/opt/libusb/include
            }
            unix:{
                LIBS += -L"/usr/local/lib" -lusb-1.0
                INCLUDEPATH += /usr/include/libusb-1.0
                DEPENDPATH += /usr/include/libusb-1.0
            }
            
            K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            @Antonio-Ortiz

            I am glad to see that you could solve your problem.

            The wildcard option is quite helpful, but also quite dangerous, if you are not very careful.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            1

            • Login

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