Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-25-2014, 11:39 AM   #1
LQ Newbie
Registered: Nov 2014
Posts: 2

Rep: Reputation: Disabled
How to Link to local copy of shared library?

I'm porting a Windows 7 software project to CentOS 6.5. The project is composed of 4 executable and 9 plugins. The project depends on 12 shared libraries from Qt4.8, Chilkat and FFmpeg.

The software needs to be delivered as a RPM with all dependencies included.
The 4 executables are copied into a folder named PICTE.
The 12 shared libraries are copied into a folder PICTE/lib

Linking the Chilkat lib works with the following spec in the .pro file
QMAKE_CXXFLAGS += -ffriend-injection
QMAKE_LFLAGS = -Wl,-rpath,lib
LIBS += -l lib/
LIBS += -l lib/
LIBS += -l lib/
LIBS += -l lib/

However, the Qt libs return the error "No such file or directory".
I have also tried this with the dot reference:
QMAKE_LFLAGS = -Wl,-rpath,.
and also with:
QMAKE_LFLAGS = -Wl,-rpath-link,lib
QMAKE_LFLAGS = -Wl,-rpath-link,.
and with quotes:
QMAKE_LFLAGS = '-Wl,-rpath-link,lib'
and got the same result.

This seems like it should be possible to link to shared libraries bundles with my app.
Does anyone have a working example on how to do this?

Jeff H

Last edited by heyobj; 11-25-2014 at 06:12 PM. Reason: Improve title
Old 11-27-2014, 11:39 AM   #2
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,714

Rep: Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280
Should be easy - if they are installed. And you should specify the full path, not a relative path.

If you are linking 32 bit applications they MIGHT be in /lib (partly depends on distribution), but they could also be in /usr/lib.

If you are linking on a 64 bit system, /lib is the wrong place. Look in /lib64.

When something is "missing", you might just look to see where it really is (hint - use find).

Also note - specifying the subversions of a library (such as /lib/ can work - but it means that no other update will. The advantage of something like /lib/ is that any 9 level version should work and allows updates to the library without having to update the application as well. Usually the library /lib/ would have a symbolic link to the current version which could be /lib/
Old 11-28-2014, 08:24 AM   #3
LQ Newbie
Registered: Nov 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
The emphasis of my question needs to be on "local" copies of libraries. These local lib copies are located in "/opt/picte/lib" and the four executables that use the libs are located in "/opt/picte".
Also, the chilkat lib is provided by its vendor as "" not "".
The problem that I'm having is that the Jenkins build system is always including a reference to the Jenkins system in the dependency path when I try to run RPM to install this software on a target machine.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to link shared library. pradiptart Linux - Newbie 8 06-18-2012 08:36 AM
[SOLVED] Link shared library against other shared library Lobinho Linux - Newbie 2 05-28-2010 09:16 AM
unable to link against a 'c' shared library vessper Linux - Software 4 11-09-2009 11:49 AM
gcc link shared library against another shared library qcp Linux - Newbie 1 07-25-2008 12:15 PM
Link shared library in Kdevelop neikinfology Linux - Software 0 07-12-2007 04:35 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration