[tlbuild] Stripping the luatex binary

Peter Breitenlohner peb at mppmu.mpg.de
Fri Apr 1 11:18:14 CEST 2011


On Thu, 31 Mar 2011, Philipp Stephani wrote:

> Yes. Both ld and strip on both Linux and OS X (probably inherited by BSD)
> have the options -S (strip debugging symbols) and -x (strip local
> symbols).  The long options such as --strip-debug are only available for
> the GNU toolchain.

Hi Philipp,

first some background:

(1) the current TL build system uses Autoconf, Automake, and Libtool.

(2) luatex and pdftex use the libtool library libkpathsea, usually from the
TL build tree but in principle an installed (static or shared) version could
also be used.

(3) thus "libtool --mode=link" is used to build the binaries, for luatex
with '--export-dynamic' but for pdftex without, and "libtool --mode=install"
to install them.

(4) Autoconf likes to compile with '-g' unless the user specifies CFLAGS (or
CXXFLAGS).

(5) the programs are stripped upon installation when this is done via "make
install-strip" and it seems this is always done with '-s'.

To see how all this works for i686-linux-gnu (and probably linux in general)
I have inspected the unstripped versions in the build tree as well as the
stripped installed ones with 'nm' and grepped for 'write_png':

 	unstripped luatex or pdftex:	one 'T write_png'
 	stripped luatex or pdftex:	nothing

Next I have grepped the output of 'strings':

 	unstripped or stripped luatex:	two times 'write_png'
 	unstripped or stripped pdftex:	nothing

My conclusion: the '--export-dynamic' causes libtool to tell the GNU ld to
keep the global symbols, e.g. 'write_png', as seen by 'strings', and I
suppose that suffices (untested) to resolve them in dlopen'ed modules.

If all that doesn't work for OS X, this is IMHO a libtool + OS X problem
(either the OS X ld doesn't have the required capabilities or libtool
doesn't invoke them correctly).

Regards
Peter Breitenlohner <peb at mppmu.mpg.de>


More information about the tlbuild mailing list