You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
linux: a C library with get builds from source can need a newer glibc than the machine it was built on (curl's probe finds memset_explicit@GLIBC_2.43 in the SDK's stubs) #3603
On Linux, a C library that with get builds from source can come out needing a newer glibc than the machine that built it, and the program that links it does not start:
/tmp/q/out/uat/libcurl/tmp/out/bin/tmp: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.43' not found
Seen on linux-aarch64 (Ubuntu, glibc 2.39), compiler built from main b6aaf32, building libcurl 8.23.0 from source (with its TLS option set to mbedtls for the #2757 spike; the code path is curl's own, whatever the TLS backend). llvm-nm -u on the built libcurl.a shows one such reference: U memset_explicit, a function glibc added in 2.43.
Root cause
build/sdk.with, sdk_glibc_stub_sources, where each stub symbol's default version is chosen:
if default_ver < 0 and not floor_any: default_ver = newest
The comment above it states the intent: "A symbol newer than the pin everywhere is bound at its newest version". The stubs carry every symbol at every version so that a prebuilt archive compiled against a newer glibc (a Conan Center binary) still links, and for a symbol that has no version at or below the 2.28 pin, the newest one is made the default (@@) so that archive's unversioned reference binds.
A configure probe is also an unversioned reference. CMake's function check links a test program that calls memset_explicit; the stub answers; curl records the function as present and calls it. So the sentence at the top of that section, "A program built against it runs on any glibc at or after the pin", does not hold for anything built from source here: the floor is 2.28 for With code and whatever the newest abilist knows for C built through with cc.
Fix shape
The two kinds of unversioned reference need different answers, so they need different stubs:
Compiling and linking C from source (with cc, which is what with get's CMake and its probes use): a symbol with no version at or below the pin is present only under its versioned name (sym@GLIBC_2.43, not @@). The probe's link fails, the library takes its fallback, and the result runs at the floor.
Linking a program (which may carry prebuilt archives): today's stubs, unchanged.
That is a second set of the seven stub libraries in the Linux sysroot, chosen by the driver when it is acting as cc, and it means regenerating and republishing the Linux SDKs (x86_64 and aarch64) and moving sdk.lock.
A test: a CMake project whose check_function_exists(memset_explicit HAVE_IT) must come out false on Linux, and a program linking a source-built library must run in a container whose glibc is older than the newest abilist.
Scope
Any source build on Linux whose build system probes for a function newer than glibc 2.28: every package on linux-aarch64 (Conan Center has no binaries there) and every package without a binary on linux-x86_64. Found while running the #2757 spike.
Activity
C compiled by with cc on Linux stays at the glibc floor: a build syst…