stunnel / static-curl

static builds cURL with HTTP3
MIT License
198 stars 28 forks source link

Latest build won't run on Ubuntu 20.04/Focal (amd64/x86_64) w/ kernel 5.4.x #62

Closed m-ueberall closed 7 months ago

m-ueberall commented 7 months ago
[2024-02-07T14:04:35+0100] sys-maint@desktop01:/tmp% ./curl-static_amd64-8.5.0 --version
curl 8.5.0 (x86_64-pc-linux-gnu) libcurl/8.5.0 quictls/3.1.4 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libssh2/1.11.0 nghttp2/1.58.0 ngtcp2/1.1.0 nghttp3/1.1.0
Release-Date: 2023-12-06
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Largefile libz NTLM SSL threadsafe TLS-SRP TrackMemory UnixSockets zstd
[2024-02-07T14:04:42+0100] sys-maint@desktop01:/tmp% ./curl-static_amd64-8.6.0 --version
curl-static_amd64-8.6.0: dl-call-libc-early-init.c:37: _dl_call_libc_early_init: Assertion `sym != NULL' failed.
zsh: abort (core dumped)  ./curl-static_amd64-8.6.0 --version
[2024-02-07T14:04:47+0100] sys-maint@desktop01:/tmp% ldd --version | head -1
ldd (Ubuntu GLIBC 2.31-0ubuntu9.14) 2.31
[2024-02-07T14:05:08+0100] sys-maint@desktop01:/tmp% arch
x86_64

The latest arm64/aarch64 variant works, though:

[2024-02-07T14:07:58+0100] sys-maint@odroid02:/tmp% ./curl-static_arm64-8.6.0 --version
curl 8.6.0 (aarch64-pc-linux-gnu) libcurl/8.6.0 OpenSSL/3.2.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 c-ares/1.26.0 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.59.0 nghttp3/1.1.0
Release-Date: 2024-01-31
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Largefile libz NTLM PSL SSL threadsafe TLS-SRP TrackMemory UnixSockets zstd
[2024-02-07T14:08:01+0100] sys-maint@odroid02:/tmp% ldd --version | head -1
ldd (Ubuntu GLIBC 2.31-0ubuntu9.14) 2.31
[2024-02-07T14:08:16+0100] sys-maint@odroid02:/tmp% arch
aarch64
travislee89 commented 7 months ago

The binary of architecture x86_64 is built using clang and statically linked with the glibc of the host on debian:latest (currently bookworm). Binaries for other architectures are built using qbt-musl-cross-make and linked with the musl libc, so that they work properly.

Unfortunately, I have modified the script so that all architectures will be built using clang in the next release, except for mips and i686.

Additionally, I have not been able to reproduce the issue.

# ./curl-static_amd64-8.6.0 --version
curl 8.6.0 (x86_64-pc-linux-gnu) libcurl/8.6.0 OpenSSL/3.2.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 c-ares/1.26.0 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.59.0 nghttp3/1.1.0

# ldd --version | head -1
ldd (Ubuntu GLIBC 2.31-0ubuntu9.14) 2.31

# arch
x86_64

# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"

It seems it's the same issue as this one. https://github.com/rust-lang/libc/issues/2054

I will build a binary of x86_64 using qbt-musl-cross-make.

m-ueberall commented 7 months ago

I will build a binary of x86_64 using qbt-musl-cross-make.

Thanks a lot! In the meantime, I reran the above test on multiple Ubuntu 20.04 hosts; it only failed on the first one shown above (which uses an Intel(R) Core(TM) i7-8705G CPU), while servers (using Intel(R) Xeon(R) Gold 6140, 6230 / AMD EPYC 7702P CPUs and the very same set of libc6* packages) don't have the problem.

EDIT: I managed to reproduce the problem on another Ubuntu 20.04 machine–apparently, it's not related to the CPU model, but the kernel version. Using 5.4.x kernels, the above error message is displayed; with kernels 5.15.x or newer ("HWE kernel"), everything works fine.

travislee89 commented 7 months ago

I freshly installed Ubuntu 20.04.6 with kernel 5.4, it works fine. It seems that does not relate to the kernel.

root@localhost:~# ./curl-static_amd64-8.6.0 -V
curl 8.6.0 (x86_64-pc-linux-gnu) libcurl/8.6.0 OpenSSL/3.2.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 c-ares/1.26.0 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.59.0 nghttp3/1.1.0

root@localhost:~# ldd --version | head -1
ldd (Ubuntu GLIBC 2.31-0ubuntu9.14) 2.31

root@localhost:~# arch
x86_64

root@localhost:~# uname -a
Linux localhost 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

On another server works too.

root@localhost:~# uname -a
Linux localhost 5.4.0-171-generic #189-Ubuntu SMP Fri Jan 5 14:23:02 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

A build using qbt-musl-cross-make on alpine:latest is running, you can download the binaries on the following page after it is done, it might take about 1.5 hours. https://github.com/stunnel/static-curl/actions/runs/7827517597

m-ueberall commented 7 months ago

It seems that does not relate to the kernel.

Pity. Is at least one of the above servers an Intel machine? (The only two machines available using different 5.4.x kernels on Ubuntu 20.04 and that fail for me have an i7-8705G and a Xeon(R) Gold 6230 CPU, respectively.)

stunnel/static-curl/actions/runs/7827517597

I verified that the x86_64/amd64 binary in the attached .zip archive works on both machines, thanks again!

travislee89 commented 7 months ago

AMD EPYC 7601(Linode) and Intel Core i7-9750H(VM on MacBook).

For the next release, I'll be releasing two versions, glibc and musl libc.

travislee89 commented 7 months ago

Test passed. Next build will compile and distribute both glibc and musl binaries. https://github.com/stunnel/static-curl/actions/runs/7890892806

travislee89 commented 7 months ago

FYI @m-ueberall The latest release already includes a version of musl. https://github.com/stunnel/static-curl/releases/tag/8.6.0-1