This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: segfault if static linked


On Fri, 2004-06-11 at 12:44, Clemens Eisserer wrote:
> If I link an app with the -static flag ( a simple one-line app with no lexternal libs...),
> I get the following warnings:
> 
[...]
> : Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
[...]

In order to make glibc support static linking you have to build a
special version using the "--enable-static-nss" configure option,
and this will render name service support less functional (fully
statically linked binaries will only do the "files" and "dns"
part of what you configured in nsswitch.conf).

I have never found out why the name service support is so seriously
... hmh ... complicated (avoiding the word "broken"). Once, I'll have
to check who wrote this part of the library and send him a big
"thank you for all the hassles". Well, one shouldn't complain about
free stuff ...

> If I start the resulting executable now, I get a segfault :-(

Hmh, if you get a segfault on the system you actually built the binary
on then there's probably another problem, too, since usually statically
linked binaries (without using a --enable-static-nss built glibc) work
well as long as they are running on a system with the same glibc version
available (which renders static linking useless, of course).

BTW: Statically linked gcj compiled binaries will suffer from other
problems, too - part of the libgcj is not necessarily explicitly
referenced and therefore not every class which is used is necessarily
included by the linker ... 

Best regards,
Tom
----------------------------------------------------------------------------
Thomas Aeby, Kirchweg 40, 1735 Giffers, Switzerland, Voice : (+41)26
4180040
Internet: aeby@graeff.com                           PGP public key
available
----------------------------------------------------------------------------
Nature can kill you, but only people make you cry.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]