From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,cd922e43161a3f1d X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-07-25 13:01:30 PST Newsgroups: comp.unix.osf.osf1 Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!gatech!swrinde!news.uh.edu!uuneo.neosoft.com!nmtigw!rwp From: rwp@nmti.com (roland pringle) Subject: Re: Problem with shared libraries Message-ID: Sender: rwp@nmti.com (roland pringle) Organization: Network Management Technology, Inc. References: <1994Jul25.141001.26281@datum.nyo.dec.com> Date: Mon, 25 Jul 1994 19:07:10 GMT In article <1994Jul25.141001.26281@datum.nyo.dec.com>, Frank Wortner wrote: > >In article , john@avante.WPI.EDU (John Stoffel) writes: > >|>To modify the search path, you can do: >|> >|> setenv LD_LIBRARY_PATH "/path/to/librca.so >|> >|>or you can try this when compiling your code: >|> >|> ld -rpath "/path/to/librca.so" main.o -o main -L/path/to" -lrca >|> >|>I haven't tested this myself, but that's how I read the man page for >|>loader. >|> > >Just to make the point a little clearer, think of LD_LIBRARY_PATH like PATH, >the *search path* for the library, not its full pathname. > > setenv LD_LIBRARY_PATH /path/to:/some/other/path > >This would make the runtime loader search the directories /path/to and >/some/other/path for libraries before searching the default library >directories. > >"-rpath" also takes a list of directories, not libraries. > > ld -rpath /path/to:/some/other/path main.o ... > >Also, if you might want to use the cc or f77 or other compiler command >to do the linking, rather than calling ld directly. That way you can >be sure that startup routines and other required libraries get integrated >into the executable. For example, > > cc -rpath /path/to:/some/other/path -threads main.o -L/path/to -lrca > >If you do want to use ld directly, run the compiler command with the -v >option first, so you can see what startups and "hidden" libraries you will >need to explictly use. "-threads" for example, adds "-lpthreads -lmach >-lc_r" to the link list. > >Have fun! 8-) > > Frank My apologies for not providing enough information. All C code has been compiled with "-g -std1 -shared" compile options. All Fortran code has been compiled with "-g -c -col72 -cross_reference -K -v -V -std -names as_is -assume nounderscore -shared" compile options. All shared libraries are build with ld using the -shared option, i.e., ld -shared object.list library.name All linking is done with either cc or f77 using the -call_shared option. I am using threads and the library search path does include the "-lpthreads -lmach -lc_r" libraries. I am using the LD_LIBRARY_PATH environmental variable in the form /path/to to provide the location of the shared libraries I built. I get no link errors. Only upon execution of the Fortran program do I get an error that says it is unable to map libxxx.so. Libxxx.so will vary depending upon the order of the shared libraries entered on the link command, i.e., f77 -called_shared xthreads main.o -L/path/to -lxxx -lyyy -lzzz Thanks again, Roland -- Roland Pringle (rwp@nmti.com) Network Management Technology, Inc. 1601 Industrial Blvd. Sugar Land, Texas 77487 +1 713 274-5084