Results 1 to 4 of 4

Thread: My 3rd party library RPATH problem (Linux)

  1. #1

    Default My 3rd party library RPATH problem (Linux)

    Hi,

    I'm developing a 3rd party library that can be installed as a part of Qt SDK.
    I have the Qt SDK installed to the default dir - in my home dir, /home/username/QtSDK.

    The problem is that when I compile the library, linker links absolute paths of my home dir to the binary.
    When I check the lib dependencies of my library with ldd ./libmylib.so, there are:

    libQtMobilitySimulator.so.1 => /home/username/QtSDK/Simulator/QtMobility/gcc/lib/libQtMobilitySimulator.so.1 (0x008a1000)
    libQtServiceFramework.so.1 => /home/username/QtSDK/Simulator/QtMobility/gcc/lib/libQtServiceFramework.so.1 (0x009fc000)
    libQtCore.so.4 => /home/username/QtSDK/Simulator/Qt/gcc/lib/libQtCore.so.4 (0x00254000)


    Now, when I copy the lib to another computer with other user name, ldd cannot find the dependecies.

    What is the preferred way on Linux platform to change those library paths in the binary to correspond the destination computer Qt paths?

    On Mac OS X there's a tool called install_name_tool, which does the trick. Qt SDK installer seems changing RPATHs on the fly when it installs the libraries to desired location. For convenience, I'd like to have the library installed under the default path /home/username/QtSDK, not in the /usr/lib.

    Many thanks in advance!

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

    Default Re: My 3rd party library RPATH problem (Linux)

    rpath is only a suggestion. If the linker can't find the library in directories specified by rpath, it will perform a regular lookup for the libraries. If it doesn't work for you then it means you didn't place your Qt libs in a directory the linker looks for libraries.
    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

    Default Re: My 3rd party library RPATH problem (Linux)

    Thanks for the clarification!

    Another question is:
    Is there a way for replacing those linker absolute paths (e.g. /home/username/QtSDK/Simulator/QtMobility/gcc/lib/) with an empty ones?
    I think that could be some option provided by ld linker? Would be nice if my home dir is not listed in the library binary when I release the lib

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

    Default Re: My 3rd party library RPATH problem (Linux)

    Quote Originally Posted by jezze_h View Post
    Is there a way for replacing those linker absolute paths (e.g. /home/username/QtSDK/Simulator/QtMobility/gcc/lib/) with an empty ones?
    Not really. What you can do is not add any rpath entries at all. Clearing QMAKE_LIBDIRS (or something like that) should do the trick.
    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.


Similar Threads

  1. Suggestion in library inclusion with rpath
    By jepessen in forum Newbie
    Replies: 2
    Last Post: 9th May 2011, 09:07
  2. Linux vs Windows 3rd party libraries
    By skepticalgeek in forum Newbie
    Replies: 4
    Last Post: 9th August 2010, 01:23
  3. Application with shared library problem in linux
    By cutie.monkey in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2010, 07:20
  4. Replies: 0
    Last Post: 4th November 2009, 07:45
  5. Building a third party library
    By munna in forum General Programming
    Replies: 1
    Last Post: 6th October 2006, 20:43

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.