Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Unsolved How to correctly specify Qt user and system library path

    Installation and Deployment
    2
    2
    1416
    Loading More Posts
    • 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.
    • K
      kronat last edited by kronat

      I'm trying to compile a set of libraries and programs with a custom Qt version (system: 5.5.1, user: 5.8.0). For the majority of them, everything works fine, except for only one.

      I have correctly set the environment variables needed (proved by the fact that others compiled libraries, such as qwt, correctly shows a link to the 5.8.0 version of Qt).

      So, the core of the problem is the following: the program X, which I'm trying to compile against the 5.8.0 version, has a dependency that is in /usr/lib. In the end, the generated Makefile looks like the following:

      LIBS = $(SUBLIBS) -losgQt -L/usr/lib -lpython2.7 -lgdal [...] -L/home/user/Qt5.8.0/5.8/gcc_64/lib -lQt5OpenGL [...]
      

      I have omitted others libraries linking directives with [...]. It uses the "qmake" program to generate the Makefiles. The problem is that gcc has the /usr/lib library path (added for finding the dependencies) specified BEFORE the custom Qt dir. That means that gcc will find the system Qt before the 5.8.0, calling then an error on the linking phase ((.qtversion[qt_version_tag]+0x0): undefined reference to `qt_version_tag') because the software is compiled with 5.8.0 but then linked to 5.5.1.

      In the end, the answer is: how to arrange the order of the libraries path in the generated Makefile?

      Thanks!

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @kronat last edited by

        @kronat said in How to correctly specify Qt user and system library path:

        -L/home/user/Qt5.8.0/5.8/gcc_64/lib -lQt5OpenGL

        Actually it should look in /home/user/Qt5.8.0/5.8/gcc_64/lib for -lQt5OpenGL as there is correct -L in front of -lQt5OpenGL
        Are the other libraries you're linking against linked against Qt 5.5.1?
        You should check the linker command.

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

        1 Reply Last reply Reply Quote 1
        • First post
          Last post