1

I want to build screen static, so that I can use it as standalone binary on embed devices.

screen-4.2.1# ./configure LDFLAGS="-static" && make

I got this warning:

/screen.c:933: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

the reason for this is answered over here. So it is not possible to use "getpwnam" an some other functions out of glibc within a static linked binary, if i understand this right.

So my question is. Is there any way to build screen static (because I'm actually cant believe there isn't), and if not is there a good replacement which can be build static?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
meamy
  • 13
  • 3

1 Answers1

3

Is there any way to build screen static

Sure: just ignore the warning and voila, you have a fully-static screen.

Now, that fully-static screen will not work when moved to a system with different version of GLIBC, and so is useless for that purpose.

In general, contrary to popular belief, fully-static binaries are less portable than dynamic ones on UNIX systems. Your desire to build such fully-static binary is very likely misguided.

if not is there a good replacement which can be build static?

You could try using alternate libc implementations, such uClibc or dietlibc, which may not place such a restriction on fully-static binaries.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • I've had reasonable results so far with ignoring the warning - it has worked better than NOT compiling static for me. When you say non-static is more portable - could you explain that a bit more? Is there more that needs to be done besides just compiling and copying the binary to the system you need it on? – Chris Dec 18 '21 at 13:05
  • @chrisputnam9 You can ask a separate question (it's free to ask). – Employed Russian Dec 18 '21 at 16:54