Article View: comp.unix.programmer
Article #3348Re: ld.so, how do I include my own libraries?
From: Nils O. Selåsdal
Date: Wed, 02 Oct 2002 07:21
Date: Wed, 02 Oct 2002 07:21
39 lines
2701 bytes
2701 bytes
> First off, I barely know what I'm talking about, so please bear with me. > > I'm on a Linux box for which I do not have root privileges. I have > created a program which uses shared library (?) files which are not in the > standard paths. I compile my program with -lSDL_gfx, and I have a > directory with the files: > > libSDL_gfx.a > libSDL_gfx.so > libSDL_gfx.so.0.0.0 > libSDL_gfx.la > libSDL_gfx.so.0 > > When I try to run my program, I get this: > > ./ServerDriver: error while loading shared libraries: libSDL_gfx.so.0: > cannot open shared object file: No such file or directory > > What do I do to make the executable aware of the directory where it can > find the share library? Remember, I don't have root access. I read in > the 'man ld.so' file that I can set the LD_LIBRARY_PATH environment > variable to tell it where to find my libraries, so in bash I typed: > > LD_LIBRARY_PATH=/net/hu2/lonely/cs4455/SDL_gfx-2.0.3/local/lib > > which is the full directory where the shared library files libSDL_gfx.* > files are stored, but it still gives me the same error when I try to run > my program. What do I do? You can set the LD_LIBRARY_PATH to include the path where the libraries are nefore running your program. Or you can hardcode the searchpath in the binary. e.g. give gcc -Wl,-R /another/path at the linking stage. -- Vennlig hilsen/Best Regards Nils Olav Sel�sdal System Engineer UtelSystems a/s Tlf: +47 370 45 431 w w w . u t e l s y s t e m s . c o m
Technical Details
Message-ID:
<slrnapl3ue.h1b.noselasd@utelsystems.dyndns.org>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!129.240.148.23!uio.no!193.213.112.26.MISMATCH!newsfeed1.ulv.nextra.no!nextra.com!news4.ulv.nextra.no.POSTED!53ab2750!not-for-mailReferences:
<andmmd$s5v$1@news-int.gatech.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: fc89c,7093db2131cc7021 X-Google-Attributes: gidfc89c,public X-Google-Thread: 115a30,7093db2131cc7021 X-Google-Attributes: gid115a30,public X-Google-ArrivalTime: 2002-10-02 00:21:25 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!129.240.148.23!uio.no!193.213.112.26.MISMATCH!newsfeed1.ulv.nextra.no!nextra.com!news4.ulv.nextra.no.POSTED!53ab2750!not-for-mail Newsgroups: comp.unix.programmer,git.unix.linux From: noselasd@frisurf.no (Nils O. Selåsdal) Subject: Re: ld.so, how do I include my own libraries? References: <andmmd$s5v$1@news-int.gatech.edu> Followup-To: comp.unix.programmer Message-ID: <slrnapl3ue.h1b.noselasd@utelsystems.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit User-Agent: slrn/0.9.7.1 (Linux) Lines: 40 NNTP-Posting-Host: 80.212.18.222 X-Complaints-To: news-abuse@nextra.no NNTP-Posting-Date: Wed, 02 Oct 2002 09:21:24 MEST X-Trace: news4.ulv.nextra.no 1033543284 80.212.18.222 Date: Wed, 02 Oct 2002 07:21:24 GMT