wget2 icon indicating copy to clipboard operation
wget2 copied to clipboard

How to build static wget2 binary for Linux?

Open yfdyh000 opened this issue 11 months ago • 1 comments

./wget2: error while loading shared libraries: libwolfssl.so.32: cannot open shared object file: No such file or directory

I've tried the ./configure --enable-static --disable-shared, ./configure --enable-static --disable-shared CFLAGS="-static -static-libgcc" and more in Ubuntu on WSL2, it looks not works. I don't see how to build the 'gnutls' or 'openssl' with --with-ssl=, it needs some kind of dependence.

I what to run wget2 in a Kubernetes task without administrative privileges.

https://gitlab.com/gnuwget/wget2/-/issues/482

yfdyh000 avatar Sep 10 '23 11:09 yfdyh000

First of all, I never found a simple way to create a fully static wget2 executable. glibc has a long-term issue that prevents fully static builds. The fallback to muslc (on Alpine Linux) needs a custom static build of libgnutls (I never found the time to come up with a Dockerfile).

On Ubuntu, install libgnutls28-dev. It contains the static library libgnutls.a. You should not need --with-ssl - GnuTLS is picked as first choice by ./configure. As said befoire, your wget2 executable will possibly not be fully static (e.g. glibc eventually uses ldopen() to dynamically load secondary libraries). But maybe it works in your environments, if they are not too different.

rockdaboot avatar Sep 24 '23 17:09 rockdaboot