Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Ubuntu 10.10, Qt installed under /usr, and qmake adding -L/usr/lib
Forum Updated to NodeBB v4.3 + New Features

Ubuntu 10.10, Qt installed under /usr, and qmake adding -L/usr/lib

Scheduled Pinned Locked Moved Installation and Deployment
3 Posts 2 Posters 5.1k 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.
  • S Offline
    S Offline
    skavhaug
    wrote on 2 May 2011, 08:09 last edited by
    #1

    Hi,

    I'm completely new to Qt and qmake. I am trying to build a Qt application that uses a locally patched version of a shared system library. Since qmake automagically adds the -L$PREFIX/lib to the link line (LIBS), I get problems when I later define my own -L/some/place/in/ld_library_path/ -lfoo, since /usr/lib also contains libfoo.so.

    The problem, as I see it, is that libraries that reside in "trusted" locations (/usr/lib and /lib) are automatically added to the run-time linker, and should therefore not be added to the LIBS line by qmake. It does make sense to add the -L$PREFIX/lib in those cases when the qt libraries are installed outside the trusted directories (and perhaps also not listed in /etc/ld.so.conf).

    My question is pretty simple; is there a fix to this problem, not relying creating "hacks" in the filesystem (soft links and library renames)? A way to force qmake to not add /usr/lib to the linker would be the preferred solution here.

    Sincerely,
    Ola

    1 Reply Last reply
    0
    • L Offline
      L Offline
      ludde
      wrote on 3 May 2011, 14:27 last edited by
      #2

      Not sure I understand exactly what you want to do, but have you tried setting / resetting any of the other qmake variables related to library directories? For example, if /usr/lib is added because that is where the Qt libraries are, you could try to just reset QMAKE_LIBDIR_QT:
      @QMAKE_LIBDIR_QT =@
      Or remove /usr/lib explicitly:
      @QMAKE_LIBDIR_QT -= /usr/lib@
      Or, if you want to add your own directory /some/place before /usr/lib, you could do
      @QMAKE_LIBDIR_QT = /some/place $$QMAKE_LIBDIR_QT@

      1 Reply Last reply
      0
      • S Offline
        S Offline
        skavhaug
        wrote on 4 May 2011, 08:08 last edited by
        #3

        $ mkdir test
        $ cd test/
        $ touch main.cpp
        $ qmake -project
        $ qmake test.pro
        $ grep LIBS Makefile | head -1
        LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread

        Adding
        QMAKE_LIBDIR_QT -= /usr/lib
        to test.pro solves the problem. Thanks! I still think that the presence of -L/usr/lib is dubious behaviour, but this is perhaps something to talk to the ubuntu package maintainer about, and not this forum.

        Anyway, thanks for helping a rookie :)

        Ola

        1 Reply Last reply
        0

        1/3

        2 May 2011, 08:09

        • Login

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