* Problem with shared libraries
@ 1994-07-22 16:30 roland pringle
1994-07-22 17:18 ` John Stoffel
[not found] ` <JOHN.94Jul22131852@avante.wpi.edu>
0 siblings, 2 replies; 6+ messages in thread
From: roland pringle @ 1994-07-22 16:30 UTC (permalink / raw)
I am having a problem with shared libraries. Perhaps someone on the net
can point me in the proper direction.
I am working on an Alpha 3000/410 using OSF/1 v 3.02. I am trying to
link together a mixture of C and Fortran modules. I have gotten a C
main to link and load properly using shared libraries. However, my
Fortran main program will not load. Every time I try to execute it
the message
9786: /dbl100/: /sbin/loader: Fatal error; cannot map librca.so
is produced. I have read the man pages for f77, ld, loader, cc, and ar
and cannot find an obvious problem. Since I am a newbie to shared
libraries, it is probably a silly pilot error. I have also read the
documentation on shared libraries in the online documentation. That
documentation might be construed to mean that shared libraries only
works for c code. I say this because it specifically mentions c code
but never mentions fortran code. I should also mention that we are using
threads. I understand threads and shared libraries did not work before
v 3.02. If I can provide any more information that may enable you to help
I will happy to do so. Replies through this news group or through e-mail to
rwp@nmti.com are more than acceptable. Also, if anyone can tell me where the
system error messages are gathered, it would be a help. I have
searched the online documentation but have not found a source for this
information.
Thanks,
Roland Pringle
--
Roland Pringle (rwp@nmti.com)
Network Management Technology, Inc.
1601 Industrial Blvd.
Sugar Land, Texas 77487
+1 713 274-5084
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Problem with shared libraries
1994-07-22 16:30 Problem with shared libraries roland pringle
@ 1994-07-22 17:18 ` John Stoffel
1994-07-25 14:10 ` Frank Wortner
[not found] ` <JOHN.94Jul22131852@avante.wpi.edu>
1 sibling, 1 reply; 6+ messages in thread
From: John Stoffel @ 1994-07-22 17:18 UTC (permalink / raw)
>>>>> "roland" == roland pringle <rwp@nmti.com> writes:
In article <id.6CGB1.1ML@nmti.com> rwp@nmti.com (roland pringle) writes:
roland> I am working on an Alpha 3000/410 using OSF/1 v 3.02. I am
roland> trying to link together a mixture of C and Fortran modules. I
roland> have gotten a C main to link and load properly using shared
roland> libraries. However, my Fortran main program will not load.
roland> Every time I try to execute it the message
roland> 9786: /dbl100/: /sbin/loader: Fatal error; cannot map librca.so
It looks to me that your program was compiled to use a shared library
which is now can't find. If you have librca.so outside of the default
search path for loader, which is: /usr/shlib, /usr/ccs/lib,
/usr/lib/cmplrs/cc, /usr/lib, /usr/local/lib, /var/shlib.
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.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Problem with shared libraries
1994-07-22 17:18 ` John Stoffel
@ 1994-07-25 14:10 ` Frank Wortner
1994-07-25 19:07 ` roland pringle
0 siblings, 1 reply; 6+ messages in thread
From: Frank Wortner @ 1994-07-25 14:10 UTC (permalink / raw)
In article <JOHN.94Jul22131852@avante.WPI.EDU>, 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Problem with shared libraries
1994-07-25 14:10 ` Frank Wortner
@ 1994-07-25 19:07 ` roland pringle
1994-07-27 19:05 ` Frank Wortner
0 siblings, 1 reply; 6+ messages in thread
From: roland pringle @ 1994-07-25 19:07 UTC (permalink / raw)
In article <1994Jul25.141001.26281@datum.nyo.dec.com>,
Frank Wortner <frank@nyo.dec.com> wrote:
>
>In article <JOHN.94Jul22131852@avante.WPI.EDU>, 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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Problem with shared libraries
1994-07-25 19:07 ` roland pringle
@ 1994-07-27 19:05 ` Frank Wortner
0 siblings, 0 replies; 6+ messages in thread
From: Frank Wortner @ 1994-07-27 19:05 UTC (permalink / raw)
In article <id.5MJB1.TYJ@nmti.com>, rwp@nmti.com (roland pringle) writes:
|>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
|>
Here's a couple of tests you could try:
1) DBX the executable and type the command
listobj
That will tell you where the executable is looking for libraries.
2) Set the environmental variable _RLD_ARGS to "-trace" or "-v".
That will make the loader trace it's actions. Try "-v" first:
it produces less output.
3) Is your program running setuid or setgid? The loader then
restricts the library search path to the default directories
(/usr/shlib /usr/ccs/lib /usr/cmplrs/cc /usr/lib /usr/local/lib).
4) Have you tried setting the library's SONAME when you build it?
Use the -soname option to do this:
ld -shared -soname /path/to/libxxx.so -o libxxx.so *.o
This will force the loader to load "/path/to/libxxx.so" at
runtime.
Frank
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <JOHN.94Jul22131852@avante.wpi.edu>]
* Re: Problem with shared libraries
[not found] ` <JOHN.94Jul22131852@avante.wpi.edu>
@ 1994-07-25 15:45 ` roland pringle
0 siblings, 0 replies; 6+ messages in thread
From: roland pringle @ 1994-07-25 15:45 UTC (permalink / raw)
In article <JOHN.94Jul22131852@avante.wpi.edu>,
John Stoffel <john@avante.WPI.EDU> wrote:
>>>>>> "roland" == roland pringle <rwp@nmti.com> writes:
>In article <id.6CGB1.1ML@nmti.com> rwp@nmti.com (roland pringle) writes:
>
>
>roland> I am working on an Alpha 3000/410 using OSF/1 v 3.02. I am
>roland> trying to link together a mixture of C and Fortran modules. I
>roland> have gotten a C main to link and load properly using shared
>roland> libraries. However, my Fortran main program will not load.
>roland> Every time I try to execute it the message
>
>roland> 9786: /dbl100/: /sbin/loader: Fatal error; cannot map librca.so
>
>It looks to me that your program was compiled to use a shared library
>which is now can't find. If you have librca.so outside of the default
>search path for loader, which is: /usr/shlib, /usr/ccs/lib,
>/usr/lib/cmplrs/cc, /usr/lib, /usr/local/lib, /var/shlib.
>
>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.
John, thanks for the reply. I did have the LD_LIBRARY_PATH environmental
variable set. I have also tried the -rpath compile flag and I still am
unable to get a fortran main program to load with shared libraries.
Perhaps if any DEC representative is listening to this newsgroup, s/he could
lend a suggestion or two.
Thanks
Roland
--
Roland Pringle (rwp@nmti.com)
Network Management Technology, Inc.
1601 Industrial Blvd.
Sugar Land, Texas 77487
+1 713 274-5084
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1994-07-27 19:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-07-22 16:30 Problem with shared libraries roland pringle
1994-07-22 17:18 ` John Stoffel
1994-07-25 14:10 ` Frank Wortner
1994-07-25 19:07 ` roland pringle
1994-07-27 19:05 ` Frank Wortner
[not found] ` <JOHN.94Jul22131852@avante.wpi.edu>
1994-07-25 15:45 ` roland pringle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox