LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-25-2014, 10:39 AM   #1
heyobj
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/libchilkat-9.5.0.so
LIBS += -l lib/libQtCore.so.4.8.6
LIBS += -l lib/libQtGui.so.4.8.6
LIBS += -l lib/libQtNetwork.so.4.8.6

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?

Thanks,
Jeff H

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

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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/libchilkat-9.5.0.so) can work - but it means that no other update will. The advantage of something like /lib/libchilkat.so.9 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/libchilkat.so.9 would have a symbolic link to the current version which could be /lib/libchilkat.so.9.5.0.
 
Old 11-28-2014, 07:24 AM   #3
heyobj
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 "libchilkat-9.5.0.so" not "libchilkat.so.9.5.0".
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.
 
  


Reply



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 07:36 AM
[SOLVED] Link shared library against other shared library Lobinho Linux - Newbie 2 05-28-2010 08:16 AM
unable to link against a 'c' shared library vessper Linux - Software 4 11-09-2009 10:49 AM
gcc link shared library against another shared library qcp Linux - Newbie 1 07-25-2008 11:15 AM
Link shared library in Kdevelop neikinfology Linux - Software 0 07-12-2007 03:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:12 PM.

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