Closed perlun closed 8 years ago
Correction: this is the error I'm getting with the most recent nightly. (Hadn't actually tried to compile your code, but was getting errors when copying the approach into my own project.)
/usr/local/bin/rustc -O -C code-model=kernel -C relocation-model=static --crate-type lib -o main.o --emit obj main.rs
main.rs:8:1: 8:19 error: an external crate named `core` has already been imported into this module [E0259]
main.rs:8 extern crate core;
^~~~~~~~~~~~~~~~~~
main.rs:8:1: 8:19 help: run `rustc --explain E0259` to see a detailed explanation
error: aborting due to previous error
make: *** [main.o] Error 101
The above is with rustc 1.4.0-beta (i.e. nightly). If I switch to the stable channel, I get this instead:
/usr/local/bin/rustc -O -C code-model=kernel -C relocation-model=static --crate-type lib -o main.o --emit obj main.rs
main.rs:1:1: 1:18 error: #[feature] may not be used on the stable release channel
main.rs:1 #![feature(core)]
^~~~~~~~~~~~~~~~~
main.rs:2:1: 2:26 error: #[feature] may not be used on the stable release channel
main.rs:2 #![feature(core_str_ext)]
^~~~~~~~~~~~~~~~~~~~~~~~~
main.rs:3:1: 3:18 error: #[feature] may not be used on the stable release channel
main.rs:3 #![feature(libc)]
^~~~~~~~~~~~~~~~~
main.rs:4:1: 4:20 error: #[feature] may not be used on the stable release channel
main.rs:4 #![feature(no_std)]
^~~~~~~~~~~~~~~~~~~
error: aborting due to 4 previous errors
make: *** [main.o] Error 101
I think it says the same if you try w/ the unstable channel as well.
You definitely need #![no_std]
for kernel code, and for now this is still feature gated, so it can't be used on the stable channel.
It does look like extern crate core;
and #![feature(core)]
aren't needed in main.rs
anymore.
Can the Makefile be replaced by cargo?
It seems like there have been a bit of changes, so that e.g.
#![feature(libc)]
and#![feature(core)]
aren't readily available any more. Are you able to compile this code yourself w/ rustc 1.2 or newer versions?