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

"duplicate lang item in crate core" when building #71

Closed
TheBlueMatt opened this issue Jul 7, 2021 · 3 comments
Closed

"duplicate lang item in crate core" when building #71

TheBlueMatt opened this issue Jul 7, 2021 · 3 comments

Comments

@TheBlueMatt
Copy link

With current nightly, on x86_64 linux (and reproduced on a friend's machine, linking fails when building with -Zbuild-std. It appears to be trying to link libstd twice, and results in a billion and one error messages, starting with the one below.

cargo +nightly build -Zbuild-std --target x86_64-unknown-linux-gnu -v

error: duplicate lang item in crate `core`: `bool`.
  |
  = note: the lang item is first defined in crate `core` (which `ldk` depends on)
  = note: first definition in `core` loaded from /home/matt/Documents/Projects/Bitcoin/ldk-c-bindings/lightning-c-bindings/target/x86_64-unknown-linux-gnu/debug/deps/libcore-0df5b54d697e5761.rlib, /home/matt/Documents/Projects/Bitcoin/ldk-c-bindings/lightning-c-bindings/target/x86_64-unknown-linux-gnu/debug/deps/libcore-0df5b54d697e5761.rmeta
  = note: second definition in `core` loaded from /home/matt/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-9924c22ae1efcf66.rlib
$ rustc +nightly --version --verbose
rustc 1.55.0-nightly (952fdf2a1 2021-07-05)
binary: rustc
commit-hash: 952fdf2a1119affa1b37bcacb0c49cf9f0168ac8
commit-date: 2021-07-05
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1
$ cargo +nightly --version --verbose
cargo 1.55.0-nightly (3ebb5f15a 2021-07-02)
release: 1.55.0
commit-hash: 3ebb5f15a940810f250b68821149387af583a79e
commit-date: 2021-07-02
@ehuss
Copy link
Contributor

ehuss commented Jul 7, 2021

Can you put together a small reproduction, or is there a public project where this happens?

@TheBlueMatt
Copy link
Author

Sorry for the delay, this should reproduce:

git clone https://git.bitcoin.ninja/ldk-c-bindings
cd ldk-c-bindings/
git checkout 2021-07-testcase
cd lightning-c-bindings
cargo +nightly build -Zbuild-std --target x86_64-unknown-linux-gnu -v

@ehuss
Copy link
Contributor

ehuss commented Jul 9, 2021

Ah. The reason is that it is using panic="abort". A workaround for now is to use -Zbuild-std=std,panic_abort.

I believe this is essentially the same as #56 (and #29), so closing in favor of those.

@ehuss ehuss closed this as completed Jul 9, 2021
TheBlueMatt added a commit to TheBlueMatt/ldk-c-bindings that referenced this issue Jul 9, 2021
TheBlueMatt added a commit to TheBlueMatt/ldk-c-bindings that referenced this issue Jul 9, 2021
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

2 participants