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

NT, mingw32, dlltool, libtool

Just a heads-up for anyone working with NT and cygwin... We'll be sending a
similar note to the libtool maintainers as well.

-----Original Message-----
From: Jon Leichter [mailto:jon@symas.com]
Sent: Thursday, December 09, 1999 5:53 PM
To: Howard Chu
Subject: Damn libtool


I recently updated my cygwin compiler and tools from 2.95 to 2.95.2.
(Actually, as you may remember, I was going to be changing my environment to
use Mingw32 native tools, but I've realized in the end that this is more
trouble than it's worth. I'm back to Cygwin tools with Mingw32 support -
really the best way).

In any event, the 'new' version of the 'dlltool' does something different
before. If you have a symbol that is data (opposed to a function), the .def
file that dlltool generates looks something like this:

symbol @ 1 DATA ;

opposed to before:

symbol @ 1 ;

Well, this poses a bit of a problem for libtool when it executes commands to
build a DLL. For some reason, libtool insists on generating a .def file via
dlltool and then manually regenerating it a second time, possibly to be
stripping comments, or something like that. In the processo of regenerating
new .def file, libtool first tries to extract only the name of each symbol,
executing the following sed command.

  sed -e 's/ @ [0-9]* ; *//'

This command will miss lines where the DATA tag has been included. The sed
command is part of OpenLDAP's libtool, which is generated from OpenLDAP's
ltconfig, which is a copy of the ltconfig that comes with libtool 1.3.3.

Since OpenLDAP maintains its own copy of ltconfig, I think the fix should go
in there. I've changed the sed command to be:

  sed -e 's/ @ [0-9]*.*; *//'

However, perhaps this would be better:

  sed -e 's/ @.*$//'

By the way, I've checked libtool 1.3.4, and it has the same problem.
I should file a bug to the libtool guys.

Here's the diff that I want to check in. Let me know what you think:

diff -u -r1.1.1.1 ltconfig
--- ltconfig    1999/07/18 02:56:17
+++ ltconfig    1999/12/10 01:34:08
@@ -1167,7 +1167,7 @@
     export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^#
ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //;
p; }" -e d < $0 > $objdir/$soname-ltdll.c~
       test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c
       $DLLTOOL --export-all --exclude-symbols
DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def
$objdir/$soname-def  $objdir/$soname-ltdll.$objext $libobjs $convenience~
-      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def >
+      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*.*; *//" < $objdir/$soname-def >

     archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~

Jon Leichter