Skip to content

cargo failed to run custom build command if strip in m1 mac #11641

Closed
@Ylarod

Description

@Ylarod

Problem

cargo faild to run custom build command if

[profile.release]
strip = true

command output

$ cargo build --release
   Compiling libc v0.2.139
error: failed to run custom build command for `libc v0.2.139`

Caused by:
  process didn't exit successfully: `/private/tmp/tet/target/release/build/libc-c9b37293d5307b87/build-script-build` (signal: 9, SIGKILL: kill)

Steps

Cargo.toml

[package]
name = "tet"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
libc = "0.2"

[profile.release]
strip = true

main.rs

fn main() {
    println!("Hello, world!");
    unsafe{
        libc::printf("Hello, world!\n".as_ptr() as *const libc::c_char);
    }
}

then just run cargo build --release

Possible Solution(s)

No response

Notes

$ file $(which cargo)
Mach-O 64-bit executable arm64

$ file $(which rustc)
Mach-O 64-bit executable arm64

$ file $(which rustup)
Mach-O 64-bit executable arm64

$ rustup -V
rustup 1.25.1 (bb60b1e89 2022-07-12)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.67.0 (fc594f156 2023-01-24)`

$ rustc -V
rustc 1.67.0 (fc594f156 2023-01-24)

$ uname -a
Darwin YlarodMBP 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64

$ sw_vers
ProductName:		macOS
ProductVersion:		13.0.1
BuildVersion:		22A400

Version

cargo 1.67.0 (8ecd4f20a 2023-01-10)
release: 1.67.0
commit-hash: 8ecd4f20a9efb626975ac18a016d480dc7183d9b
commit-date: 2023-01-10
host: aarch64-apple-darwin
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.84.0 (sys:0.4.59+curl-7.86.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 13.0.1 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions