rockdaboot / wget2

The successor of GNU Wget. Contributions preferred at https://gitlab.com/gnuwget/wget2. But accepted here as well 😍
GNU Lesser General Public License v3.0
575 stars 77 forks source link

Can you provide static prebuilt binaries for Linux, and for other architectures than x64 (armv7/v8 etc.) ? #353

Open maaaaz opened 3 weeks ago

maaaaz commented 3 weeks ago

Hello there,

Everything in the title :)

Cheers!

rockdaboot commented 3 weeks ago

Please feel invited to contribute an automatism at https://gitlab.com/gnuwget/wget2/-/merge_requests. Highly appreciated!

maaaaz commented 2 weeks ago

Well, if I knew how to do it, for sure I would contribue :)

But I don't really know where to start, I tried this but did not manage to have a static build:

$ cat /etc/issue*
Ubuntu 22.04.5 LTS

$ uname -amrs
Linux <host> 6.5.0-1025-<host> #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

$ ./configure --prefix=/tmp/wget2/wget2-2.1.0/build LDFLAGS='-static' --disable-shared
[...]
Version:            2.1.0
  Host OS:            linux-gnu
  Install prefix:     /tmp/wget2/wget2-2.1.0/build
  Compiler:           gcc
  CFlags:                 -DNDEBUG -g -O2
  LDFlags:            -static
  Libs:               -lpcre2-8    -lbrotlidec -lz     -lssl -lcrypto
  Library types:      shared=no, static=yes
  Small libraries:    no
  SSL/TLS support:    openssl
  DANE support:       no
  GZIP compression:   yes
  BZIP2 compression:  no
  LZMA compression:   no
  Brotli compression: yes
  Zstd compression:   no
  Lzip compression:   no
  IDNA support:
  PSL support:        no
  HSTS support:       no
  HTTP/2.0 support:   no
  Documentation:      no (neither Doxygen nor Pandoc found)
  Wget2 docs:
  Libwget docs:
  PCRE support:       yes, via libpcre2
  Tests:              Valgrind testing not enabled
  Assertions:         no
  POSIX xattr:        yes
  Microhttpd support: no (CFLAGS:     -DNDEBUG -g -O2. LIBS: -lpcre2-8    -lbrotlidec -lz     -lssl -lcrypto  )
  Fuzzing build:      no,
  GPGME:              no
  libproxy:           no

$ make -j $(nproc) && make install

$ ldd wget2
        linux-vdso.so.1 (0x00007ffe2e9cd000)
        libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007feed1537000)
        libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007feed1529000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007feed150d000)
        libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007feed1469000)
        libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007feed1000000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feed0c00000)
        libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007feed1444000)
        /lib64/ld-linux-x86-64.so.2 (0x00007feed1648000)

Any hint to help me ? :-)

rockdaboot commented 2 weeks ago

Cool, thanks for going into it.

Let me add what I know how to do it in theory :)

  1. For a pure static build, use muslc instead of glibc. For this you can use an Alpine Linux installation (see 2.).
  2. Best create a Dockerfile to build on Alpine environment.
  3. You need to install dependencies with static libraries, or build the deps yourself. I did this for a static Windows built. Is is possibly relatively easy to amend the Dockerfile to use Alpine and a different triplet. There is another Dockerfile for Alpine in our CI that may help you.