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

Building alloc does not work with included compiler_builtins #214

Open
phil-opp opened this issue Apr 10, 2018 · 6 comments
Open

Building alloc does not work with included compiler_builtins #214

phil-opp opened this issue Apr 10, 2018 · 6 comments

Comments

@phil-opp
Copy link

The compiler_builtins crate is now explicitly injected. When building the alloc crate via a [dependencies.alloc] key in the Xargo.toml, a “multiple matching crates for compiler_builtins” error occurs. The reason is that alloc defines its own compiler_builtins dependency. Thus compiler_builtins in compiled twice, once as version 0.0.0 and once as version 0.1.0.

@robert-w-gries
Copy link

With latest xargo and nightly rustc, I saw the same error.

To fix it, I removed all references to compiler_bultins in my Xargo.toml and src/lib.rs.

diff --git a/Xargo.toml b/Xargo.toml
index a16927a..cb49458 100644
--- a/Xargo.toml
+++ b/Xargo.toml
@@ -3,9 +3,3 @@ alloc = {}
 
 [target.x86_64-rxinu.dependencies]
 alloc = {}
-
-[dependencies.core]
-stage = 0
-
-[dependencies.compiler_builtins]
-stage = 1
diff --git a/src/lib.rs b/src/lib.rs
index dae5ba2..dc9ec7f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,7 +4,6 @@
 #![feature(const_fn)]
 #![feature(const_max_value)]
 #![feature(const_unique_new, const_atomic_usize_new)]
-#![feature(compiler_builtins_lib)]
 #![feature(const_fn)]
 #![feature(lang_items)]
 #![feature(naked_functions)]
@@ -25,7 +24,6 @@ extern crate lazy_static;
 extern crate once;
 
 extern crate bit_field;
-extern crate compiler_builtins;
 extern crate linked_list_allocator;
 extern crate multiboot2;
 extern crate rlibc;

Current Xargo.toml

[target.i686-rxinu.dependencies]
alloc = {}

[target.x86_64-rxinu.dependencies]
alloc = {}

@lachlansneff
Copy link

@robert-w-gries That's also what I did.

@robert-w-gries
Copy link

I see that my workaround does not work if you want to use the compiler_builtins mem feature.

My project uses the rlibc crate, which is why I could remove compiler_builtins from my Xargo.toml without issue.

@phil-opp
Copy link
Author

phil-opp commented May 6, 2018

I created a simplified fork of xargo at rust-osdev/cargo-xbuild, which just always compiles core, compiler_builtins and alloc without configuration ability. The advantage of hard-coding those is that we can hack the alloc compilation so that it uses compiler_builtins with the "mem" feature.

@lachlansneff @robert-w-gries Could you try if this works for you?

@robert-w-gries
Copy link

cargo install cargo-xbuild and cargo xbuild --target x86_64-rxinu.json worked without issue for me.

Was there anything else you wanted me to test? I'm not sure if I need to do something more on my end to make sure the following works:

The advantage of hard-coding those is that we can hack the alloc compilation so that it uses compiler_builtins with the "mem" feature.

@phil-opp
Copy link
Author

phil-opp commented May 7, 2018

Was there anything else you wanted me to test? I'm not sure if I need to do something more on my end to make sure the following works:

You should be able to remove the rlibc dependency.

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

3 participants