GNU bug report logs - #13414
Valid DLL def file mangled by libtool

Previous Next

Package: libtool;

Reported by: Martin Doucha <doucha <at> integri.cz>

Date: Fri, 11 Jan 2013 15:54:02 UTC

Severity: normal

Full log


Message #44 received at 13414 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Kahn Gillmor <dkg <at> fifthhorseman.net>
To: 13414 <at> debbugs.gnu.org, control <at> bugs.debian.org, 814951 <at> bugs.debian.org
Subject: [Werner Koch] Re: [pkg-gnupg-maint] Bug#814951: libassuan: add
 libassuan-mingw-w64-dev for cross-building to Windows targets
Date: Sat, 20 Feb 2016 14:29:47 -0500
[Message part 1 (text/plain, inline)]
# for the debian BTS, hopefully this doesn't cause problems for the GNU BTS)
clone 814951 -1
reassign -1 libtool
retitle -1 libtool fails to detect DLL .def file
forwarded -1 https://debbugs.gnu.org/13414
tags -1 = patch upstream
thanks

Over on https://bugs.debian.org/814951, Werner Koch and i are discussing
how https://debbugs.gnu.org/13414 is still a problem with libtool.  In
particular, GNU libtool can't seem to detect that a .def file is valid
unless EXPORT is the literal first line in the file (it chokes when
blank lines or comments precede EXPORT).

Werner supplied the patch below to fix libtool.  The upstream bug
appears to have a rather different set of patches.  Either way, the
problem should be cleaned up in libtool, as it's causing a series of
workarounds for cross-building things on debian for the Windows
platform.

Is there some reason for the delay upstream besides lack of time to work
on it?  Should debian go ahead and apply one of the proposed patches
downstream in the meantime?

    --dkg

[Message part 2 (message/rfc822, inline)]
From: Werner Koch <wk <at> gnupg.org>
To: Daniel Kahn Gillmor <dkg <at> fifthhorseman.net>
Cc: 814951 <at> bugs.debian.org
Subject: Re: [pkg-gnupg-maint] Bug#814951: libassuan: add libassuan-mingw-w64-dev for cross-building to Windows targets
Date: Wed, 17 Feb 2016 09:22:05 +0100
On Wed, 17 Feb 2016 00:11, dkg <at> fifthhorseman.net said:

> ++++ b/src/libassuan.def
> +@@ -1,3 +1,4 @@
> ++EXPORTS
> + ; assuan.def - List of symbols to export.

That is for sure a bug in libtool.  I fixed that years ago but it didn't
made into into libtool upstream because they where revamping the entire
thing.  Seems this or a new bug is still present.  Find below for
reference the patch used for libgpg-error which has also been ported to
all GnuPG related libraries.  FWIW, I have also another libtool fix to
support Android.


Salam-Shalom,

   Werner


--8<---------------cut here---------------start------------->8---
commit dd05f3790e536dec6ed56087780a1065ca66371e
Author: Werner Koch <wk <at> gnupg.org>
Date:   Thu Apr 18 14:40:43 2013 +0200

    Fix libtool 2.4.2 to correctly detect .def files.
    
    * ltmain.sh (sed_uncomment_deffile): New.
    (orig_export_symbols): Uncomment def file before testing for EXPORTS.
    * m4/libtool.m4: Do the same for the generated code.
    --
    
    The old code was not correct in that it only looked at the first line
    and puts an EXPORTS keyword in front if missing.  Binutils 2.22
    accepted a duplicated EXPORTS keyword but at least 2.23.2 is more
    stringent and bails out without this fix.
    
    There is no need to send this upstream.  Upstream's git master has a
    lot of changes including a similar fix for this problems.  There are
    no signs that a libtool 2.4.3 will be released to fix this problem and
    thus we need to stick to our copy of 2.4.2 along with this patch.
    
    Signed-off-by: Werner Koch <wk <at> gnupg.org>

diff --git a/ltmain.sh b/ltmain.sh
index c7d06c3..24e3fd3 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -411,6 +411,10 @@ sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
 # (escaped) backslashes.  A very naive implementation.
 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
 
+# Sed substitution to remove simple comments and empty
+# lines from a Windows .def file.
+sed_uncomment_deffile='/^;/d; /^[ ]*$/d'
+
 # Re-`\' parameter expansions in output of double_quote_subst that were
 # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
 # in input to double_quote_subst, that '$' was protected from expansion.
@@ -8143,7 +8147,7 @@ EOF
 	cygwin* | mingw* | cegcc*)
 	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
 	    # exporting using user supplied symfile
-	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+	    if test "x`$SED "$sed_uncomment_deffile" $export_symbols | $SED 1q`" != xEXPORTS; then
 	      # and it's NOT already a .def file. Must figure out
 	      # which of the given symbols are data symbols and tag
 	      # them as such. So, trigger use of export_symbols_cmds.
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 4bedbd3..ff871a0 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -4773,7 +4773,7 @@ _LT_EOF
         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
 	# If the export-symbols file already is a .def file (1st line
 	# is EXPORTS), use it as is; otherwise, prepend...
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
 	  cp $export_symbols $output_objdir/$soname.def;
 	else
 	  echo EXPORTS > $output_objdir/$soname.def;
@@ -5150,7 +5150,7 @@ _LT_EOF
 	shrext_cmds=".dll"
 	# FIXME: Setting linknames here is a bad hack.
 	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
 	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
 	  else
 	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
@@ -6149,7 +6149,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	  shrext_cmds=".dll"
 	  # FIXME: Setting linknames here is a bad hack.
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
 	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
 	    else
 	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
@@ -6190,7 +6190,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
 	    # If the export-symbols file already is a .def file (1st line
 	    # is EXPORTS), use it as is; otherwise, prepend...
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED \"$sed_uncomment_deffile\" $export_symbols | $SED 1q`" = xEXPORTS; then
 	      cp $export_symbols $output_objdir/$soname.def;
 	    else
 	      echo EXPORTS > $output_objdir/$soname.def;
--8<---------------cut here---------------end--------------->8---


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 9 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.