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. [SOLVED] Add dependency directory for deployment?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Add dependency directory for deployment?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.8k 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.
  • V Offline
    V Offline
    vezprog
    wrote on last edited by
    #1

    Hi,

    I have multiple libraries associated with my application and I would like to make a sub directory in the install directory that has all of the libs (including Qt libraries). All of my custom Qt libraries are linked in the .pro file and the application builds / runs fine in the debugger.

    So for example:
    Program Folder/executable
    Program Folder/libs/utility.so
    Program Folder/libs/QtCore.so
    Program Folder/libs/other library...
    Program Folder/custom_libs/custom_lib1.so
    Program Folder/custom_libs/custom_lib2.so

    Is there a way in QMake to tell the application on startup to look for the libraries in the sub folder lib and custom_libs (instead of having to manually add to LD_LIBRARY_PATH using export) or having a massive amount of libraries in the executable directory?

    I have tried QApplication::addLibraryPath(), and it did not work.

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

      Hi,

      IIRC there's the "qt.conf file":http://qt-project.org/doc/qt-4.8/qt-conf.html that you can use.

      Hope it helps

      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
      • V Offline
        V Offline
        vezprog
        wrote on last edited by
        #3

        Very cool. I will give it shot. I have never used it before, but from the docs, it looks like you can only designate one path in the plugins key, which would not allow me to add two sub directories for libs...

        Since my project is actually a Qt Console application, shouldn't I be able to use QCoreApplication::addLibraryPath() for the two directories containing my custom '.so' files?

        Thank you again for your help.

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

          qt.conf allows you to modify the hardcoded path to get the Qt libraries and addLibraryPath is to provide additional folder to find plugins.

          So indeed, it might not be what you need.

          There might be something you can do with linker flags like rpath.

          Anyway, when you have such a folder tree, it's not uncommon to provide a shell script to start the application with LD_LIBRARY_PATH (IIRC Firefox does it, QtCreator also)

          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
          • V Offline
            V Offline
            vezprog
            wrote on last edited by
            #5

            Hi,

            As you stated, the qt.conf only allowed me to point to that directory for the Qt Libs. I did try using a qmake compiler statement in the .pro adding --rpath, which indeed worked, but made things really ugly in my .pro/.pri files.

            I have resulted to a bash script right now that sets LD_LIBRARY_PATH. It may not be the best way to deploy, but it definitely cleans up everything in the application directory.

            Thank you again SGaist.

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

              You're welcome,

              It's a good way to deploy your application. Depending on your target distributions you can also provide a package (deb, rpm)

              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