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
Error: cargo install coreutils --features windows fails on Windows due to stdbuf #13886
Thank you so much for this amazing software, and thanks for supporting Windows too!!
When trying to install coreutils(v0.10.0) on windows, the build fails due to a missing environment variable.
Environment
OS
Windows 11
Rust version (use stable)
cargo 1.97.1 (c980f4866 2026-06-30)
rustc 1.97.1 (8bab26f4f 2026-07-14)
Reproduce
Run install command on Windows in PowerShell. cargo install coreutils --features windows --locked
Problem
The build fails while compiling uu_stdbuf:
error: environment variable `LIBSTDBUF_DIR` not defined at compile time
--> %home%\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\uu_stdbuf-0.10.0\src\stdbuf.rs:152:33
|
152 | const LIBSTDBUF_DIR: &str = env!("LIBSTDBUF_DIR");
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: use `std::env::var("LIBSTDBUF_DIR")` to read the variable at run time
That PR added stdbuf to the Windows feature set to support stdbuf.exe via libstdbuf.dll (built for Cygwin/MSYS2). However, this change inadvertently enables stdbuf by default during installation, even for users who aren't targeting Cygwin/MSYS2.
On Windows, this triggers the external libstdbuf code path, which expects LIBSTDBUF_DIR to be set at compile time. Since this variable is missing when installing from crates.io, the build fails.
Expected behavior
cargo install coreutils --features windows --locked should work for a normal Windows installation without requiring Cygwin/MSYS2-specific libstdbuf configuration.
As was already encountered in #7992, relying on values from the repository's .cargo/config.toml does not work when installing from crates.io with cargo install, so LIBSTDBUF_DIR is not defined in this case.
Also, I am a native Windows user and do not use Cygwin. I would expect the general windows feature not to assume that Cygwin is installed or configured. (I understand that coreutils doesn't particularly require Cygwin.)
This is needed for people still want to use Windows native binary on MSYS2 if possible. Also needed to protect against build failure. I'll switch to option_env!("LIBSTDBUF_DIR").
Activity
oech3 commentedon Aug 12, 2026
It iws expected. Windows native
stdbuf.exedepends on Cygwinlibstdbuf.dll. Defult value for LIBSTDBUF_DIR is provided at https://github.com/uutils/coreutils/blob/main/.cargo/config.toml .hawk-tomy commentedon Aug 12, 2026
Thanks for the clarification.
As was already encountered in #7992, relying on values from the repository's
.cargo/config.tomldoes not work when installing from crates.io withcargo install, soLIBSTDBUF_DIRis not defined in this case.Also, I am a native Windows user and do not use Cygwin. I would expect the general
windowsfeature not to assume that Cygwin is installed or configured. (I understand thatcoreutilsdoesn't particularly require Cygwin.)oech3 commentedon Aug 12, 2026
This is needed for people still want to use Windows native binary on MSYS2 if possible. Also needed to protect against build failure. I'll switch to
option_env!("LIBSTDBUF_DIR").