Re: static executable, can't open $DISPLAY



Ian Britten <britten caris com> writes: 
> [ If you can't/shouldn't link libc in statically, how to most people create
> static executables?  If the problem is as you describe, then it would seem
> that the -static GCC option is useless/dangerous... ]
> 

Yes, it basically is useless/dangerous.

The problem is that libc (and perhaps Xlib) have runtime dependencies,
such as the location of certain data files and dynamically-loadable
modules. So the code you've linked in statically expects to find them
wherever they were on the system you compiled on. But on the user's
system they may or may not be there.

GTK also wants to see data files, etc. though working around this is 
perhaps easier than with libc/Xlib.

I think it's often easier to build your dependency libraries with a
--prefix such as "--prefix=/opt/myapplication/" and then 
wrap your app in a shell script that sets LD_LIBRARY_PATH to include
/opt/myapplication/lib, and have people run the script; then you can
include all the data files and stuff.

We want to enhance GTK to be able to avoid runtime dependencies if
compiled in a certain way (configure --standalone or something), but
it's not on any near-term schedule unless someone provides a patch...

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]