Skip to content

Unable to build on darwin due to LLVM object discrepancy #631

@earentir

Description

@earentir

issue:

earentir@air edit % cargo build --config .cargo/release.toml --release
   Compiling edit v1.2.1 (/Users/earentir/projects/edit)
error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "<1 object files omitted>" "/Users/earentir/projects/edit/target/release/deps/libcompiler_builtins-9174c54a2f22f98a.rlib" "-liconv" "-lSystem" "-lc" "-lm" "-arch" "arm64" "-mmacosx-version-min=11.0.0" "-o" "/Users/earentir/projects/edit/target/release/deps/edit-380b87e122b3dcaf" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: ld: could not parse bitcode object file /Users/earentir/projects/edit/target/release/deps/libcompiler_builtins-9174c54a2f22f98a.rlib(compiler_builtins-9174c54a2f22f98a.compiler_builtins.2d1910a3e3825075-cgu.0.rcgu.o): 'Unknown attribute kind (102) (Producer: 'LLVM21.1.0-rust-1.91.0-nightly' Reader: 'LLVM APPLE_1_1700.0.13.5_0')', using libLTO version 'LLVM version 17.0.0' in '/Users/earentir/projects/edit/target/release/deps/libcompiler_builtins-9174c54a2f22f98a.rlib(compiler_builtins-9174c54a2f22f98a.compiler_builtins.2d1910a3e3825075-cgu.0.rcgu.o)'
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: could not compile `edit` (bin "edit") due to 1 previous error

because we are on nightly the llvm used for the objects we pull through rustup are build with a way newer LLVM, in order to build (1.2.1 at least) on 15.6.1 you will need to disable LTO+bitcode

[profile.release]
lto = false
codegen-units = 1

[target.aarch64-apple-darwin]
rustflags = ["-Cembed-bitcode=no"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions