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 'compiler_builtins'. Do I need this crate (Is the current README obsolete)? #275

Open
jlb6740 opened this issue Mar 13, 2019 · 0 comments

Comments

@jlb6740
Copy link

jlb6740 commented Mar 13, 2019

Hi ... I am not sure I need to use this crate. I am trying to build a rust based static library to link with a RTOS embedded application. Unfortunately I get all sorts of duplicate item errors (primarily compiler_builtins) when linking the rust static library (.a file) when compiling and linking with the image for the embedded device.

I've found that if I emit objects and link in the .o of my rust library before cargo xbuild based command links in compiler_intrinsics then I can almost get my embedded application to build, I just have one undefined reference of __rust_probstack. If I manually add this function by copying code from the compiler_builtin's source to my rust code for the static library I can get my embedded application to compile and at least start execution. I'd like to properly link in select compiler_builtin functions into my static library (.a file) without manually adding the code for __rust_probstack, but I am not having luck doing that. After reading the description, I was wondering if I could fine tune which functions I used from compiler_builtins by adding this crate. However when I add to my rust code:

#![feature(compiler_builtins_lib)]
extern crate compiler_builtins;

and add to my cargo.toml:

[dependencies.compiler_builtins]
git = "https://github.com/rust-lang-nursery/compiler-builtins"

I get a lot of duplicate lang item errors such as:
error: duplicate lang item in crate `compiler_builtins`: `i128_add`.
  |
  = note: first defined in crate `compiler_builtins`.

Obviously I do not know my way around the rust build system very well. I am having trouble understanding which blogs and instructions I am following are already obsolete for what I am looking to do. In particular it seems compiler_builtins are built and linked automatically as part of libcore so I am not sure how bringing in this crate could not cause these type of linking errors. Can someone help my understanding here? Also I am not sure how/when to consider dependencies on the stage0 vs stage1 vs stage2 rust compiler but is that important to understand and apply here? In what direction do I need to look for these compiler intrinsic linking woes.

@jlb6740 jlb6740 changed the title Duplicate lang item in crate 'compiler_builtins'. Do I need this crate? Duplicate lang item in crate 'compiler_builtins'. Do I need this crate (Is the current README obsolete)? Mar 14, 2019
tgross35 pushed 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

1 participant