[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ITS#3977 libtool 1.5.18 and installed libraries

Hi Howard, others,

Sorry for the long response delay.

* Howard Chu wrote on Mon, Aug 29, 2005 at 07:54:27AM CEST:
> The attached patch appears to fix the problem with libtool-1.5.18 
> mistreating installed libtool libraries. The documentation indicates 
> that linking a program with "-static" should only statically link 
> un-installed libtool libraries, but libtool was ignoring their installed 
> status and always statically linking them. This patch tweaks 
> prefer_static_libs to distinguish between the -static and -all-static 
> cases so that the link step can actually perform as documented.

I have tested this patch a bit, and forward-ported it to CVS HEAD, see

In another related mail you wrote:

| Something I didn't test properly yet is what happens if the executable
| needs to be relinked at install time. Since the just-built libraries
| will most likely be installed before the exe is relinked, it seems to me
|  it may foul up. (But my SuSE system didn't need relinking; will have
| to try again on a different platform to see.)

Erm, AFAICS the use of `-static' would exactly mean that relinking would
not be necessary.  Right?

I'll wait a couple of days more and test on AIX before comitting.


2005-09-xx  Howard Chu  <hyc@highlandsun.com>

        * libltdl/config/ltmain.m4sh (func_mode_link):
        With `-static', only link statically against uninstalled
        libtool libraries.  Fixes 1.5.x regression to match documented
        * NEWS: Updated.

Index: NEWS
RCS file: /cvsroot/libtool/libtool/NEWS,v
retrieving revision 1.183
diff -u -r1.183 NEWS
--- NEWS	23 Aug 2005 01:49:36 -0000	1.183
+++ NEWS	25 Sep 2005 11:10:52 -0000
@@ -13,6 +13,8 @@
 * Detection of compiler wrappers like distcc/ccache and $host_alias prefix.
 * Initial Support for FC (modern Fortran).
 * Fixed a regression that prevented use of libltdl without autotools.
+* Fixed a branch-1-5/HEAD regression to only link uninstalled libraries
+  statically with `-static'.
 New in 1.9h: 2004-??-??; CVS version 1.9g, Libtool team:
 * Bug fixes.
Index: libltdl/config/ltmain.m4sh
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.11
diff -u -r1.11 ltmain.m4sh
--- libltdl/config/ltmain.m4sh	25 Sep 2005 07:35:58 -0000	1.11
+++ libltdl/config/ltmain.m4sh	25 Sep 2005 11:07:42 -0000
@@ -2218,14 +2218,15 @@
 	    compile_command="$compile_command $link_static_flag"
 	    finalize_command="$finalize_command $link_static_flag"
+	  prefer_static_libs=yes
 	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	  prefer_static_libs=built
-	prefer_static_libs=yes
@@ -3598,8 +3599,12 @@
 	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes; then
+	  use_static_libs=no
+	fi
 	if test -n "$library_names" &&
-	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
 	  case $host in
 	  *cygwin* | *mingw*)
 	      # No point in relinking DLLs because paths are not encoded