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
Adding back support for an external libstdbuf.so #6591
#1120 changed the way stdbuf works to embed the .so inside of the binary. This, however, has some notable cons, such as:
Distro packaging tooling can't access the inner .so, which means things like post-build stripping or dependency scanning or anything else won't run on it. This makes it effectively impossible to do a build with debug info and pull the debug information out for external use after the build completes. (We hit this internally which led to an investigation as to what was going on exactly with the strip process.)
$TMPDIR might be mounted as noexec, in which case the LD_PRELOADwill simply not work.
Would a change to partially add back support for building libstdbuf.so externally be accepted? This could be perhaps configurable at build time & off-by-default (e.g. make USE_EXTERNAL_STDBUF=1), which would help a lot with the first point. (It wouldn't for the second, though! I'm not sure what the best solution for that is.)
One issue with current code (tested with commit 2ae14a3 ) is that it does not work when cross-compiling. It injects libstdbuf.so with the wrong architecture into the coreutils binary:
You can see that the x86-64 libstdbuf.so was injected into the AARCH64 coreutils binary.
I think it is a regression caused by #1120 . Testing 3727082 with rust 1.22, you can see that a static library ./target/aarch64-unknown-linux-gnu/debug/build/stdbuf-6a46e82d861bf028/out/libstdbuf.a used to be created with the correct aarch64 architecture. This is not the case any more after #1120
I started working on the cross-compilation issue. I will try to implement a solution using https://github.com/rnza0u/blaze/blob/master/core/build.rs#L98 as example. Long-term, the cargo feature "bindeps" should be used instead (but at the moment it is only available in nightly).
Currently, having libstdbuf as "build-dependencies" of stdbuf in Cargo.toml ensures that libstdbuf is built before stdbuf so that it can be injected into stdbuf using include_bytes, however this breaks cross-compilation, since build-dependencies are built for the host architecture, and not for the target architecture.
Activity
Ecordonnier commentedon Mar 7, 2025
One issue with current code (tested with commit 2ae14a3 ) is that it does not work when cross-compiling. It injects libstdbuf.so with the wrong architecture into the coreutils binary:
You can see that the x86-64 libstdbuf.so was injected into the AARCH64 coreutils binary.
I think it is a regression caused by #1120 . Testing 3727082 with rust 1.22, you can see that a static library
./target/aarch64-unknown-linux-gnu/debug/build/stdbuf-6a46e82d861bf028/out/libstdbuf.aused to be created with the correct aarch64 architecture. This is not the case any more after #1120Full logs:
build-after-1120.txt
build-before-1120.txt
uutils-coreutils: disable stdbuf compilation
uutils-coreutils: disable stdbuf compilation
uutils-coreutils: disable stdbuf compilation
uutils-coreutils: disable stdbuf compilation
uutils-coreutils: disable stdbuf compilation
sylvestre commentedon May 2, 2025
@Ecordonnier is it something you could fix directly in the code ? :)
merci
Ecordonnier commentedon May 2, 2025
@sylvestre yes it is on my to-do list, I don't know yet when I'll have time to work on it unfortunately
Ecordonnier commentedon May 5, 2025
I started working on the cross-compilation issue. I will try to implement a solution using https://github.com/rnza0u/blaze/blob/master/core/build.rs#L98 as example. Long-term, the cargo feature "bindeps" should be used instead (but at the moment it is only available in nightly).
Currently, having libstdbuf as "build-dependencies" of stdbuf in Cargo.toml ensures that libstdbuf is built before stdbuf so that it can be injected into stdbuf using include_bytes, however this breaks cross-compilation, since build-dependencies are built for the host architecture, and not for the target architecture.
35 remaining items
coreutils: disable stdbuf
uutils-coreutils: disable stdbuf compilation
uutils-coreutils: disable stdbuf compilation