Hello Charles,
Charles Wilson writes:
- It would help me greatly if someone could look into the Cygwin and
MinGW mdemo* failures; and documentation updates if needed.
Solution in this case is to turn auto-export back on
Or to mark all symbols as to be exported, no?
(Or to mark all other symbols explicitly. But let's not go that way.)
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".
ACK.
So, I'm not sure how to solve this, in a way that is platform-agnostic.
I think the patch below should work, and be platform-agnostic. WDYT?
OK for branch-1-5 and HEAD alike? It fixes the similar failure there.
Do you think we should add some documentation bits a la "if you have the
same problem, consider this solution as well"?
(FWIW, on HEAD there are other mdemo test failures which I haven't looked
at yet.)
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.
I don't think -export-dynamic is intended to have the semantics of
--export-all-symbols.
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.
I guess I should have written "the last 1.5.x release, unless serious
issues show up". When writing, the intention was more of a "after this,
we work towards 2.0" then anything else.
[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.
Indeed. I guess for branch-1-5 it should be removed. For HEAD and
eventual MSVC support, those would need to be added again.
[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.
I guess. I don't know what its effect on Cygwin should be though.
Not --export-all-symbols, that's not the right thing.
Cheers, and thank you,
Ralf
* mdemo/Makefile.am (libmlib_la_LDFLAGS): Add -export-symbols-regex
".*" because the convenience libltdl uses export markers and thus
turns off autoexport on w32. Fixes test failures for Cygwin and
MinGW. Bug analysis by Charles Wilson.
Index: mdemo/Makefile.am
===================================================================
RCS file: /sources/libtool/libtool/mdemo/Attic/Makefile.am,v
retrieving revision 1.46.2.2
diff -u -r1.46.2.2 Makefile.am
--- mdemo/Makefile.am 3 Feb 2006 09:37:34 -0000 1.46.2.2
+++ mdemo/Makefile.am 18 Feb 2007 12:07:21 -0000
@@ -19,9 +19,12 @@
libsub_la_SOURCES = sub.c
libsub_la_LDFLAGS = -no-undefined
+## Use -export-symbols-regex here explicitly because libltdl marks
+## its exported symbols, and we use libltdl as a convenience archive.
+## Thus, on w32, auto-exporting is turned off.
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 -export-symbols-regex ".*"
libmlib_la_DEPENDENCIES = @LIBLTDL@ libsub.la foo1.la libfoo2.la
noinst_HEADERS = foo.h