bug-libtool
[Top][All Lists]
Advanced

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

Bug: With --disable-static, when libtool falls back to producing a stati


From: Max Bowsher
Subject: Bug: With --disable-static, when libtool falls back to producing a static archive due to undefined symbols, it produces an empty archive.
Date: Thu, 24 Nov 2005 12:23:41 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050923 Thunderbird/1.0.7 Mnenhy/0.7.2.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

With --disable-static, when libtool falls back to producing a static
archive due to undefined symbols, it produces an empty archive.

The problem is caused because there are no non_pic_objects. Libtool
dutifully scans all referenced .lo files collecting non_pic_object
definitions, but there are none. It then, without complaint, produces an
empty static archive. Then, when something attempts to link to this, the
link fails, due to undefined symbols.

My solution to this is to use the pic_objects if there are no
non_pic_objects. I'm not certain if that is safe in a
platform-independent context, but it works well for me on Cygwin.

Consider also, that it doesn't have to be safe everywhere - only on
platforms which don't support undefined symbols in shared libraries,
which might cause a fallback to occur.

Max.


- --- /usr/share/libtool/ltmain.sh.orig   2005-11-23 22:30:13.901273600
+0000
+++ local-ltmain.sh     2005-10-03 15:11:49.294073600 +0100
@@ -1271,6 +1271,9 @@
                  if test -z "$pic_object" || test "$pic_object" = none
; then
                    arg="$non_pic_object"
                  fi
+               else
+                 # Better to try to use the PIC object than nothing
+                 non_pic_objects="$non_pic_objects $pic_object"
                fi
              else
                # Only an error if not doing a dry-run.
@@ -1788,6 +1791,9 @@
            if test -z "$pic_object" || test "$pic_object" = none ; then
              arg="$non_pic_object"
            fi
+         else
+           # Better to try to use the PIC object than nothing
+           non_pic_objects="$non_pic_objects $pic_object"
          fi
        else
          # Only an error if not doing a dry-run.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)

iD8DBQFDhbDNfFNSmcDyxYARAnGzAKCbTZmiHJc/8+lA0GsyUx2IhJ3NbwCeJpne
LFTwD85OXSRWM21+K8aGkfo=
=64Jk
-----END PGP SIGNATURE-----




reply via email to

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