mirror of
https://github.com/uutils/coreutils.git
synced 2025-12-23 08:47:37 +00:00
Merge pull request #8585 from Ecordonnier/eco/musl-libc-fix
Some checks are pending
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CheckScripts / ShellScript/Check (push) Waiting to run
CheckScripts / ShellScript/Format (push) Waiting to run
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
CICD / Style/cargo-deny (push) Waiting to run
CICD / Build (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
Some checks are pending
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CheckScripts / ShellScript/Check (push) Waiting to run
CheckScripts / ShellScript/Format (push) Waiting to run
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
CICD / Style/cargo-deny (push) Waiting to run
CICD / Build (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
link musl libc statically
This commit is contained in:
commit
5c33a30eec
4 changed files with 47 additions and 11 deletions
|
|
@ -8,8 +8,3 @@ linker = "x86_64-unknown-redox-gcc"
|
|||
[env]
|
||||
# See feat_external_libstdbuf in src/uu/stdbuf/Cargo.toml
|
||||
LIBSTDBUF_DIR = "/usr/local/libexec/coreutils"
|
||||
|
||||
# libstdbuf must be a shared library, so musl libc can't be linked statically
|
||||
# https://github.com/rust-lang/rust/issues/82193
|
||||
[build]
|
||||
rustflags = ["-C", "target-feature=-crt-static"]
|
||||
|
|
|
|||
6
.github/workflows/CICD.yml
vendored
6
.github/workflows/CICD.yml
vendored
|
|
@ -531,13 +531,13 @@ jobs:
|
|||
# - { os , target , cargo-options , default-features, features , use-cross , toolchain, skip-tests, workspace-tests, skip-package, skip-publish }
|
||||
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , features: feat_os_unix_gnueabihf , use-cross: use-cross , skip-tests: true }
|
||||
- { os: ubuntu-24.04-arm , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf }
|
||||
- { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross , skip-tests: true }
|
||||
- { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross , skip-tests: true }
|
||||
# - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: feat_selinux , use-cross: use-cross }
|
||||
- { os: ubuntu-latest , target: i686-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross }
|
||||
- { os: ubuntu-latest , target: i686-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross }
|
||||
- { os: ubuntu-latest , target: i686-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
|
||||
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross }
|
||||
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,uudoc" , use-cross: no, workspace-tests: true }
|
||||
- { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix , use-cross: use-cross }
|
||||
- { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
|
||||
- { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true }
|
||||
- { os: ubuntu-latest , target: wasm32-unknown-unknown , default-features: false, features: uucore/format, skip-tests: true, skip-package: true, skip-publish: true }
|
||||
- { os: macos-latest , target: aarch64-apple-darwin , features: feat_os_macos, workspace-tests: true } # M1 CPU
|
||||
|
|
|
|||
17
Cargo.toml
17
Cargo.toml
|
|
@ -163,7 +163,6 @@ feat_os_macos = [
|
|||
"feat_require_unix_hostid",
|
||||
]
|
||||
# "feat_os_unix" == set of utilities which can be built/run on modern/usual *nix platforms.
|
||||
# Also used for targets binding to the "musl" library (ref: <https://musl.libc.org/about.html>)
|
||||
feat_os_unix = [
|
||||
"feat_Tier1",
|
||||
#
|
||||
|
|
@ -171,6 +170,15 @@ feat_os_unix = [
|
|||
"feat_require_unix_hostid",
|
||||
"feat_require_unix_utmpx",
|
||||
]
|
||||
# "feat_os_unix_musl" == set of utilities which can be built/run on targets binding to the "musl" library (ref: <https://musl.libc.org/about.html>)
|
||||
# It excludes stdbuf due to cdylib limitations (https://github.com/rust-lang/rust/issues/82193)
|
||||
feat_os_unix_musl = [
|
||||
"feat_Tier1",
|
||||
#
|
||||
"feat_require_unix_musl",
|
||||
"feat_require_unix_hostid",
|
||||
"feat_require_unix_utmpx",
|
||||
]
|
||||
# "feat_os_windows" == set of utilities which can be built/run on modern/usual windows platforms
|
||||
feat_os_windows = [
|
||||
"feat_Tier1", ## == "feat_os_windows_legacy" + "hostname"
|
||||
|
|
@ -194,7 +202,11 @@ feat_os_unix_android = [
|
|||
# ** NOTE: these `feat_require_...` sets should be minimized as much as possible to encourage cross-platform availability of utilities
|
||||
#
|
||||
# "feat_require_unix" == set of utilities requiring support which is only available on unix platforms
|
||||
feat_require_unix = [
|
||||
feat_require_unix = ["feat_require_unix_core", "stdbuf"]
|
||||
# "feat_require_unix_musl" == set of utilities requiring unix support, excluding stdbuf (cdylib not supported on musl)
|
||||
feat_require_unix_musl = ["feat_require_unix_core"]
|
||||
# "feat_require_unix_core" == core unix utilities (shared between regular unix and musl)
|
||||
feat_require_unix_core = [
|
||||
"chgrp",
|
||||
"chmod",
|
||||
"chown",
|
||||
|
|
@ -210,7 +222,6 @@ feat_require_unix = [
|
|||
"nohup",
|
||||
"pathchk",
|
||||
"stat",
|
||||
"stdbuf",
|
||||
"stty",
|
||||
"timeout",
|
||||
"tty",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
//
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore readelf
|
||||
|
||||
use uutests::util::TestScenario;
|
||||
|
||||
#[cfg(unix)]
|
||||
|
|
@ -280,3 +283,30 @@ fn util_version() {
|
|||
assert_eq!(format!("coreutils {ver} (multi-call binary)\n"), output_str);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_env = "musl")]
|
||||
fn test_musl_no_dynamic_deps() {
|
||||
use std::process::Command;
|
||||
|
||||
let scenario = TestScenario::new("test_musl_no_dynamic_deps");
|
||||
if !scenario.bin_path.exists() {
|
||||
println!("Skipping test: Binary not found at {:?}", scenario.bin_path);
|
||||
return;
|
||||
}
|
||||
|
||||
let output = Command::new("readelf")
|
||||
.arg("-d")
|
||||
.arg(&scenario.bin_path)
|
||||
.output()
|
||||
.expect("Failed to run readelf");
|
||||
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
|
||||
// Static binaries should have no NEEDED entries (dynamic library dependencies)
|
||||
assert!(
|
||||
!stdout.contains("NEEDED"),
|
||||
"Found dynamic dependencies in musl binary:\n{}",
|
||||
stdout
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue