Primera de las 28 que static-audit.sh destapó. libtool ignoraba el -static del
lab (lo lee como "preferí mis .a"), así que el curl sellado salía dinámico con
NEEDED libz.so.1 + libc.so — y libc.so es el soname de la musl de zig, que en
el host son 255B de linker script. Resultado: el artefacto NO arrancaba fuera
del sandbox ("Error relocating /lib/libz.so.1: __snprintf_chk").
Fix: LDFLAGS="-all-static -no-pie" en compile Y en install (libtool relinkea
al instalar); nunca en configure, donde rompería los link-tests.
Verificado: 0 NEEDED, corre en el HOST (curl 8.20.0, OpenSSL/3.5.4, zlib/1.3.1)
y hace HTTPS real (http=200). Bit-repro: b3:19a919b28c25 ×2.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
40 lines
1.8 KiB
TOML
40 lines
1.8 KiB
TOML
# curl 8.20.0 → libcurl (C). Lib FUNDACIONAL: dep del crate `curl`/curl-sys (hurl y muchos tools),
|
|
# y de cola C de red. De-Alpinizada (Etapa G):
|
|
# - compiler=zig-cc (migrado de gcc, matar-gcc 2026-07-16), configure-split explícito, --disable-shared --enable-static.
|
|
# - TLS vía openssl del corpus (--with-openssl); compresión vía zlib del corpus.
|
|
# - drop de deps ausentes: --disable-ares, --without-{libidn2,nghttp2,libpsl,libssh2}. HTTP/HTTPS ok.
|
|
name = "curl"
|
|
version = "8.20.0"
|
|
|
|
[source]
|
|
tarball = "https://curl.se/download/curl-8.20.0.tar.xz"
|
|
sha256 = "63fe2dc148ba0ceae89922ef838f7e5c946272c2e78b7c59fab4b79d3ce2b896"
|
|
|
|
[build]
|
|
compiler = "zig-cc"
|
|
target = "x86_64-linux-musl"
|
|
link = "static"
|
|
flags = []
|
|
|
|
[build.phases]
|
|
configure = '''
|
|
./configure --build=$CBUILD --host=$CHOST --prefix=/usr \
|
|
--disable-shared --enable-static \
|
|
--with-openssl --with-zlib \
|
|
--disable-ares --without-libidn2 --without-nghttp2 --without-libpsl --without-libssh2 \
|
|
--disable-ldap --enable-ipv6 --enable-unix-sockets \
|
|
--with-ca-path=/etc/ssl/certs
|
|
'''
|
|
# -all-static (patrón de jq/parted/shadow/procps-ng): curl linka CON LIBTOOL, que lee el `-static`
|
|
# del lab como "preferí mis .a", NO como flag al linker ⇒ `link = "static"` se ignoraba EN SILENCIO
|
|
# y el binario salía dinámico (`NEEDED: libz.so.1, libc.so`). `libc.so` es el soname de la musl que
|
|
# zig bundlea; en el host son 255B de linker script ⇒ el curl sellado NO CORRÍA fuera del sandbox
|
|
# ("Error relocating /lib/libz.so.1: __snprintf_chk"). Medido con scripts/static-audit.sh.
|
|
# Va SÓLO en compile e install: en configure rompería los link-tests (no pasan por libtool), y en
|
|
# install porque libtool RELINKEA el binario al instalar.
|
|
compile = 'make LDFLAGS="-all-static -no-pie" -j"$(nproc)"'
|
|
install = 'make DESTDIR=/out install LDFLAGS="-all-static -no-pie"'
|
|
|
|
[deps]
|
|
build = ["openssl", "zlib", "perl"]
|