You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Sander Striker <st...@apache.org> on 2002/04/13 02:29:16 UTC

FW: shared dav_svn is not relinking

Since this might be an apxs issue I'm forwarding this here.
Any clues?

Sander

-----Original Message-----
From: Philip Martin [mailto:pm@localhost]On Behalf Of Philip Martin
Sent: 12 April 2002 16:03
To: dev@subversion.tigris.org
Subject: shared dav_svn is not relinking


Hi

I notice that the installed libmod_dav_svn.so module is linked to
subversion libraries in my build tree and not to the installed
libraries.  Within the build tree, libmod_dav_svn.so is linked against
libraries in the build tree, just like all the other subversion
libraries. However once installed the subversion libraries are linked
against the installed libraries, but libmod_dav_svn.so remains linked
against the build tree.

The file subversion/mod_dav_svn/libmod_dav_svn.la contains a
relink_command, but this does not appear to get executed when
libmod_dav_svn.so is installed.  The module is installed by calling
apache's 'apxs -i -a', this in turn calls apache's instdso.sh, and
this simply copies the library from the build tree into the module
directory. Quoting from instdso.sh

  #!/bin/sh
  #
  # instdso.sh - install Apache DSO modules
  #
  # we use this instead of libtool --install because:
  # 1) on a few platforms libtool doesn't install DSOs exactly like we'd
  #    want (weird names, doesn't remove DSO first)
  # 2) we never want the .la files copied, so we might as well copy
  #    the .so files ourselves

it appears that not using libtool is deliberate.

If I execute the relink_command by hand I get a shared library that is
correctly linked against the installed Subversion libraries.

Does anyone else see this problem? How is it supposed to work? Is this
an Apache bug?

I am using apache-2.0.35 and libtool-1.4.2 on Linux.

-- 
Philip

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org





Re: FW: shared dav_svn is not relinking

Posted by Jeff Trawick <tr...@attglobal.net>.
Jeff Trawick <tr...@attglobal.net> writes:

> Well, we (I) started using instdso.sh instead of libtool --install
> because with libtool --install
...
> 2) we get a bunch of crap installed in the lib directory that we don't
>    need

I should have said "modules" instead of "lib"

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Re: instdso.sh and libtool, WAS: RE: FW: shared dav_svn is not relinking

Posted by Jeff Trawick <tr...@attglobal.net>.
"Sander Striker" <st...@apache.org> writes:

> > These variables in the .la file look interesting:
> > 
> > # The name that we can dlopen(3).
> > dlname='libmod_foo.so.0.0.0'
> > # Names of this library.
> > library_names='libmod_foo.so.0.0.0 libmod_foo.so.0 libmod_foo.so'
> 
> Ah, now I see what you are talking about.  Ok, I think we need to do
> the following (all the time*):
> 
>  - extract dlname from $MODULE_BASENAME.la
>  - extract library_names from $MODULE_BASENAME.la
>  - remove $MODULE_BASENAME.la
>  - remove all files in library_names, except $dlname
>  - rename $dlname to $MODULE_BASENAME.so
> 
> And maybe:
>  - remove [lib]$MODULE_BASENAME.a
>  
> 
> Judging from your emails this is kind of what you had in mind, correct?

yessir

> If you don't pass it, libtool complains that the name doesn't start with 'lib'.
> This sounds like a libtool bug.  You are only seeing the lib prefix appear
> on some platforms, correct?

yes, IIRC it only appears on Tru64 and AIX

--
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

instdso.sh and libtool, WAS: RE: FW: shared dav_svn is not relinking

Posted by Sander Striker <st...@apache.org>.
> From: trawick@rdu88-250-035.nc.rr.com
> [mailto:trawick@rdu88-250-035.nc.rr.com]On Behalf Of Jeff Trawick
> Sent: 18 April 2002 19:12

> "Sander Striker" <st...@apache.org> writes:
> 
>>>>> 1) always do libtool --install
>>
>> Can we agree on this?  Since we are using libtool throughout our
>> entire build it seems inconsistent to bypass it here.
> 
> yes, we can agree on this...

Ok, glad to hear that.
 
> I'm planning to work on this tonight and in the morning.  If you'd
> rather proceed yourself, that's fine, and I can test on AIX, Tru64,
> and HP-UX and assume that any oddities on other platforms are
> represented by what happens on those three platforms.

Ok, cool.  I probably don't have time to look at it until this
weekend, so please don't wait for me.  I'll provide some comments
here that will hopefully be helpfull.

>>>>> 2) look in installed .la file for the name that must be passed to
>>>>>    dlopen and rename that file in the target directory to what we
>>>>>    think a DSO ought to be named
>>>> 
>>>> But we only need to do that for AIX, Tru64 and HP-UX.
>>> 
>>> I don't really believe that :)  libtool has as many nuances as there
>>> are operating systems.  It seems easy enough to look in the .la file
>>> and if the name to dlopen is different than what we want, rename what
>>> it got installed as.
>> 
>> Can you give me some examples?  I am totally in the dark here and
>> some input on what happens could possibly enable me to help solve
>> the problem.
> 
> Here is what gets installed for me with libtool 1.4.2 on AIX:
> 
> -rw-r--r--   1 trawick  staff      62568 Apr 18 12:53
>  ../../built/modules/libmod_foo.a
> lrwxrwxrwx   1 trawick  staff         25 Apr 18 12:53
>  ../../built/modules/libmod_foo.so -> libmod_foo.so.0.0.0
> lrwxrwxrwx   1 trawick  staff         25 Apr 18 12:53
>  ../../built/modules/libmod_foo.so.0 ->
>  libmod_foo.so.0.0.0
> -rwxr-xr-x   1 trawick  staff      71968 Apr 18 12:53
>  ../../built/modules/libmod_foo.so.0.0.0
> -rw-r--r--   1 trawick  staff        792 Apr 18 12:53
>  ../../built/modules/mod_foo.la
> 
> These variables in the .la file look interesting:
> 
> # The name that we can dlopen(3).
> dlname='libmod_foo.so.0.0.0'
> # Names of this library.
> library_names='libmod_foo.so.0.0.0 libmod_foo.so.0 libmod_foo.so'

Ah, now I see what you are talking about.  Ok, I think we need to do
the following (all the time*):

 - extract dlname from $MODULE_BASENAME.la
 - extract library_names from $MODULE_BASENAME.la
 - remove $MODULE_BASENAME.la
 - remove all files in library_names, except $dlname
 - rename $dlname to $MODULE_BASENAME.so

And maybe:
 - remove [lib]$MODULE_BASENAME.a
 

Judging from your emails this is kind of what you had in mind, correct?

*) That is, until a patch is submitted to libtool that will give
   us our expected behaviour all the time.
 
>> Also, is this solvable in libtool itself?  IOW, can we come up with
>> a patch to libtool that solves the problem?
> 
> sure, somebody could come up with a patch :)

heh.

>>>>> 3) since this design does libtool --install for every DSO, we need to
>>>>>    work hard to zap the extra system-dependent libtool-created
>>>>>    files/symlinks in the target directory
>>>> 
>>>> But that's not too hard.  We can zap everything not ending with .so,
>>>> right?
>>> 
>>> sounds right...  and you have to account for a possible "lib" prefix
>>> on some of the files
>> 
>> How did the lib prefix get there in the first place?  (does that happen
>> on AIX, Tru64 or HP-UX?).
> 
> libtool decided that the lib prefix was appropriate (and I expect that
> it is correct, given the assumption that the library is for linking
> against) .  
> 
>> If you pass -module to libtool you can name
>> it anything you like; like we do for our modules.
> 
> We're already using -module.  Are we using it incorrectly?

That's odd.  I thought that was one of the reasons to use -module.
If you don't pass it, libtool complains that the name doesn't start with 'lib'.
This sounds like a libtool bug.  You are only seeing the lib prefix appear
on some platforms, correct?

Sander


Re: FW: shared dav_svn is not relinking

Posted by Jeff Trawick <tr...@attglobal.net>.
"Sander Striker" <st...@apache.org> writes:

