Static binaries?
#1
Static binaries?
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?

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
11-30-2018, 03:55 AM
#2
RE: Static binaries?
Linking is controlled by LDFLAGS.
onre
O2

Trade Count: (0)
Posts: 5
Threads: 1
Joined: Nov 2018
Find Reply
11-30-2018, 05:08 AM
#3
RE: Static binaries?
Onre and I found out on discord,

its -Wl,-B, static

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,240
Threads: 533
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
11-30-2018, 06:05 AM
#4
RE: Static binaries?
(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.
jan-jaap
SGI Collector

Trade Count: (0)
Posts: 1,048
Threads: 37
Joined: Jun 2018
Location: Netherlands
Website Find Reply
11-30-2018, 10:07 AM
#5
RE: Static binaries?
(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.
onre
O2

Trade Count: (0)
Posts: 5
Threads: 1
Joined: Nov 2018
Find Reply
11-30-2018, 10:14 AM
#6
RE: Static binaries?
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
mrthinlysliced
Unregistered

Trade Count: (0)
 
Reply
12-16-2018, 10:39 AM


Forum Jump:


Users browsing this thread: 1 Guest(s)