microsoft / microsoft/edit

Unable to build on darwin due to LLVM object discrepancy

Open
#631 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
14.6k
Forks
734
Avg merge
8h 40m
Merged PRs (30d)
4

Description

issue:
```bash
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

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

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

Contributor guide

Open the contributing guide

Research direction

Start with .cargo/release.toml and the reported cargo build command on aarch64-apple-darwin. Check the release profile and target-specific settings against the LLVM linker error, then confirm that the project builds successfully on the reported Darwin setup without the object discrepancy.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.