> > From: trawick@rdu88-250-035.nc.rr.com
> > [mailto:trawick@rdu88-250-035.nc.rr.com]On Behalf Of Jeff Trawick
> > Sent: 17 April 2002 19:25
> 
> > "Sander Striker" <st...@apache.org> writes:
> > 
> >>> 1) always do libtool --install
> >> 
> >> +1.
> 
> Can we agree on this?  Since we are using libtool throughout our
> entire build it seems inconsistent to bypass it here.

yes, we can agree on this...

I'm planning to work on this tonight and in the morning.  If you'd
rather proceed yourself, that's fine, and I can test on AIX, Tru64,
and HP-UX and assume that any oddities on other platforms are
represented by what happens on those three platforms.

> >>> 2) look in installed .la file for the name that must be passed to
> >>>    dlopen and rename that file in the target directory to what we
> >>>    think a DSO ought to be named
> >> 
> >> But we only need to do that for AIX, Tru64 and HP-UX.
> > 
> > I don't really believe that :)  libtool has as many nuances as there
> > are operating systems.  It seems easy enough to look in the .la file
> > and if the name to dlopen is different than what we want, rename what
> > it got installed as.
> 
> Can you give me some examples?  I am totally in the dark here and
> some input on what happens could possibly enable me to help solve
> the problem.

Here is what gets installed for me with libtool 1.4.2 on AIX:

-rw-r--r--   1 trawick  staff      62568 Apr 18 12:53
 ../../built/modules/libmod_foo.a
lrwxrwxrwx   1 trawick  staff         25 Apr 18 12:53
 ../../built/modules/libmod_foo.so -> libmod_foo.so.0.0.0
lrwxrwxrwx   1 trawick  staff         25 Apr 18 12:53
 ../../built/modules/libmod_foo.so.0 ->
 libmod_foo.so.0.0.0
-rwxr-xr-x   1 trawick  staff      71968 Apr 18 12:53
 ../../built/modules/libmod_foo.so.0.0.0
-rw-r--r--   1 trawick  staff        792 Apr 18 12:53
 ../../built/modules/mod_foo.la

These variables in the .la file look interesting:

# The name that we can dlopen(3).
dlname='libmod_foo.so.0.0.0'
# Names of this library.
library_names='libmod_foo.so.0.0.0 libmod_foo.so.0 libmod_foo.so'

> Also, is this solvable in libtool itself?  IOW, can we come up with
> a patch to libtool that solves the problem?

sure, somebody could come up with a patch :)

> >>> 3) since this design does libtool --install for every DSO, we need to
> >>>    work hard to zap the extra system-dependent libtool-created
> >>>    files/symlinks in the target directory
> >> 
> >> But that's not too hard.  We can zap everything not ending with .so,
> >> right?
> > 
> > sounds right...  and you have to account for a possible "lib" prefix
> > on some of the files
> 
> How did the lib prefix get there in the first place?  (does that happen
> on AIX, Tru64 or HP-UX?).

libtool decided that the lib prefix was appropriate (and I expect that
it is correct, given the assumption that the library is for linking
against) .  

>                            If you pass -module to libtool you can name
> it anything you like; like we do for our modules.

We're already using -module.  Are we using it incorrectly?

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

RE: FW: shared dav_svn is not relinking

Posted by Sander Striker <st...@apache.org>.
> From: trawick@rdu88-250-035.nc.rr.com
> [mailto:trawick@rdu88-250-035.nc.rr.com]On Behalf Of Jeff Trawick
> Sent: 17 April 2002 19:25

> "Sander Striker" <st...@apache.org> writes:
> 
>>> 1) always do libtool --install
>> 
>> +1.

Can we agree on this?  Since we are using libtool throughout our
entire build it seems inconsistent to bypass it here.

>>> 2) look in installed .la file for the name that must be passed to
>>>    dlopen and rename that file in the target directory to what we
>>>    think a DSO ought to be named
>> 
>> But we only need to do that for AIX, Tru64 and HP-UX.
> 
> I don't really believe that :)  libtool has as many nuances as there
> are operating systems.  It seems easy enough to look in the .la file
> and if the name to dlopen is different than what we want, rename what
> it got installed as.

