Results 1 to 18 of 18

Thread: LD_LIBRARY_PATH and QT

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: LD_LIBRARY_PATH and QT

    RPATH is set by qmake makefile generation if the qt is not in the default library. For anyone working on linux with a newer version of qt will probably have qt on a /opt/ folder or similar non default folder. Once rpath is set, the ld_library_path thing doesn't work as rpath has a higher priority over ld_library_path. Refer https://blog.qt.digia.com/blog/2011/...h-and-runpath/
    In such cases we need to remove the rpath by PatchElf or chrpath. Chrpath only works for 32 bit executables. Or the flags as op has entered is an option. Or modify the generated makefile by hand.
    Once rpath dependencies go, the shell script mentioned in qt documentation works as ld_library_path gets higher precedence.
    Am I wrong in my understanding somewhere. Guys??

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: LD_LIBRARY_PATH and QT

    This is true only if you wish to override one (existing in the system) version of Qt library with another one, assuming your application was built with RPATH pointing to the location of the wrong library.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: LD_LIBRARY_PATH and QT

    Quote Originally Posted by wysota View Post
    This is true only if you wish to override one (existing in the system) version of Qt library with another one, assuming your application was built with RPATH pointing to the location of the wrong library.
    Generally in at-office work environment, qt comes pre-installed in the distribution (RHEL) for example so that kde can use it. The new qt5 versions i download, are added in /opt/ or /home/ folders. So linking against these newer qt version and using qmake to generate makefiles causes the addition of a DT_RPATH variable in the executable/library. Is there a way to tell qmake to not do so. Does adding LD_LIBRARY_PATH in the runtime settings avoid this? I tried a few combinations, but had to finally remove it -rpath manually from the generated makefile. This I have to do everytime I build the executable/library or use a nix-patcher.
    Is there any way to avoid all this and tell the qmake about not adding -rpath so that the shell which exports the new ld_library_path works as expected and ld loads the shared libraries of my choice?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: LD_LIBRARY_PATH and QT

    Your system's Qt is Qt4 or Qt5? If Qt4 then I don't see what problem you are having -- you cannot replace Qt4 libs with Qt5 or vice versa.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: LD_LIBRARY_PATH and QT

    system is rhel6. It contains qt 4 libraries. If i replace the libraries, then kde and qt dependent application will break as qt 4 and 5 are not binary compatible. Or so I think.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: LD_LIBRARY_PATH and QT

    Qt5 apps links explicitly against Qt5 libraries (libQt5Core.so.5). There is no way you could mix Qt4 and Qt5 libs.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. The following user says thank you to wysota for this useful post:

    pkj (21st December 2013)

Similar Threads

  1. LD_LIBRARY_PATH problem
    By sincnarf in forum General Programming
    Replies: 3
    Last Post: 29th August 2020, 18:58
  2. Setting LD_LIBRARY_PATH from Qt Creator
    By spud in forum Qt Programming
    Replies: 4
    Last Post: 3rd November 2011, 03:43
  3. Mysql LD_LIBRARY_PATH Issue
    By Think_Positive in forum Installation and Deployment
    Replies: 3
    Last Post: 13th February 2007, 19:16

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.