Skip to content

Draft: Build a shim libcurl that can dispatch to runtime or system copies

Simon McVittie requested to merge wip/smcv/libcurl-hack into steamrt/scout

This works around ABI divergence from upstream in the libcurl in Debian/Ubuntu between about 2005 and 2018, which unfortunately includes the time at which Steam Runtime 1 'scout' started. Modern versions of libcurl have versioned symbols attached to a verdef CURL_OPENSSL_4, but Debian introduced versioned symbols before upstream did, and used CURL_OPENSSL_3. We want to be compatible with both.

The trick here is that the dynamic linker does not require triples (SONAME, version, symbol), but only looks for pairs (SONAME, version) and, independently, (version, symbol). This means that dependencies on versioned symbols can be satisfied by any of the recursive dependencies of the library found when searching for the SONAME, and not just the library itself. (TODO: This appears to be true for recent glibc, but not for scout's glibc: where is the cutoff?)

The shim library has verdefs for both sets of versioned symbols, so it can be positioned in the search path as libcurl.so.4 and will satisfy both sets of requirements for the verdefs. For the actual symbols, it delegates to libsteam-runtime-system-libcurl.so.4 and libsteam-runtime-our-libcurl.so.4, which are expected to be set up by the runtime's setup.sh as symlinks to the real libraries that implement the two faces of libcurl.

If there is no system copy of libcurl, then we do not need to do all this and can use the runtime's libcurl directly.

libcurl3-gnutls has the same problem, and for completeness it gets similar treatment.

This requires some setup, which is done by a new version of setup.sh in each of the pinned_libs_* directories.

Merge request reports