Can you give me some examples?  I am totally in the dark here and
some input on what happens could possibly enable me to help solve
the problem.

Also, is this solvable in libtool itself?  IOW, can we come up with
a patch to libtool that solves the problem?

>>> 3) since this design does libtool --install for every DSO, we need to
>>>    work hard to zap the extra system-dependent libtool-created
>>>    files/symlinks in the target directory
>> 
>> But that's not too hard.  We can zap everything not ending with .so,
>> right?
> 
> sounds right...  and you have to account for a possible "lib" prefix
> on some of the files

How did the lib prefix get there in the first place?  (does that happen
on AIX, Tru64 or HP-UX?).  If you pass -module to libtool you can name
it anything you like; like we do for our modules.


Sander

Re: FW: shared dav_svn is not relinking

Posted by Jeff Trawick <tr...@attglobal.net>.
"Sander Striker" <st...@apache.org> writes:

> > 1) always do libtool --install
> 
> +1.
> 
> > 2) look in installed .la file for the name that must be passed to
> >    dlopen and rename that file in the target directory to what we
> >    think a DSO ought to be named
> 
> But we only need to do that for AIX, Tru64 and HP-UX.

I don't really believe that :)  libtool has as many nuances as there
are operating systems.  It seems easy enough to look in the .la file
and if the name to dlopen is different than what we want, rename what
it got installed as.

> > 3) since this design does libtool --install for every DSO, we need to
> >    work hard to zap the extra system-dependent libtool-created
> >    files/symlinks in the target directory
> 
> But that's not too hard.  We can zap everything not ending with .so,
> right?

sounds right...  and you have to account for a possible "lib" prefix
on some of the files

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

RE: FW: shared dav_svn is not relinking

Posted by Sander Striker <st...@apache.org>.
> From: trawick@rdu88-250-035.nc.rr.com
> [mailto:trawick@rdu88-250-035.nc.rr.com]On Behalf Of Jeff Trawick
> Sent: 17 April 2002 17:13

> "Sander Striker" <st...@apache.org> writes:
> 
>> Yes, and we should fix it.
> 
> sure
> 
>> This patch works for me.  Not an expert on libtool, so I'd like some feedback.
> 
> As far as I can tell, your patch handles the simple problem #2 but
> leaves the real problem #1 unchanged.

That's probably because I don't have access to the platforms for
which libtool is broken.
 
> If you do libtool --mode=install like we used to do, 
> 
>   LoadModule foo_module modules/mod_foo.so
> 
> won't work on HP-UX, Tru64, AIX (and perhaps some other platforms I
> don't have access to).

I don't think we should break the platforms where libtool --install
works by avoiding it by default.
 
> You'll have to code this on LoadModule
> 
>       modules/libmod_foo.so           (Tru64)
> or
>       modules/mod_foo.sl              (HP-UX)
> or
>       modules/XXX                     (I forget what it was on AIX)
> 
> Not to mention getting stuck with the symbolic links added to the
> modules directory which represent versioning.
> 
> A fairly safe* hack would be:
> 
> 1) look in the .la file and see if the DSO needs to be relinked.  If
>    not, use cp and skip the following steps
> 2) do libtool --install instead of cp
> 3) look in the installed .la for the name that must be passed to
>    dlopen (I think there is such a field) and rename that file in the
>    target directory to what we think a DSO ought to be named
> 4) ignore the extra system-dependent libtool-created files/symlinks in
>    the target directory
> 
> (*only subversion folks suffer with inevitable breakage)
> 
> or, being braver, do this
> 
> 1) always do libtool --install

+1.

> 2) look in installed .la file for the name that must be passed to
>    dlopen and rename that file in the target directory to what we
>    think a DSO ought to be named

But we only need to do that for AIX, Tru64 and HP-UX.

> 3) since this design does libtool --install for every DSO, we need to
>    work hard to zap the extra system-dependent libtool-created
>    files/symlinks in the target directory

But that's not too hard.  We can zap everything not ending with .so,
right?

Sander

Re: FW: shared dav_svn is not relinking

Posted by Jeff Trawick <tr...@attglobal.net>.
"Sander Striker" <st...@apache.org> writes:

