Bundle relocated interpreter's libdir into the dist toolchain package#2747
Closed
jetm wants to merge 1 commit into
Closed
Bundle relocated interpreter's libdir into the dist toolchain package#2747jetm wants to merge 1 commit into
jetm wants to merge 1 commit into
Conversation
sccache-dist packages a toolchain's shared libraries by parsing `ldd` output, which resolves NEEDED libraries against the host's dynamic loader. Yocto/OpenEmbedded "uninative" cross toolchains ship a relocated glibc whose loader has a built-in search path pointing at its own sysroot. For those binaries `ldd` reports host paths (e.g. /usr/lib/libm.so.6), yet inside the build sandbox the relocated loader searches its own sysroot lib dir, where those libraries were never packaged. The remote compile then dies with "libm.so.6: cannot open shared object file" and silently falls back to local compilation, so distribution never actually runs. When a packaged executable's PT_INTERP lives outside the standard host loader directories, also bundle the interpreter's own directory. That directory holds the libc/libm the relocated loader resolves against, so they land at the absolute path the loader searches inside the sandbox. Standard host toolchains are untouched: their interpreter is under /lib, /lib64, or /usr/lib, so the existing ldd-only path is preserved. Signed-off-by: Javier Tia <javier@peridio.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2747 +/- ##
=======================================
Coverage 74.63% 74.64%
=======================================
Files 70 70
Lines 39898 39945 +47
=======================================
+ Hits 29778 29817 +39
- Misses 10120 10128 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Author
|
Superseded by #2750, which combines this with the rest of the OpenEmbedded/Yocto distributed-compile fixes into a single series. Closing in favor of that PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
sccache-distpackages a toolchain's shared libraries by parsinglddoutput, which resolves a binary's
NEEDEDlibraries against the host'sdynamic loader. Yocto/OpenEmbedded "uninative" cross toolchains ship a
relocated glibc whose loader has a built-in search path pointing at its
own sysroot. For those binaries
lddreports host paths (e.g./usr/lib/libm.so.6), but inside the build sandbox the relocated loadersearches its own sysroot lib dir — where those libraries were never
packaged. The remote compile then dies with
libm.so.6: cannot open shared object fileand silently falls back to local compilation, sodistribution never actually runs.
Solution
When a packaged executable's
PT_INTERPlives outside the standard hostloader directories (
/lib,/lib64,/usr/lib,/usr/lib64), alsobundle the interpreter's own directory. That directory holds the
libc/libmthe relocated loader resolves against, so they land at theabsolute path the loader searches inside the sandbox. Standard host
toolchains are unaffected: their interpreter is under a standard loader
directory, so the existing
ldd-only path is preserved.Key changes
read_elf_interpreter()to read a binary'sPT_INTERPvia thealready-vendored
objectcrate.relocated_interpreter_libdir()to classify an interpreter asrelocated and return the directory to bundle.
add_executable_and_deps(), bundle that directory's contents when arelocated interpreter is detected.
Reviewer notes
under
/lib*, so nothing extra is bundled.Yocto image build distributed 634 compiles to the build server with 0
dist errors and no
libm.so.6failures, and the packaged toolchain tarnow contains the loader's
libc/libmat the uninative sysroot path.