libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with libtool under HPUX: BIND_FIRST flag is required


From: Jan Giesen
Subject: Re: Problem with libtool under HPUX: BIND_FIRST flag is required
Date: Sun, 27 Nov 2005 22:56:26 +0100

Dear Ralf

You wrote:
> Hi Jan,
>
> * Jan Giesen wrote on Fri, Nov 25, 2005 at 11:16:26PM CET:
> > I have encountered a libtool problem, when I tried to build
> > cvsnt 2.5.03.2151 (cf. www.cvsnt.org) under HPUX 11.11.
> > This problem could be reproduced with libtool version 1.5.6
> > as well as with 1.5.20:
>
> Hrmpf, I need to fill out some stupid form in order to be able to
> download this?
>

The cvsnt source code can be downloaded directly from www.cvsnt.org/archive
Corresponding email discussion list are
- http://cvsnt.org/pipermail/cvsnt
- http://cvsnt.org/pipermail/cvsnt-dev

The problem was first discussed on the cvsnt-dev list :
http://cvsnt.org/pipermail/cvsnt-dev/2005-November/000304.html

Note that the last cvs verion 2.5.03.2151 does not build without
some small tweaks on HPUX 11.11; c.f. the comments on the cvsnt-dev list.

> > Subroutines in shared libraries, which are loaded at runtime
> > using libtldl are not correctly linked. The problem could be
> > solved by adding the BIND_FIRST parameter to the LT_BIND_FLAGS
> > Define in ltdl.c:
> >
> > #define LT_BIND_FLAGS (BIND_IMMEDIATE | BIND_FIRST | BIND_NONFATAL |
> > DYNAMIC_PATH)
>
> Browsing some documentation it may be we'd also need BIND_TOGETHER if we
> add BIND_FIRST[1].  But..
>
> > Background:
> > ===========
> > cvsnt loads at runtime a set of "trigger" libraries. These trigger
> > libraries are shared libraries, which are implemented in C++ and
> > are loaded using the libtool routines in ltdl.c.
> > All trigger libraries export the same set of symbols, which are
> > used to invoke specific functions (e.g. init(), etc.).
> > If the trigger libraries are loaded in the sequence A, B, C,..
> > then it happens that a call to the init() function of library B or C
> > does not invoke this init() function, but the init() function of
> > library A.
> > This behaviour in in line with the HPUX docu, but different to the
> > behaviour under Linux RedHat and it breaks cvsnt. By specifing
> > BIND_FIRST the problem could be avoided.
> >
> > Therefore I propose that in ltdl.c the flag BIND_FIRST is by default
> > part of LT_BIND_FLAGS.
>
> This description is pretty good, but not good enough for me to totally
> understand what you are (or cvsnt is) trying to do.  Like this?
>   handle_A = lt_dlopen ("A.la");
>   handle_B = lt_dlopen ("B.la");
>   handle_C = lt_dlopen ("C.la");
>   void (*) pf (void);
>   pf = lt_dlsym (handleA, "init");
>   pf (...);
>
> all from the main program?  Or maybe you open B from within A?
> Or is init() the initializer function of the modules, and you don't ever
> call it explicitly?

The trigger libraries export a GetCvSInfo function:
   extern "C" trigger_interface *GetCvsInfo(int version)
which returns the pointer to a function call table:
static trigger_interface callbacks =
{
 init,
 close,
 pretag,
 :
};

init, close, pretag etc. are defined in the source code of the trigger
library, e.g. :
int close(const struct trigger_interface_t* cb)
{
 return 0;
}
The trigger libraries are itself loaded explicitly with lt_dlopen(), but not
in the main programm, but in a another shared library, which is implicit
loaded from the main program.
To access a trigger library a pointer to the GetCvsInfo function is
requested via lt_dlsym(). The invocation of the GetCvsInfo function returns
the pointer to the "callbacks" function call table. The programm expects
that
the function pointers in the call table are properly initialized by the
share library loader; which is not the case, if "BIND_FIRST" is missing
and it's not the first trigger library which is loaded.

Note: I can also provoke the problem under Linux using the default settings
of Libtool 1.5.20 in ltdl.c. Since ltdl.c use by default the loader flag
"RTLD_GLOBAL", but not "RTLD_LOCAL"

>
> Note also that I can't test this, but there is hope that this situation
> changes soon.   Meanwhile, it would be good if someone else could look
> at this as well.
>
> > > After extending this Define, the trigger libraries are loaded and
> > > initialized.  This is in-line with the HPUX documentation.
> > >
> > > Unfortunately I have still a crash dump after unloading the last
trigger
> > > library...  Not everything is solved with this patch.
>
> Hmm.  Does this have to do with libltdl, too, or is it cvsnt specific?
>

I suspect a problem with the HPUX link environment; since our HPUX 11.11.
machines
use relatively old versions (11.33 or 11.37) of ld, dld.sl, crt0.0 etc., but
the newest version is 11.47. I have seen some emails on the net, which
describes
a crash dump under similiar conditions; which was solved by applying a
recent
"ld(1) and linker tools cumulative patch" e.g. PHSS_30970.

> Cheers,
> Ralf
>
> [1] http://docs.hp.com/en/B2355-90654/ch05s03.html
>

Best regards
               Jan Giesen





reply via email to

[Prev in Thread] Current Thread [Next in Thread]