Subject: a libtool + Mac OS X problem

From: Peter Breitenlohner <[email-masked]>
Date: Mon, 2 May 2011 17:41:15 +0200 (CEST)

Hi,

For a (static and/or shared) library libtool knows if and how that library
can be stripped, e.g.,

   for linux (ELF in general?)
     old_striplib="strip --strip-debug"
     striplib="strip --strip-unneeded"

   for mingw32 (cross)
     old_striplib="i386-pc-mingw32-strip --strip-debug"
     striplib="i386-pc-mingw32-strip --strip-unneeded"

   for darwin
     old_striplib="strip -S"
     striplib="strip -x"

====================

When linking a program that wants to dlopen() an extension module, I use
"libtool --mode=link gcc ... --export dynamic", e.g.,

   for linux
     export_dynamic_flag_spec="\${wl}--export-dynamic"

   for mingw32
     export_dynamic_flag_spec="\${wl}--export-all-symbols"

   for darwin
     export_dynamic_flag_spec=""

with no effect on Mac OS X

====================

When I finally use "make install-strip" to install that program, that works
fine on linux, because the ELF binary knows the global symbols even when the
the binary has been stripped.

However, this fails on Mac OS X, there the binary should be stripped with
'strip -S -x' or some such to keep the global symbols and not with plain
'strip' as done via (Automake) "make install-strip".

And there may, of course, be other non-ELF systems with the same problem.

IMHO, in such cases libtool should create a wrapper script even when not
linking against uninstalled shared libraries, and that warpper script should
cause "libtool --mode=install install -s ..." to use the required options
for strip.

Regards
Peter Breitenlohner <[email-masked]>