Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo build can work, but cargo build --release is failure #4021

Open
fyqtian opened this issue Nov 10, 2024 · 0 comments
Open

cargo build can work, but cargo build --release is failure #4021

fyqtian opened this issue Nov 10, 2024 · 0 comments
Labels
C-bug Category: bug

Comments

@fyqtian
Copy link

fyqtian commented Nov 10, 2024

Issue Description

Building libc v0.2.162 fails in release mode but succeeds in debug mode.

Target Triple

aarch64-apple-darwin (Apple Silicon macOS)

Environment Info

  • OS: macOS ( 14.4.1 )
  • Rust Version: rustc 1.82.0 (f6e511eec 2024-10-15)
  • Cargo Version:cargo 1.82.0 (8f40fc59f 2024-08-21)

Steps to Reproduce

  1. Create a new project with the above minimal example
  2. Run cargo build (succeeds)
  3. Run cargo build --release -vv (fails)

Build Logs

❯ cargo clean
     Removed 127 files, 20.7MiB total
❯ cargo build
warning: /Users/fanv/Documents/daily-work/code/rustcode/libc/Cargo.toml: no edition set: defaulting to the 2015 edition while the latest is 2021
   Compiling libc v0.2.162 (/Users/fanv/Documents/daily-work/code/rustcode/libc)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.02s
❯ cargo build -vv --release
warning: /Users/fanv/Documents/daily-work/code/rustcode/libc/Cargo.toml: no edition set: defaulting to the 2015 edition while the latest is 2021
   Compiling libc v0.2.162 (/Users/fanv/Documents/daily-work/code/rustcode/libc)
     Running `CARGO=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.2.162 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=162 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 DYLD_FALLBACK_LIBRARY_PATH='/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/deps:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/fanv/lib:/usr/local/lib:/usr/lib' /Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name build_script_build --edition=2015 build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=214 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=7e62781a0ba77f41 -C extra-filename=-7e62781a0ba77f41 --out-dir /Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-7e62781a0ba77f41 -C strip=debuginfo -L dependency=/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/deps`
     Running `CARGO=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_CFG_PANIC=unwind CARGO_CFG_TARGET_ABI='' CARGO_CFG_TARGET_ARCH=aarch64 CARGO_CFG_TARGET_ENDIAN=little CARGO_CFG_TARGET_ENV='' CARGO_CFG_TARGET_FAMILY=unix CARGO_CFG_TARGET_FEATURE=aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh CARGO_CFG_TARGET_HAS_ATOMIC=128,16,32,64,8,ptr CARGO_CFG_TARGET_OS=macos CARGO_CFG_TARGET_POINTER_WIDTH=64 CARGO_CFG_TARGET_VENDOR=apple CARGO_CFG_UNIX='' CARGO_ENCODED_RUSTFLAGS='' CARGO_FEATURE_DEFAULT=1 CARGO_FEATURE_STD=1 CARGO_MANIFEST_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.2.162 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=162 CARGO_PKG_VERSION_PRE='' DEBUG=false DYLD_FALLBACK_LIBRARY_PATH='/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/deps:/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/fanv/lib:/usr/local/lib:/usr/lib' HOST=aarch64-apple-darwin NUM_JOBS=10 OPT_LEVEL=3 OUT_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-04bf9d3a393b075f/out PROFILE=release RUSTC=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc RUSTDOC=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustdoc TARGET=aarch64-apple-darwin /Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-7e62781a0ba77f41/build-script-build`
error: failed to run custom build command for `libc v0.2.162 (/Users/fanv/Documents/daily-work/code/rustcode/libc)`

Caused by:
  process didn't exit successfully: `CARGO=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_CFG_PANIC=unwind CARGO_CFG_TARGET_ABI='' CARGO_CFG_TARGET_ARCH=aarch64 CARGO_CFG_TARGET_ENDIAN=little CARGO_CFG_TARGET_ENV='' CARGO_CFG_TARGET_FAMILY=unix CARGO_CFG_TARGET_FEATURE=aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh CARGO_CFG_TARGET_HAS_ATOMIC=128,16,32,64,8,ptr CARGO_CFG_TARGET_OS=macos CARGO_CFG_TARGET_POINTER_WIDTH=64 CARGO_CFG_TARGET_VENDOR=apple CARGO_CFG_UNIX='' CARGO_ENCODED_RUSTFLAGS='' CARGO_FEATURE_DEFAULT=1 CARGO_FEATURE_STD=1 CARGO_MANIFEST_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
  ' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.2.162 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=162 CARGO_PKG_VERSION_PRE='' DEBUG=false DYLD_FALLBACK_LIBRARY_PATH='/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/deps:/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/fanv/lib:/usr/local/lib:/usr/lib' HOST=aarch64-apple-darwin NUM_JOBS=10 OPT_LEVEL=3 OUT_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-04bf9d3a393b075f/out PROFILE=release RUSTC=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc RUSTDOC=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustdoc TARGET=aarch64-apple-darwin /Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-7e62781a0ba77f41/build-script-build` (signal: 9, SIGKILL: kill)