> Yes, and we should fix it.

sure

> This patch works for me.  Not an expert on libtool, so I'd like some feedback.

As far as I can tell, your patch handles the simple problem #2 but
leaves the real problem #1 unchanged.

If you do libtool --mode=install like we used to do, 

  LoadModule foo_module modules/mod_foo.so

won't work on HP-UX, Tru64, AIX (and perhaps some other platforms I
don't have access to).

You'll have to code this on LoadModule

      modules/libmod_foo.so           (Tru64)
or
      modules/mod_foo.sl              (HP-UX)
or
      modules/XXX                     (I forget what it was on AIX)

Not to mention getting stuck with the symbolic links added to the
modules directory which represent versioning.

A fairly safe* hack would be:

1) look in the .la file and see if the DSO needs to be relinked.  If
   not, use cp and skip the following steps
2) do libtool --install instead of cp
3) look in the installed .la for the name that must be passed to
   dlopen (I think there is such a field) and rename that file in the
   target directory to what we think a DSO ought to be named
4) ignore the extra system-dependent libtool-created files/symlinks in
   the target directory

(*only subversion folks suffer with inevitable breakage)

or, being braver, do this

1) always do libtool --install
2) look in installed .la file for the name that must be passed to
   dlopen and rename that file in the target directory to what we
   think a DSO ought to be named
3) since this design does libtool --install for every DSO, we need to
   work hard to zap the extra system-dependent libtool-created
   files/symlinks in the target directory

> --- instdso.sh.old    Wed Feb 20 21:11:32 2002
> +++ instdso.sh        Sun Apr 14 13:00:25 2002
> @@ -5,8 +5,9 @@
>  # we use this instead of libtool --install because:
>  # 1) on a few platforms libtool doesn't install DSOs exactly like we'd
>  #    want (weird names, doesn't remove DSO first)
> -# 2) we never want the .la files copied, so we might as well copy
> -#    the .so files ourselves
> +# 2) we never want the .la files copied, so we remove them after
> +#    libtool has installed them.  We need to use libtool to make
> +#    the installed dsos relink properly.
> 
>  if test "$#" != "3"; then
>      echo "wrong number of arguments to instdso.sh"
> @@ -49,7 +50,10 @@
>          $CMD || exit $?
>          ;;
>      *)
> -        CMD="cp .libs/$TARGET_NAME $TARGETDIR/$TARGET_NAME"
> +        CMD="$SH_LIBTOOL --mode=install cp $DSOARCHIVE $TARGETDIR/"
> +        echo $CMD
> +        $CMD || exit $?
> +        CMD="rm -f $TARGETDIR/$DSOBASE.a $TARGETDIR/$DSOBASE.la"
>          echo $CMD
>          $CMD || exit $?
>          ;;
> 

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

[PATCH] instdso.sh, WAS: RE: FW: shared dav_svn is not relinking

Posted by Sander Striker <st...@apache.org>.
Reposting with a [PATCH] subject...

> From: Sander Striker [mailto:striker@apache.org]
> Sent: 14 April 2002 13:24

