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

multiple rlib candidates for compiler_builtins found #388

Closed
jiayihu opened this issue Oct 19, 2020 · 6 comments
Closed

multiple rlib candidates for compiler_builtins found #388

jiayihu opened this issue Oct 19, 2020 · 6 comments

Comments

@jiayihu
Copy link

jiayihu commented Oct 19, 2020

I'm having a similar issue to #334 but it's different I think. I have build-std = ["core", "alloc"] in config.toml and I'm trying to compile a local patch of compiler-builtins, for the reasons stated in #387 . In Cargo.toml I have the following configuration:

wasm3 = { version = "0.1.3", default-features = false, features = ["use-32bit-slots"] }
compiler_builtins = { version = "0.1.36" }

[patch.crates-io]
wasm3 = { path = "../../wasm3-rs" }
compiler_builtins = { path = "../../compiler-builtins" }

But the compiler is giving the error:

error[E0465]: multiple rlib candidates for `compiler_builtins` found
  |
  = note: candidate #1: /Users/jiayihu/Desktop/Repo/fedra-thesis/fedra/target/thumbv7em-none-eabi/debug/deps/libcompiler_builtins-c00a7bd3257465d5.rlib
  = note: candidate #2: /Users/jiayihu/Desktop/Repo/fedra-thesis/fedra/target/thumbv7em-none-eabi/debug/deps/libcompiler_builtins-7cae6c5d923380b0.rlib

I believe one version is the one included by default by cargo because of core in https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/standard_lib.rs#L28, whereas the second one is my patch. How do I opt-out the cargo-inserted one?

@yuanyuan2100
Copy link

Got the same error when I was complying for avr-atmega328p.

= note: candidate #1: /Rust/arduino/target/avr-atmega328p/release/deps/libcompiler_builtins-13aec7bae4adb9d2.rlib
= note: candidate #2: /Rust/arduino/target/avr-atmega328p/release/deps/libcompiler_builtins-a98f3389f6f9d633.rlib

@haraldh
Copy link

haraldh commented Nov 24, 2020

maybe this helps:

[build]
rustflags = [
    "-C", "link-self-contained=no",
]

@stlankes
Copy link

stlankes commented May 4, 2021

I have a similar problem and the compiler flag doesn't help.

@nbdd0121
Copy link
Contributor

This workaround works for me: add

[unstable]
build-std = ["core", "alloc"]
build-std-features = ["compiler-builtins-mangled-names"]

to .cargo/config and use

[dependencies]
compiler_builtins_local = { path = "../../compiler-builtins", package = "compiler_builtins" }

to Cargo.toml and add

extern crate compiler_builtins_local;

to the top of main.rs.

@bjorn3
Copy link
Member

bjorn3 commented Aug 27, 2021

build-std-features = ["compiler-builtins-mangled-names"]

I am not quite sure this was intended to work with -Zbuild-std. At the very least it wouldn't be possible to provide any stability guarantees as a codegen backend is free to depend on new intrinsics from compiler-builtins.

@tgross35
Copy link
Contributor

This is a pretty old issue and it seems like there are solutions, so I will close this.

tgross35 added a commit to tgross35/compiler-builtins that referenced this issue Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants