[tex-live] libstdc++ linking
Karl Berry
karl at freefriends.org
Sun Aug 14 23:35:34 CEST 2005
Hi Staszek, and all,
It isn't pretty, but I managed to get a build of the lcdf binaries with
libstdc++ (but not libc) statically linked, by running our build script
with CXX set:
CXX=cxxhack Build
where cxxhack is a one-line script:
exec gcc "$@" -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lm
Can you give that a try? For now, I checked in the i386-linux lcdf
binaries I built on tug.org using this.
Some of the output from configure looked doubtful ("no -lstdc++"), but
the binaries (including pdfetex) can do --help, anyway. I didn't try to
actually do anything real.
Explanation: it turns out that (incredibly annoyingly) g++ does not use
the specs file to determine the final link command -- the stdc++ part is
hardwired into the binary, and no environment variable or runtime
configuration can change it, as far as I could see. Thus, the idea is
to use gcc instead of g++ or c++ for the front-end compiler, and link
with -lstdc++ ourselves. g++ automatically links with -lm, so we do
that too.
Perhaps there is a cleaner way to alter the lcdf configure setup to
achieve the same link line, but I could not find it offhand. I wrote to
bug-automake for advice. If anyone has any ideas, so much the better.
For the record, this web page:
http://www.trilithium.com/johan/2005/06/static-libstdc/
has more details and a warning that static linking with libstdc++ can
still fail in the face of various exception-related stuff. I sincerely
hope that won't be an issue for us.
Thanks,
Karl
More information about the tex-live
mailing list