>> From: trawick@rdu88-250-035.nc.rr.com
>> [mailto:trawick@rdu88-250-035.nc.rr.com]On Behalf Of Jeff Trawick
>> Sent: 13 April 2002 02:44
> 
>> "Sander Striker" <st...@apache.org> writes:
>> 
>> > Since this might be an apxs issue I'm forwarding this here.
>> > Any clues?
>> 
>> Well, we (I) started using instdso.sh instead of libtool --install
>> because with libtool --install
>> 
>> 1) what the user has to code with LoadModule to get mod_foo loaded
>>    varies between operating systems and libtool versions
>> 
>> 2) we get a bunch of crap installed in the lib directory that we don't
>>    need
>> 
>> Obviously somebody found a drawback to this bit of libtool-avoidance.
>> 
>> :( :( :(
> 
> Yes, and we should fix it.

Currently, when you blow away the subversion _build_ directory, mod_dav_svn
stops working, because it isn't being relinked.  I'd rather not have
subversion circumvent apxs to install mod_dav_svn...

> This patch works for me.  Not an expert on libtool, so I'd like some feedback.
> 
> Sander
> 
> --- instdso.sh.old    Wed Feb 20 21:11:32 2002
> +++ instdso.sh        Sun Apr 14 13:00:25 2002
> @@ -5,8 +5,9 @@
>  # we use this instead of libtool --install because:
>  # 1) on a few platforms libtool doesn't install DSOs exactly like we'd
>  #    want (weird names, doesn't remove DSO first)
> -# 2) we never want the .la files copied, so we might as well copy
> -#    the .so files ourselves
> +# 2) we never want the .la files copied, so we remove them after
> +#    libtool has installed them.  We need to use libtool to make
> +#    the installed dsos relink properly.
> 
>  if test "$#" != "3"; then
>      echo "wrong number of arguments to instdso.sh"
> @@ -49,7 +50,10 @@
>          $CMD || exit $?
>          ;;
>      *)
> -        CMD="cp .libs/$TARGET_NAME $TARGETDIR/$TARGET_NAME"
> +        CMD="$SH_LIBTOOL --mode=install cp $DSOARCHIVE $TARGETDIR/"
> +        echo $CMD
> +        $CMD || exit $?
> +        CMD="rm -f $TARGETDIR/$DSOBASE.a $TARGETDIR/$DSOBASE.la"
>          echo $CMD
>          $CMD || exit $?
>          ;;

RE: FW: shared dav_svn is not relinking

Posted by Sander Striker <st...@apache.org>.
> From: trawick@rdu88-250-035.nc.rr.com
> [mailto:trawick@rdu88-250-035.nc.rr.com]On Behalf Of Jeff Trawick
> Sent: 13 April 2002 02:44

> "Sander Striker" <st...@apache.org> writes:
> 
> > Since this might be an apxs issue I'm forwarding this here.
> > Any clues?
> 
> Well, we (I) started using instdso.sh instead of libtool --install
> because with libtool --install
> 
> 1) what the user has to code with LoadModule to get mod_foo loaded
>    varies between operating systems and libtool versions
> 
> 2) we get a bunch of crap installed in the lib directory that we don't
>    need
> 
> Obviously somebody found a drawback to this bit of libtool-avoidance.
> 
> :( :( :(

Yes, and we should fix it.
This patch works for me.  Not an expert on libtool, so I'd like some feedback.

Sander

--- instdso.sh.old    Wed Feb 20 21:11:32 2002
+++ instdso.sh        Sun Apr 14 13:00:25 2002
@@ -5,8 +5,9 @@
 # we use this instead of libtool --install because:
 # 1) on a few platforms libtool doesn't install DSOs exactly like we'd
 #    want (weird names, doesn't remove DSO first)
-# 2) we never want the .la files copied, so we might as well copy
-#    the .so files ourselves
+# 2) we never want the .la files copied, so we remove them after
+#    libtool has installed them.  We need to use libtool to make
+#    the installed dsos relink properly.

 if test "$#" != "3"; then
     echo "wrong number of arguments to instdso.sh"
@@ -49,7 +50,10 @@
         $CMD || exit $?
         ;;
     *)
-        CMD="cp .libs/$TARGET_NAME $TARGETDIR/$TARGET_NAME"
+        CMD="$SH_LIBTOOL --mode=install cp $DSOARCHIVE $TARGETDIR/"
+        echo $CMD
+        $CMD || exit $?
+        CMD="rm -f $TARGETDIR/$DSOBASE.a $TARGETDIR/$DSOBASE.la"
         echo $CMD
         $CMD || exit $?
         ;;

Re: FW: shared dav_svn is not relinking

Posted by Jeff Trawick <tr...@attglobal.net>.
"Sander Striker" <st...@apache.org> writes:

> Since this might be an apxs issue I'm forwarding this here.
> Any clues?

Well, we (I) started using instdso.sh instead of libtool --install
because with libtool --install

1) what the user has to code with LoadModule to get mod_foo loaded
   varies between operating systems and libtool versions

2) we get a bunch of crap installed in the lib directory that we don't
   need

Obviously somebody found a drawback to this bit of libtool-avoidance.

:( :( :(


-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...