Results 1 to 4 of 4
I started out programming with MS Visual C++ so my understanding of what's going on under-the-hood when compiling is still sketchy. I'm just getting my head around make files and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-10-2005 #1Just Joined!
- Join Date
- Apr 2005
- Location
- Brockville, Ontario, Canada
- Posts
- 74
Shared libraries - Things work when linking, but not run tim
I started out programming with MS Visual C++ so my understanding of what's going on under-the-hood when compiling is still sketchy. I'm just getting my head around make files and compiler flags and linking flags, etc.
I'm trying to link in two shared libraries to my project (A C++/QT/Matlab project). I just recently moved these two libraries into a subdirectory and I thought I added the appropriate linking path. When I run gmake it seems to complete fine, but when I go to actually run the program I'm told it can't find one of those shared libraries. What am I missing here? Everything worked fine when the libraries were in the root of the project, but now with them in a subdirectory (with -Lsomesubdirectory set) I can't run the program.
Thanks in advance.
Stu
- 05-10-2005 #2Linux Enthusiast
- Join Date
- Jan 2005
- Posts
- 575
Re: Shared libraries - Things work when linking, but not run
When you try to run the programme the loader loads to the memory the shared
Originally Posted by sadohert
libraries your programme requires.It looks for those libraries in certain standard
directories.If it can't find them it gives you an error message.To make it
search in additional directories put their names in the enviromental
variable LD_LIBRARY_PATH
To learn more you can have a look at the man page for ld.so
- 05-10-2005 #3Just Joined!
- Join Date
- Apr 2005
- Location
- Brockville, Ontario, Canada
- Posts
- 74
AHHHHHHH, I see! Beautiful. Okay, so, I've already got myself a shortcut to a terminal that sets up LD_LIBRARY_PATH for some Matlab specific stuff, and now I've added the path to the shared libraries.... and I guess if I were ever deploying this application I'd have to drop these libraries into the standard /usr/lib.... type places, or expect the person installing to update LD_LIBRARY_PATH (although not likely).
ORRRR, I guess the libraries can just stay in the same place as the program binary and they will be found at runtime (although my original goal was to clean up the directory structure)..... ORRRR< I guess build my binary into a subdir called $ProgramROOT/bin and dump the shared libraries in there too??
Okay, things are starting to seem less like hebrew. Thanks SLH
- 05-11-2005 #4Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
Another alternative would be to install the libs somewhere and add symlinks to them in /usr/lib.
Originally Posted by sadohert


Reply With Quote
