← Back to context

Comment by fc417fc802

11 hours ago

Well not a static binary in the sense that's commonly meant when speaking about static linking. But you can pack .so files into the executable as binary data and then dlopen the relevant memory ranges.

Yes, that's true.

But I'm always a bit sceptical about such approaches. They are not universal. You still need glibc/musl to be the same on the target system. Also, if you compile againt new glibc version, but try to run on old glibc version, it might not work.

These are just strange and confusing from the end users' perspective.

  • > But I'm always a bit sceptical about such approaches. They are not universal. You still need glibc/musl to be the same on the target system. Also, if you compile againt new glibc version, but try to run on old glibc version, it might not work.

    Why would you include most of your dynamic libraries but not your libc?

    You could still run into problems if you (or your libraries) want to use syscalls that weren't available on older kernels or whatever.

    • You can include it, but

      - either you use chroot, proot or similar to make /lib path contain your executable’s loader

      - or you hardcode different loader path into your executable

      Both are difficult for an end user.

      2 replies →