Static binaries? -
Raion - 11-30-2018
Okay, I'm thoroughly out of my depth here.
I've been trying to figure out on IRIX how to build a static shell (mksh and tcsh 6.20 - replacing the old and buggy shell versions) and I'm not able to for some reason.
Many of these don't have a static configure option so I've tried:
gmake SHARED=0 CC=c99 CFLAGS=-static
That will pass -static with c99 to the binary, but....
ldd tcsh
libcurses.so => /usr/lib32/libcurses.so
libc.so.1 => /usr/lib32/libc.so.1
Meanwhile, I can't find with nm any dynamic symbols.
So what should I believe here? And am I just a moron who overlooked something?
RE: Static binaries? -
onre - 11-30-2018
Linking is controlled by LDFLAGS.
RE: Static binaries? -
Raion - 11-30-2018
Onre and I found out on discord,
its -Wl,-B, static
RE: Static binaries? -
jan-jaap - 11-30-2018
(11-30-2018, 06:05 AM)Raion Wrote: Onre and I found out on discord,
its -Wl,-B, static
IIRC, a binary is never truly static because there is no static libc. I believe this is because parts of the runtime dynamic linker are in libc.so on IRIX.
As a side effect of this, you cannot have /lib as a separate filesystem, because /lib/libc.so must be available as soon as the rootfs is mounted or 'init' won't be able to run.
RE: Static binaries? -
onre - 11-30-2018
(11-30-2018, 10:07 AM)jan-jaap Wrote: IIRC, a binary is never truly static because there is no static libc. I believe this is because parts of the runtime dynamic linker are in libc.so on IRIX.
Yes, that's correct. We noticed the same - truly static is not possible on IRIX.
RE: Static binaries? - mrthinlysliced - 12-16-2018
Hey Guys,
Late to the part of course, but maybe someone might find it useful - the way I built my static wget and md5sum was:
(1) Build the package in the usual way but echo the build actions (--disable-silent-rules on the configure line for auto-tools projects)
(2) Look in the output where it's linking the thing you want a statically linked executable of
(3) Rebuild the link line so that it references "libssl.a" instead of "libssl.so"
(4) Use ldd to re-assure myself it's only expected system libs linked (e.g. libc, pthread)
It's been a while since I did this, but I think I had to tweak some switches like you mentioned above too.
Cheers,
Mr TS