From 983eb58cbe13309febeb21fa2ec96ef043d87191 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 20 May 2024 02:36:52 +0700 Subject: [PATCH 1/3] ci: reduce verbosity of build.sh `-vv` produces lots of unrelated warnings in other crates when building with `-Zbuild-std`. A single `-v` is enough for most testing purposes. Build log size before and after: Before: ~12 MB After: 71.15 KB (apply to `main`) (cherry picked from commit 9c7a4d5807eff5aed05f960d8554c3c625438cc5) --- ci/build.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ci/build.sh b/ci/build.sh index 512c9cfc9a12a..722626b43d686 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -11,6 +11,7 @@ set -ex : "${OS?The OS environment variable must be set.}" RUST=${TOOLCHAIN} +VERBOSE=-v echo "Testing Rust ${RUST} on ${OS}" @@ -41,50 +42,50 @@ test_target() { # Test that libc builds without any default features (no std) if [ "${NO_STD}" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" else # FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings. RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features --target "${TARGET}" + -Z build-std=core,alloc "$VERBOSE" --no-default-features --target "${TARGET}" fi # Test that libc builds with default features (e.g. std) # if the target supports std if [ "$NO_STD" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --target "${TARGET}" else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --target "${TARGET}" + -Z build-std=core,alloc "$VERBOSE" --target "${TARGET}" fi # Test that libc builds with the `extra_traits` feature if [ "${NO_STD}" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \ + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" \ --features extra_traits else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features \ + -Z build-std=core,alloc "$VERBOSE" --no-default-features \ --target "${TARGET}" --features extra_traits fi # Test the 'const-extern-fn' feature on nightly if [ "${RUST}" = "nightly" ]; then if [ "${NO_STD}" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \ + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" \ --features const-extern-fn else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features \ + -Z build-std=core,alloc "$VERBOSE" --no-default-features \ --target "${TARGET}" --features const-extern-fn fi fi # Also test that it builds with `extra_traits` and default features: if [ "$NO_STD" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" \ + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --target "${TARGET}" \ --features extra_traits else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --target "${TARGET}" \ + -Z build-std=core,alloc "$VERBOSE" --target "${TARGET}" \ --features extra_traits fi } From 8258589365758c8c3ddbf5726fb5db8e7a86dc2d Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Wed, 22 May 2024 07:02:02 +0700 Subject: [PATCH 2/3] Migrate libc-test to 2018 edition edition: cannot update to 2021 edition because of libc msrv. cargo of rust 1.19 cannot understand edition key in cargo.toml. (cherry picked from commit 4057a9aa8c8c9eb5249cf3e573565bf6723dc01c) avoid rebuilding libc-test no semver vendor = 'unknown' (cherry picked from commit de2c8a7c53f0d45ae220541577f6dbaa6737f18c) use rel path for semver (cherry picked from commit d6d56f1a524b64f77a38ac6568ee2195684a08b7) (apply to `main`) [ resolve conflicts, squash for easier cherry-picks - Trevor ] --- libc-test/Cargo.toml | 1 + libc-test/build.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 8d85ad794ed53..df1bd04abd7d9 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "libc-test" version = "0.2.151" +edition = "2018" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" build = "build.rs" diff --git a/libc-test/build.rs b/libc-test/build.rs index ec55fadea1ba9..9560e07c8cf7e 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -82,8 +82,7 @@ fn do_semver() { let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); // `libc-test/semver` dir. - let mut semver_root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); - semver_root.push("semver"); + let mut semver_root = PathBuf::from("semver"); // NOTE: Windows has the same `family` as `os`, no point in including it // twice. @@ -93,7 +92,10 @@ fn do_semver() { if family != os && os != "android" { process_semver_file(&mut output, &mut semver_root, &family); } - process_semver_file(&mut output, &mut semver_root, &vendor); + // We don't do semver for unknown targets. + if vendor != "unknown" { + process_semver_file(&mut output, &mut semver_root, &vendor); + } process_semver_file(&mut output, &mut semver_root, &os); let os_arch = format!("{}-{}", os, arch); process_semver_file(&mut output, &mut semver_root, &os_arch); @@ -141,6 +143,9 @@ fn process_semver_file>(output: &mut W, path: &mut Path } fn main() { + // Avoid unnecessary re-building. + println!("cargo:rerun-if-changed=build.rs"); + do_cc(); do_ctest(); do_semver(); From 3935a88e32f11ddf57ecf3e59aead4d61f6efb76 Mon Sep 17 00:00:00 2001 From: Ondrej Perutka Date: Wed, 5 Jun 2024 16:18:03 +0200 Subject: [PATCH 3/3] Add missing getauxval for Linux uClibc targets (apply to `main`) (cherry picked from commit 3940851ba0d4f3d289f9837c4c4bfe0e8601f372) --- src/unix/linux_like/linux/uclibc/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 79897ac78fae0..32c65545a8905 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -431,6 +431,7 @@ extern "C" { pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int; pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int; + pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; } cfg_if! {