[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: preparing for 1.5.24
From: |
Charles Wilson |
Subject: |
Re: preparing for 1.5.24 |
Date: |
Sat, 17 Feb 2007 17:35:56 -0500 |
User-agent: |
Thunderbird 1.5.0.9 (Windows/20061207) |
Ralf Wildenhues wrote:
I would like to release 1.5.24 as soon as possible. I've flushed my
queue now, except for the patch I just posted and whatever w32 changes
are still needed.
FWIW, I've done a test run of branch-1-5, here's some results:
PASS SKIP FAIL config.guess compiler used notes
----------------------------------------------------------------------------
110 1 1 i686-pc-cygwin gcc, g++, g77 fail: mdemo2-make
confirmed (1.5.23c, about two hours ago). I've diagnosed the reason and
have a patch -- but I'm not sure if it should be applied. I don't
consider this a showstopper for 1.5.24, regardless of whether the
attached patch is accepted or not.
- It would help me greatly if someone could look into the Cygwin and
MinGW mdemo* failures; and documentation updates if needed.
I believe the mdemo2 failure on cygwin is another ripple from the ltdl
declspec() change. mlib uses libltdlc as convenience library, so when
linking cygmlib-0.dll there exist symbols (lt_*) that are declared
declspec(dllexport) -- so autoexport is turned off. However, the
symbols in mlib.c are NOT marked in that way (see mdemo/README snippet,
[1]), so without autoexport, the output dll contains only lt_* symbols
-- and mlib_func is missing.
Solution in this case is to turn auto-export back on (earlier
suggestions conerning "define LT_SCOPE before #inluding ltdl.h" won't
work, because we're linking in the ltdl.o object that was already built
as "PIC" (==-DDLL_EXPORT), and LT_SCOPE has already ended up as
declspec(dllexport) in that ltdl.o.
It'd be nice to be able to say "whenever libltdl is used as a
convenience library to build a DLL, on windows libtool should
automatically turn on --export-all-symbols". But that isn't true: if
the target DLL is already doing explicit declspec(dllexport), then (1)
the target library would work, today, without any changes, and (2) we
don't want to override that target DLL's explicit export settings by
saying, "no, I'm going to export everything".
So, I'm not sure how to solve this, in a way that is platform-agnostic.
(short of undoing the -DDLL_EXPORT change, like Ralf wants to. But I
won't rehash that argument, except to say that this problem would
persist on mingw even if we "fixed" cygwin in that way)
A non-platform-agnostic mechanism could be described as:
----------------------------------------
When building a DLL on Windows (==MinGW,Cygwin) that uses libltdl as a
convenience archive, you must do one of two things:
(1) explicitly mark as declspec(dllexport) all symbols in _your_
library that should be exported when building your library's
source code -- but do NOT mark them dllexport when building
clients; this procedure will require much macro magic in
your library's public header files, or
(2) use the (win32-specific) linker option
"-Xlinker --export-all-symbols"
to restore the expected "auto-export" behavior on windows.
This will require some configure magic, as other platforms'
linkers will not recognize this option. See mdemo/configure.ac
and mdemo/Makefile.am for an example.
----------------------------------------
I used #2 in the attached patch, for the mdemo/mdemo2 issue.
FWIW, it doesn't appear that libtool's -export-dynamic will do the right
thing here. I thought about setting export_dynamic_flag_spec to
'${wl}--export-all-symbols' for mingw/cygwin (currently, they inherit
the generic '${wl}--export-dynamic' setting [3]), and then using
'-export-dynamic' in libmlib_la_LDFLAGS for all platforms.
But I'm nervous about changing the definition of
export_dynamic_flag_spec -- because that would have wide-ranging
effects. Esepcially in a release candidate, and especially especially
in the RC for the last-ever 1.5.x libtool.
Anyway, with the attached patch, all tests pass on cygwin.
--
Chuck
[1] mdemo README:
Note that on Windows, for the purposes of illustrating ltdl, the
libraries *are* built as dll's, but do not have the __declspec
machinery to make them suitable for loading at link time. This is
only for clarity inside this example, look at the example in ../demo
to see how the __declspec macros should be set up.
[2] BTW, ../demo does not set up any __declspec macros. I believe the
readme snippet above is really old, and pre-dates
auto-export/auto-import functionality. At best, this snippet is now
specific only to non-gcc on Windows, which is at present only barely
supported in libtool-1.5.x anyway. Notwithstanding my reference to this
snippet in the context of libltdl-as-convenience-lib, I think this
snippet should be deleted entirely.
[3] I'm not sure, but it looks like cygwin's ld simply ignores
--export-dynamic. From a brief look at the bfd/ld source code, this ld
option seems to be ELF-specific.
2007-02-17 Charles Wilson <...>
* mdemo/configure.ac: add platform-specific variable
RESTORE_AUTOEXPORT, and define appropriately on mingw
and cygwin.
* mdemo/Makefile.am: use RESTORE_AUTOEXPORT when linking
libmlib.
diff -urN origsrc/libtool/mdemo/Makefile.am src/libtool/mdemo/Makefile.am
--- origsrc/libtool/mdemo/Makefile.am 2006-02-03 04:37:34.000000000 -0500
+++ src/libtool/mdemo/Makefile.am 2007-02-17 16:44:10.375000000 -0500
@@ -21,7 +21,7 @@
libmlib_la_SOURCES = mlib.c
libmlib_la_LIBADD = @LIBLTDL@ "-dlopen" foo1.la "-dlopen" libfoo2.la
-libmlib_la_LDFLAGS = -no-undefined
+libmlib_la_LDFLAGS = -no-undefined $(RESTORE_AUTOEXPORT)
libmlib_la_DEPENDENCIES = @LIBLTDL@ libsub.la foo1.la libfoo2.la
noinst_HEADERS = foo.h
diff -urN origsrc/libtool/mdemo/configure.ac src/libtool/mdemo/configure.ac
--- origsrc/libtool/mdemo/configure.ac 2005-04-22 05:05:43.000000000 -0400
+++ src/libtool/mdemo/configure.ac 2007-02-17 16:42:47.843750000 -0500
@@ -71,6 +71,15 @@
AC_CHECK_LIBM
AC_SUBST([LIBM])
+case $host_os in
+cygwin* | mingw* | pw32*)
+ RESTORE_AUTOEXPORT="-Xlinker --export-all-symbols"
+ ;;
+*)
+ RESTORE_AUTOEXPORT=
+ ;;
+esac
+AC_SUBST(RESTORE_AUTOEXPORT)
## -------- ##
## Outputs. ##