Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Problems with Shared Libraries
@ 1994-07-20 15:16 George M. Scott
  1994-07-20 17:28 ` Craig Neth USG
  1994-07-21 17:26 ` Steve Huston
  0 siblings, 2 replies; 3+ messages in thread
From: George M. Scott @ 1994-07-20 15:16 UTC (permalink / raw)



I have noticed the following problem when using shared libraries on OSF/1 2.0.
I have a program which loads shared libraries dynamically using dlopen/dlsym.
This program is compiled with only the C library.

Now if I create shared libraries that use libc.so, libm.so, or even libcxx.so
everything is fine when loaded with dlopen.  However if the library 
has dependencies of the form -lpthreads -lmach -lcxx -lc_r -lc, and the
library contains global c++ constructors which make pthreads calls then
the library cannot be properly loaded and initialized.  The library itself
is loaded ok it seems, but when the c++ constructors are called they attempt
to call the pthreads routines and they never return.  They just chew up
lots of cpu spinning around in various cma routines like cma__alloc_mem.

This problem goes away if the program which calls dlopen is linked with
-lpthreads -lmach -lcxx -lc_r, but this seems ridiculous and unecessary.
I believe the problem may be caused by empty dependency lists in
libtphreads.so and libmach.so.  odump -D shows they have no dependencies
which cannot be correct.

Does anyone know the true cause of this problem?

Is DEC going to fix it?

George Scott
Johns Hopkins University / Applied Physics Laboratory
gscott@aurora.jhuapl.edu

-- 
George Scott
Michigan State University
scottge1@cps.msu.edu


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with Shared Libraries
  1994-07-20 15:16 Problems with Shared Libraries George M. Scott
@ 1994-07-20 17:28 ` Craig Neth USG
  1994-07-21 17:26 ` Steve Huston
  1 sibling, 0 replies; 3+ messages in thread
From: Craig Neth USG @ 1994-07-20 17:28 UTC (permalink / raw)



In article <30jf4l$g7g@msuinfo.cl.msu.edu>, scottge1@cps.msu.edu (George M. Scott) writes:
|>
|>I have noticed the following problem when using shared libraries on OSF/1 2.0.
|>I have a program which loads shared libraries dynamically using dlopen/dlsym.
|>This program is compiled with only the C library.
|>
|>Now if I create shared libraries that use libc.so, libm.so, or even libcxx.so
|>everything is fine when loaded with dlopen.  However if the library 
|>has dependencies of the form -lpthreads -lmach -lcxx -lc_r -lc, and the
|>library contains global c++ constructors which make pthreads calls then
|>the library cannot be properly loaded and initialized. 
[...]
|>Does anyone know the true cause of this problem?

I talked to the loader expert, and this is how he explained it to me.
(The words are mine, paraphrased from a conversation).

Your application is attempting to change from single-threaded (linked
against libc, which is single threaded) to multi-threaded _while_ it is 
running.   This just plain does not work; it's not even clear that it
can be made to work.

Right now, you need to keep things consistent.  If the libraries
you need to dlopen are multi-threaded, the main image needs to be linked
against the thread libraries.

|>Is DEC going to fix it?

The threads and libraries people are working on trying to make this
work, but it isn't soup yet....  The next major release (after the one we 
are releasing this summer) would be the first opportunity for this work
to show up _if_ they figure out how to do it.

-- 
--------------------------------------------------------------------------------
Craig Neth                         ! neth@zk3.dec.com
Digital Equipment Corporation      !
110 Spit Brook Road ZKO3-3/Y25     !
Nashua, NH 03062                   ! Opinions expressed herein are my own.
================================================================================


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with Shared Libraries
  1994-07-20 15:16 Problems with Shared Libraries George M. Scott
  1994-07-20 17:28 ` Craig Neth USG
@ 1994-07-21 17:26 ` Steve Huston
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Huston @ 1994-07-21 17:26 UTC (permalink / raw)



In article <30jf4l$g7g@msuinfo.cl.msu.edu>, scottge1@cps.msu.edu (George M. Scott) writes:

>Now if I create shared libraries that use libc.so, libm.so, or even libcxx.so
>everything is fine when loaded with dlopen.  However if the library 
>has dependencies of the form -lpthreads -lmach -lcxx -lc_r -lc, and the
>library contains global c++ constructors which make pthreads calls then
>the library cannot be properly loaded and initialized.

(snip)

>This problem goes away if the program which calls dlopen is linked with
>-lpthreads -lmach -lcxx -lc_r, but this seems ridiculous and unecessary.
>
>Does anyone know the true cause of this problem?

Yes.

I'm not an official Digital contact, and this isn't an official Digital
response, and I'm a consultant, not an employee....   end of disclaimers.

The problem is that the pthreads initialization stuff does not get invoked
properly unless pthreads is linked into the main program.  It's a known
problem, and they're working on it.

>Is DEC going to fix it?

I believe so, though I couldn't comment on any availability release/date.

--
Steve Huston                              CompuCraft
CompuServe: 72133,2372                    61 Nadeau Drive
Internet:   72133.2372@CompuServe.COM     Wrentham, MA 02093-1618
            huston@icecub.ako.dec.com     (508) 384-5770


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1994-07-21 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-07-20 15:16 Problems with Shared Libraries George M. Scott
1994-07-20 17:28 ` Craig Neth USG
1994-07-21 17:26 ` Steve Huston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox