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. Fix .pro file to find QT_HOME
Forum Updated to NodeBB v4.3 + New Features

Fix .pro file to find QT_HOME

Scheduled Pinned Locked Moved Solved Mobile and Embedded
7 Posts 4 Posters 2.6k Views 3 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.
  • PhrogzP Offline
    PhrogzP Offline
    Phrogz
    wrote on last edited by
    #1

    My .pro file has the following entries:

        ANDROID_EXTRA_LIBS = \
            $$(QT_HOME)/android_armv7/lib/libQt5Sql.so \
            $$_PRO_FILE_PWD_/libs/android_armv7/libcrypto.so \
            $$_PRO_FILE_PWD_/libs/android_armv7/libssl.so
     }
    

    When I try to build, it fails saying: External library /android_armv7/lib/libQt5Sql.so does not exist!

    I can "fix" this by hacking .pro file to use an absolute path, but clearly this is machine-specific and the wrong way to fix this problem.

        ANDROID_EXTRA_LIBS = \
    -       $$(QT_HOME)/android_armv7/lib/libQt5Sql.so \
    +       /home/gkistner/Qt/5.9.1/android_armv7/lib/libQt5Sql.so \
    

    How/where do I need to set QT_HOME so that the project builds properly for everyone/every system?

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

      Hi,

      AFAIK, the QT += sql ligne should set things up appropriately for you.

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

      PhrogzP 1 Reply Last reply
      3
      • PhrogzP Phrogz

        My .pro file has the following entries:

            ANDROID_EXTRA_LIBS = \
                $$(QT_HOME)/android_armv7/lib/libQt5Sql.so \
                $$_PRO_FILE_PWD_/libs/android_armv7/libcrypto.so \
                $$_PRO_FILE_PWD_/libs/android_armv7/libssl.so
         }
        

        When I try to build, it fails saying: External library /android_armv7/lib/libQt5Sql.so does not exist!

        I can "fix" this by hacking .pro file to use an absolute path, but clearly this is machine-specific and the wrong way to fix this problem.

            ANDROID_EXTRA_LIBS = \
        -       $$(QT_HOME)/android_armv7/lib/libQt5Sql.so \
        +       /home/gkistner/Qt/5.9.1/android_armv7/lib/libQt5Sql.so \
        

        How/where do I need to set QT_HOME so that the project builds properly for everyone/every system?

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by kshegunov
        #3

        @Phrogz said in Fix .pro file to find QT_HOME:

        How/where do I need to set QT_HOME so that the project builds properly for everyone/every system?

        QT_HOME=/some/path qmake projectname.pro
        

        You're using a syntax specifically tailored for environment variables (obtained when qmake is run). If you don't have that environment variable set, then it will expand to nothing.

        Read and abide by the Qt Code of Conduct

        PhrogzP 1 Reply Last reply
        1
        • kshegunovK kshegunov

          @Phrogz said in Fix .pro file to find QT_HOME:

          How/where do I need to set QT_HOME so that the project builds properly for everyone/every system?

          QT_HOME=/some/path qmake projectname.pro
          

          You're using a syntax specifically tailored for environment variables (obtained when qmake is run). If you don't have that environment variable set, then it will expand to nothing.

          PhrogzP Offline
          PhrogzP Offline
          Phrogz
          wrote on last edited by
          #4

          @kshegunov Can you clarify which path you're referring to? (Path to qmake for Android? Path to the project?) And does it have to be absolute? Ideally the solution would not require any absolute paths (or even relative paths outside the project), since many developers can have the project repo cloned in various locations, and can have Qt installed in various locations.

          A kshegunovK 2 Replies Last reply
          0
          • PhrogzP Phrogz

            @kshegunov Can you clarify which path you're referring to? (Path to qmake for Android? Path to the project?) And does it have to be absolute? Ideally the solution would not require any absolute paths (or even relative paths outside the project), since many developers can have the project repo cloned in various locations, and can have Qt installed in various locations.

            A Offline
            A Offline
            arsinte_andrei
            wrote on last edited by
            #5

            @Phrogz What He is saying that in your pro file to add a new line with

            QT += sql
            

            This will add SQL support and will automatically link to the lib

            1 Reply Last reply
            2
            • PhrogzP Phrogz

              @kshegunov Can you clarify which path you're referring to? (Path to qmake for Android? Path to the project?) And does it have to be absolute? Ideally the solution would not require any absolute paths (or even relative paths outside the project), since many developers can have the project repo cloned in various locations, and can have Qt installed in various locations.

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #6

              @Phrogz said in Fix .pro file to find QT_HOME:

              Can you clarify which path you're referring to?

              I'm referring to the environment variable you're using in your project file -$$(QT_HOME). As other already noted it should be enough for you to specify only the modules you're using and Qt should take care of the rest. I have no knowledge of how Qt was installed and where it resides in your setup, I was explaining what the used syntax does. To make it clear, doing:

              ANDROID_EXTRA_LIBS = /home/gkistner/Qt/5.9.1/android_armv7/lib/libQt5Sql.so
              

              is equivalent to:

              ANDROID_EXTRA_LIBS = $$(QT_HOME)/android_armv7/lib/libQt5Sql.so
              

              when qmake is called with the environment variable QT_HOME set, i.e. calling qmake like this:

              $> QT_HOME=/home/gkistner/Qt/5.9.1 qmake yourprojectfile.pro
              

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                AFAIK, the QT += sql ligne should set things up appropriately for you.

                PhrogzP Offline
                PhrogzP Offline
                Phrogz
                wrote on last edited by
                #7

                @SGaist Thanks, that did it. Not sure where the offending code in the .pro came from, but adding yours and deleting mine caused things to work without issue.

                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