```❯ cargo build -vv --release
warning: /Users/fanv/Documents/daily-work/code/rustcode/libc/Cargo.toml: no edition set: defaulting to the 2015 edition while the latest is 2021
   Compiling libc v0.2.162 (/Users/fanv/Documents/daily-work/code/rustcode/libc)
     Running `CARGO=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.2.162 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=162 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 DYLD_FALLBACK_LIBRARY_PATH='/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/deps:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/fanv/lib:/usr/local/lib:/usr/lib' /Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name build_script_build --edition=2015 build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=214 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=7e62781a0ba77f41 -C extra-filename=-7e62781a0ba77f41 --out-dir /Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-7e62781a0ba77f41 -C strip=debuginfo -L dependency=/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/deps`
     Running `CARGO=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_CFG_PANIC=unwind CARGO_CFG_TARGET_ABI='' CARGO_CFG_TARGET_ARCH=aarch64 CARGO_CFG_TARGET_ENDIAN=little CARGO_CFG_TARGET_ENV='' CARGO_CFG_TARGET_FAMILY=unix CARGO_CFG_TARGET_FEATURE=aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh CARGO_CFG_TARGET_HAS_ATOMIC=128,16,32,64,8,ptr CARGO_CFG_TARGET_OS=macos CARGO_CFG_TARGET_POINTER_WIDTH=64 CARGO_CFG_TARGET_VENDOR=apple CARGO_CFG_UNIX='' CARGO_ENCODED_RUSTFLAGS='' CARGO_FEATURE_DEFAULT=1 CARGO_FEATURE_STD=1 CARGO_MANIFEST_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.2.162 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=162 CARGO_PKG_VERSION_PRE='' DEBUG=false DYLD_FALLBACK_LIBRARY_PATH='/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/deps:/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/fanv/lib:/usr/local/lib:/usr/lib' HOST=aarch64-apple-darwin NUM_JOBS=10 OPT_LEVEL=3 OUT_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-04bf9d3a393b075f/out PROFILE=release RUSTC=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc RUSTDOC=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustdoc TARGET=aarch64-apple-darwin /Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-7e62781a0ba77f41/build-script-build`
error: failed to run custom build command for `libc v0.2.162 (/Users/fanv/Documents/daily-work/code/rustcode/libc)`

Caused by:
  process didn't exit successfully: `CARGO=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_CFG_PANIC=unwind CARGO_CFG_TARGET_ABI='' CARGO_CFG_TARGET_ARCH=aarch64 CARGO_CFG_TARGET_ENDIAN=little CARGO_CFG_TARGET_ENV='' CARGO_CFG_TARGET_FAMILY=unix CARGO_CFG_TARGET_FEATURE=aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh CARGO_CFG_TARGET_HAS_ATOMIC=128,16,32,64,8,ptr CARGO_CFG_TARGET_OS=macos CARGO_CFG_TARGET_POINTER_WIDTH=64 CARGO_CFG_TARGET_VENDOR=apple CARGO_CFG_UNIX='' CARGO_ENCODED_RUSTFLAGS='' CARGO_FEATURE_DEFAULT=1 CARGO_FEATURE_STD=1 CARGO_MANIFEST_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
  ' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.2.162 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=162 CARGO_PKG_VERSION_PRE='' DEBUG=false DYLD_FALLBACK_LIBRARY_PATH='/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/deps:/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib:/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/fanv/lib:/usr/local/lib:/usr/lib' HOST=aarch64-apple-darwin NUM_JOBS=10 OPT_LEVEL=3 OUT_DIR=/Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-04bf9d3a393b075f/out PROFILE=release RUSTC=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc RUSTDOC=/Users/fanv/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustdoc TARGET=aarch64-apple-darwin /Users/fanv/Documents/daily-work/code/rustcode/libc/target/release/build/libc-7e62781a0ba77f41/build-script-build` (signal: 9, SIGKILL: kill)
@fyqtian fyqtian added the C-bug Category: bug label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

1 participant