On 3/20/25 11:54 AM, Nate Eldredge wrote:
> On Mar 20, 2025, at 00:07 Eli Schwartz <eschwa...@gentoo.org> wrote:
>> You can also pass -C linker=clang if you like. Portage will
>> already do this for rust software packaged in ::gentoo.
> 
> Well, not across the board, it seems, because I became aware of the
> issue when dev-util/maturin failed to emerge.  In the build.log
> (attached) we can see that some of the rustc commands use -C
> linker=clang but others do not, and they fail.  Is that a separate
> bug?


Your build.log confuses me.


This works:

```
   Compiling once_cell v1.20.2
     Running `/usr/lib/rust/1.85.0/bin/rustc --crate-name once_cell
--edition=2021
/var/tmp/portage/dev-util/maturin-1.8.3/work/maturin-1.8.3/vendor/once_cell-1.20.2/src/lib.rs
--error-format=json
--json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type
lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no
--cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="race"'
--cfg 'feature="std"' --check-cfg 'cfg(docsrs,test)' --check-cfg
'cfg(feature, values("alloc", "atomic-polyfill", "critical-section",
"default", "parking_lot", "portable-atomic", "race", "std",
"unstable"))' -C metadata=01b7ec3b26924a89 -C
extra-filename=-8730246110ac63a2 --out-dir
/var/tmp/portage/dev-util/maturin-1.8.3/work/maturin-1.8.3/target/aarch64-unknown-linux-gnu/release/deps
--target aarch64-unknown-linux-gnu -C strip=debuginfo -L
dependency=/var/tmp/portage/dev-util/maturin-1.8.3/work/maturin-1.8.3/target/aarch64-unknown-linux-gnu/release/deps
-L
dependency=/var/tmp/portage/dev-util/maturin-1.8.3/work/maturin-1.8.3/target/release/deps
--cap-lints allow -C strip=none -C linker=clang -C
target-feature=-crt-static -C link-arg=-Wl,-O1 -C
link-arg=-Wl,--as-needed -C link-arg=-Wl,--as-needed -C opt-level=2 -C
target-cpu=apple-m3`
```


This fails:

```
error: linker `clang-19` not found
  |
  = note: No such file or directory (os error 2)

error: could not compile `proc-macro2` (build script) due to 1 previous
error

Caused by:
  process didn't exit successfully: `/usr/lib/rust/1.85.0/bin/rustc
--crate-name build_script_build --edition=2021
/var/tmp/portage/dev-util/maturin-1.8.3/work/maturin-1.8.3/vendor/proc-macro2-1.0.92/build.rs
--error-format=json
--json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type
bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off
--cfg 'feature="default"' --cfg 'feature="proc-macro"' --check-cfg
'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("default",
"nightly", "proc-macro", "span-locations"))' -C
metadata=0e81ff72b9187942 -C extra-filename=-888329b5f3018591 --out-dir
/var/tmp/portage/dev-util/maturin-1.8.3/work/maturin-1.8.3/target/release/build/proc-macro2-888329b5f3018591
-C strip=debuginfo -L
dependency=/var/tmp/portage/dev-util/maturin-1.8.3/work/maturin-1.8.3/target/release/deps
--cap-lints allow` (exit status: 1)
```


Same `cargo build` run, but -C linker is not being passed to proc
macros? or?



-- 
Eli Schwartz

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to