Hi Keith, others, Sorry for the response latency. This is a status update for the -sobase patch: http://lists.gnu.org/archive/html/libtool/2005-07/msg00093.html.
* Keith Packard wrote on Mon, Jul 11, 2005 at 09:55:47PM CEST: > On Mon, 2005-07-11 at 13:58 +0200, Ralf Wildenhues wrote: > > > Re-reading this thread, I would be inclined to accept a patch which > > implements your original proposal, given that a way can be found how it > > degrades gracefully on the different/not-so-flexible shared library > > systems mentioned. That is, unless the other maintainers oppose. > > Ok, I've created a '-sobase' option in link mode and tested it on > GNU/Linux. It changes the -soname option passed to the linker so that > instead of using ${libname} for the first part of the soname, it uses > the -sobase parameter. It also includes this generated name as one of > the library_names so that when the library is installed, a symlink to > the soname is made. Hmm. I've started a test suite test to go along with this, so that we can actually make sure this works as expected, and also do not gratuitously break installed .la files and linking against them. I am a little stuck, however. Maybe someone else can provide input (be sure to read all the way to the AIX case, however): Your patch changes library_names in the .la file to also include a name for the different sobase. You don't, however, add the unversioned name, thus the unversioned link also is not generated. Isn't this what you wanted instead? (see also in the test below) Furthermore, libtool expects the last name in library_names to be the unversioned name, i.e., the one to link against. The deplib search code needs adjusting to this (basically the places where library_names is read from an already-written .la file). I believe this is the reason that the test currently fails (on linux, solaris) because it forgets to put the rpath information in main_static, in case we link against the lib which links against the "-sobase"-treated lib: Libtool does not walk its dependency chain. I haven't completely checked either that libtool implicitly assumes that the base name of all words in $library_names is the same. We /might/ be able to limit ourselves to allowing just one of the names to link to. In any case, the way the result works still needs to be documented. Tested on: GNU/Linux/x86_64, Solaris/{gcc,Sun cc}/Solaris ld. AIX is a completely different matter yet: it can have dynamic archives ending in ".a" (with soname ending in ".so"). Here, your patch breaks already while creating libtestB.la -- we can't mix the "library names" and "soname" concepts so easily here (As a followup error, the test seems to bogusly cause removal of the uninstalled .la files -- bad). I have not tested win32 nor Darwin yet, but expect them to be on a similar fun level as AIX. (As a minor detail, the test, being unfinished, is also missing proper initialization for some tools). Cheers, Ralf Index: Makefile.am =================================================================== RCS file: /cvsroot/libtool/libtool/Makefile.am,v retrieving revision 1.155 diff -u -r1.155 Makefile.am --- Makefile.am 8 Aug 2005 09:23:57 -0000 1.155 +++ Makefile.am 9 Aug 2005 07:43:42 -0000 @@ -301,6 +301,7 @@ tests/stresstest.at \ tests/link-order.at \ tests/convenience.at \ + tests/sobase.at \ tests/template.at EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) tests/package.m4 Index: tests/testsuite.at =================================================================== RCS file: /cvsroot/libtool/libtool/tests/testsuite.at,v retrieving revision 1.15 diff -u -r1.15 testsuite.at --- tests/testsuite.at 30 Apr 2005 09:30:14 -0000 1.15 +++ tests/testsuite.at 9 Aug 2005 07:43:42 -0000 @@ -93,6 +93,8 @@ m4_include([convenience.at]) # link order test m4_include([link-order.at]) +# sobase test +m4_include([sobase.at]) # Torturing subdir-objects builds m4_include([am-subdir.at]) # C++ templates tests --- /dev/null 2005-08-03 12:45:51.659987528 +0200 +++ tests/sobase.at 2005-08-09 07:39:29.000000000 +0200 @@ -0,0 +1,90 @@ +# Hand crafted tests for GNU Libtool. -*- Autotest -*- +# Copyright 2005 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# Test the -sobase option. +# Note: This test and feature are experimental. + +AT_SETUP([Link with -sobase]) +eval `$LIBTOOL --config | $EGREP '^(CC|objdir)='` +instdir=$abs_top_builddir/tests/sobase-instdir +: ${INSTALL="$abs_top_srcdir/config/install-sh"} +: ${RM='rm -f'} +: ${LN_S='ln -s'} + +$RM -r "$instdir" + +echo 'int a(void) { return 1; }' > a.c +echo 'extern int a(void); +int b(void) { return a(); }' > b.c +echo 'extern int b(void); +int c(void) { return b(); }' > c.c + +AT_DATA(main.c, +[[extern int c(void); +int main(void) { return c() != 1; } +]]) + +$LIBTOOL --mode=compile $CC $CFLAGS -c a.c +$LIBTOOL --mode=compile $CC $CFLAGS -c b.c +$LIBTOOL --mode=compile $CC $CFLAGS -c c.c +$LIBTOOL --mode=compile $CC $CFLAGS -c main.c +$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libtestA.la a.lo -rpath "$instdir" +$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libtestB.la b.lo ./libtestA.la -rpath "$instdir" \ + -sobase libtestB2 +$LIBTOOL --mode=install $INSTALL libtestA.la "$instdir"/libtestA.la +$LIBTOOL --mode=install $INSTALL libtestB.la "$instdir"/libtestB.la +# now the hack (linux-specific): +( cd "$instdir" && $LN_S libtestB2.so.0 libtestB2.so ) +$LIBTOOL --mode=clean $RM libtestA.la +$LIBTOOL --mode=clean $RM libtestB.la +$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libtestC.la c.lo -rpath "$instdir" -L"$instdir" -ltestB +$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libtestD.la c.lo -rpath "$instdir" -L"$instdir" -ltestB2 + +AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.lo ./libtestC.la], + [0],[ignore],[ignore]) +LT_AT_EXEC_CHECK([./main]) +AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o main_static main.lo ./libtestC.la], + [0],[ignore],[ignore]) +LT_AT_EXEC_CHECK([./main_static]) + +$LIBTOOL --mode=install $INSTALL libtestC.la "$instdir"/libtestC.la +AT_CHECK([$LIBTOOL --mode=install $INSTALL main "$instdir"/main], + [0],[ignore],[ignore]) +LT_AT_EXEC_CHECK(["$instdir"/main]) +AT_CHECK([$LIBTOOL --mode=install $INSTALL main_static "$instdir"/main_static], + [0],[ignore],[ignore]) +LT_AT_EXEC_CHECK(["$instdir"/main_static]) + + +AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main main.lo ./libtestD.la], + [0],[ignore],[ignore]) +LT_AT_EXEC_CHECK([./main]) +AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -static -o main_static main.lo ./libtestD.la], + [0],[ignore],[ignore]) +LT_AT_EXEC_CHECK([./main_static]) + +$LIBTOOL --mode=install $INSTALL libtestD.la "$instdir"/libtestD.la +AT_CHECK([$LIBTOOL --mode=install $INSTALL main "$instdir"/main], + [0],[ignore],[ignore]) +LT_AT_EXEC_CHECK(["$instdir"/main]) +AT_CHECK([$LIBTOOL --mode=install $INSTALL main_static "$instdir"/main_static], + [0],[ignore],[ignore]) +LT_AT_EXEC_CHECK(["$instdir"/main_static]) + +$RM -r "$instdir" # FIXME: check uninstall too. +AT_CLEANUP _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool