Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Add dynamic linker path of project library for running in Qt Creator
Forum Updated to NodeBB v4.3 + New Features

Add dynamic linker path of project library for running in Qt Creator

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 3 Posters 11.2k 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.
  • M Offline
    M Offline
    miroslav
    wrote on last edited by
    #1

    Hi there,

    this is something that puzzled me for quite a while now. Consider this scenario: The current project consists of a dynamic library, an application and a unit test suite. Both the application and the unit test are linking the dynamic library. It is added to the .pro file using -L <path> -l <library>. The projects compiles and links just fine. The debug and release build directories, both out of source, siblings of the project directory, have been set up by Qt Creator.

    Now when trying to run the application (or the test), the dynamic library is not found and the program aborts during dynamic linking. The workaround is to set the (DY)LD_LIBRARY_PATH variable before starting Qt Creator. The problem with that is that it breaks switching between the debug and release builds.

    Does anybody know a way to specify in the QMake project file that the program target does not only link the dynamic library, but also needs it in the dynamic linker path when starting the application? Or (less preferred) tell Qt Creator to automatically take care of it?

    Thanks,

    Mirko.
    PS (for motivation): CMake handles that nicely.

    Mirko Boehm | mirko@kde.org | KDE e.V.
    FSFE Fellow
    Qt Certified Specialist

    1 Reply Last reply
    0
    • B Offline
      B Offline
      baysmith
      wrote on last edited by
      #2

      What you probably want to do is add paths to the rpath. Here are "forum topics tagged with rpath":http://developer.qt.nokia.com/search/tag/rpath

      Nokia Certified Qt Specialist.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        miroslav
        wrote on last edited by
        #3

        Thanks, Bradley. I think RPATH is not a good solution for various reasons, one of them being that it is Unix only. The other problem is that RPATH is for deployment, not for development.

        What this thread boils down to is that it is not possible to select a debug or run configuration from within Qt Creator if the project is multi-part and contains dynamic libraries that are re-used later in the project. I think this is a mess that definitely needs a good solution.

        Do any of the Qt Creator folks have a good idea?

        Mirko Boehm | mirko@kde.org | KDE e.V.
        FSFE Fellow
        Qt Certified Specialist

        1 Reply Last reply
        0
        • L Offline
          L Offline
          ludde
          wrote on last edited by
          #4

          I think Qt Creator is supposed do this for you, but I have found that it does not always work. (See e.g. "this thread":http://developer.qt.nokia.com/forums/viewthread/6789.)

          What you can do is set LD_LIBRARY_PATH in the Run Environment in Qt Creator. This is different for different builds, so it should be possible to set different values for debug and release builds.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            baysmith
            wrote on last edited by
            #5

            Granted RPATH is only a solution for Unix. But why is it only for deployment? Why couldn't it be used for altering library loading of a development build, just as it would for a deployment build?

            Nokia Certified Qt Specialist.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              miroslav
              wrote on last edited by
              #6

              @Bradley: Agreed, RPATH can be used for development as well. It is probably more of a gut reaction to not "abuse it" for development.

              @ludde: Setting LD_LIBRARY_PATH and PATH and DYLD_LIBRARY_PATH (and whatnot :-) ) is what I am doing as a workaround. Thanks for the pointer to the Qt Creator thread.

              I will check with the Qt Creator guys if automatically setting the library path for debugging is supposed to work. If so, I guess the current behavior is simply a bug. Thanks!

              Mirko Boehm | mirko@kde.org | KDE e.V.
              FSFE Fellow
              Qt Certified Specialist

              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