ryanra/RustOS

Lazy-static.rs issue

Closed this issue · 4 comments

Hi everyone,

I'm new here, and just trying to compile, and it appears there's an issue with lazy-static.rs using the instructions as-is.

Here's my log replicating this issue:

charles@charles-desktop:/Projects$ git clone https://github.com/ryanra/RustOS.git
Cloning into 'RustOS'...
remote: Counting objects: 1267, done.
remote: Total 1267 (delta 0), reused 0 (delta 0), pack-reused 1267
Receiving objects: 100% (1267/1267), 647.38 KiB | 0 bytes/s, done.
Resolving deltas: 100% (666/666), done.
Checking connectivity... done.
charles@charles-desktop:
/Projects$ cd RustOS/
charles@charles-desktop:/Projects/RustOS$ ls
bump-pointer Cargo.toml default.nix lib LICENSE-APACHE LICENSE-MIT Makefile README.md src
charles@charles-desktop:
/Projects/RustOS$ git submodule update --init
Submodule 'lib/lazy-static.rs' (https://github.com/ryanra/lazy-static.rs.git) registered for path 'lib/lazy-static.rs'
Submodule 'lib/rlibc' (https://github.com/ryanra/rlibc.git) registered for path 'lib/rlibc'
Submodule 'lib/rust' (https://github.com/ryanra/rust.git) registered for path 'lib/rust'
Cloning into 'lib/lazy-static.rs'...
remote: Counting objects: 228, done.
remote: Total 228 (delta 0), reused 0 (delta 0), pack-reused 228
Receiving objects: 100% (228/228), 36.79 KiB | 0 bytes/s, done.
Resolving deltas: 100% (108/108), done.
Checking connectivity... done.
Submodule path 'lib/lazy-static.rs': checked out '79112dfebb520054a9758c2e2d1dfc5a6974101b'
Cloning into 'lib/rlibc'...
remote: Counting objects: 102, done.
remote: Total 102 (delta 0), reused 0 (delta 0), pack-reused 102
Receiving objects: 100% (102/102), 538.64 KiB | 0 bytes/s, done.
Resolving deltas: 100% (39/39), done.
Checking connectivity... done.
Submodule path 'lib/rlibc': checked out '5187c106a4c94c35757b7a535a0798f117313003'
Cloning into 'lib/rust'...
remote: Counting objects: 466065, done.
remote: Total 466065 (delta 0), reused 0 (delta 0), pack-reused 466065
Receiving objects: 100% (466065/466065), 284.09 MiB | 16.55 MiB/s, done.
Resolving deltas: 100% (377414/377414), done.
Checking connectivity... done.
Submodule path 'lib/rust': checked out 'd4b1462f9085984ec7874b3eb433f926b1ed7b54'
charles@charles-desktop:~/Projects/RustOS$ make run
as -march=i386 --32 -o boot.o src//arch/x86/boot.s
as -march=i386 --32 -o morestack.o src//morestack.s
ar rcs libmorestack.a morestack.o
as -march=i386 --32 -o compiler-rt.o src//dummy-compiler-rt.s
ar rcs libcompiler-rt.a compiler-rt.o
cc -E src//arch/x86/_context.S > src//arch/x86/_context.s
as -march=i386 --32 -o _context.o src//arch/x86/_context.s
ar rcs lib_context.a _context.o
cargo rustc --features rustos --target i686-unknown-linux-gnu --verbose -- -L .
Compiling lazy_static v0.1.11 (file:///home/charles/Projects/RustOS)
Running rustc lib/lazy-static.rs/src/lib.rs --crate-name lazy_static --crate-type lib -g -C metadata=225304fa1109fb54 -C extra-filename=-225304fa1109fb54 --out-dir /home/charles/Projects/RustOS/target/i686-unknown-linux-gnu/debug/deps --emit=dep-info,link --target i686-unknown-linux-gnu -L dependency=/home/charles/Projects/RustOS/target/i686-unknown-linux-gnu/debug/deps -L dependency=/home/charles/Projects/RustOS/target/i686-unknown-linux-gnu/debug/deps
Compiling core v0.0.1 (file:///home/charles/Projects/RustOS)
Running rustc lib/rust/cargo/core/src/lib.rs --crate-name core --crate-type lib -g -C metadata=6032dbdcded5b6cd -C extra-filename=-6032dbdcded5b6cd --out-dir /home/charles/Projects/RustOS/target/i686-unknown-linux-gnu/debug/deps --emit=dep-info,link --target i686-unknown-linux-gnu -L dependency=/home/charles/Projects/RustOS/target/i686-unknown-linux-gnu/debug/deps -L dependency=/home/charles/Projects/RustOS/target/i686-unknown-linux-gnu/debug/deps

lib/lazy-static.rs/src/lib.rs:1:1: 1:1 error: can't find crate for `core`
lib/lazy-static.rs/src/lib.rs:1 /*!
                                ^

error: aborting due to previous error
Build failed, waiting for other jobs to finish...

lib/rust/cargo/core/src/ops.rs:408:5: 408:24 error: associated type defaults are unstable
lib/rust/cargo/core/src/ops.rs:408     type Output = Self;
                                       ^~~~~~~~~~~~~~~~~~~

lib/rust/cargo/core/src/ops.rs:408:5: 408:24 help: add #![feature(associated_type_defaults)] to the crate attributes to enable
lib/rust/cargo/core/src/simd.rs:43:1: 46:50 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:43 pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
lib/rust/cargo/core/src/simd.rs:44 pub i8, pub i8, pub i8, pub i8,
lib/rust/cargo/core/src/simd.rs:45 pub i8, pub i8, pub i8, pub i8,
lib/rust/cargo/core/src/simd.rs:46 pub i8, pub i8, pub i8, pub i8);
lib/rust/cargo/core/src/simd.rs:52:1: 53:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:52 pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
lib/rust/cargo/core/src/simd.rs:53 pub i16, pub i16, pub i16, pub i16);
lib/rust/cargo/core/src/simd.rs:59:1: 59:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead

lib/rust/cargo/core/src/simd.rs:59 pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/rust/cargo/core/src/simd.rs:65:1: 65:36 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead

lib/rust/cargo/core/src/simd.rs:65 pub struct i64x2(pub i64, pub i64);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/rust/cargo/core/src/simd.rs:71:1: 74:50 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:71 pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
lib/rust/cargo/core/src/simd.rs:72 pub u8, pub u8, pub u8, pub u8,
lib/rust/cargo/core/src/simd.rs:73 pub u8, pub u8, pub u8, pub u8,
lib/rust/cargo/core/src/simd.rs:74 pub u8, pub u8, pub u8, pub u8);
lib/rust/cargo/core/src/simd.rs:80:1: 81:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:80 pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
lib/rust/cargo/core/src/simd.rs:81 pub u16, pub u16, pub u16, pub u16);
lib/rust/cargo/core/src/simd.rs:87:1: 87:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead

lib/rust/cargo/core/src/simd.rs:87 pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/rust/cargo/core/src/simd.rs:93:1: 93:36 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead

lib/rust/cargo/core/src/simd.rs:93 pub struct u64x2(pub u64, pub u64);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/rust/cargo/core/src/simd.rs:99:1: 99:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead

lib/rust/cargo/core/src/simd.rs:99 pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lib/rust/cargo/core/src/simd.rs:105:1: 105:36 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead

lib/rust/cargo/core/src/simd.rs:105 pub struct f64x2(pub f64, pub f64);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error
Could not compile lazy_static.

Caused by:
Process didn't exit successfully: rustc lib/lazy-static.rs/src/lib.rs --crate-name lazy_static --crate-type lib -g -C metadata=225304fa1109fb54 -C extra-filename=-225304fa1109fb54 --out-dir /home/charles/Projects/RustOS/target/i686-unknown-linux-gnu/debug/deps --emit=dep-info,link --target i686-unknown-linux-gnu -L dependency=/home/charles/Projects/RustOS/target/i686-unknown-linux-gnu/debug/deps -L dependency=/home/charles/Projects/RustOS/target/i686-unknown-linux-gnu/debug/deps (exit code: 101)
make: ** [target/i686-unknown-linux-gnu/debug/librustos.a] Error 101
rm morestack.o _context.o src//arch/x86/_context.s

Can anyone help me get this working?

Thanks,
Charles

What version of rustc did you use for the compile? (Post the output of rustc --version)

I'm running rustc 1.6.0-nightly (1a2eaffb6 2015-10-31)
and I get a similar error:

$ make run
as -march=i386 --32 -o boot.o src//arch/x86/boot.s
as -march=i386 --32 -o morestack.o src//morestack.s
ar rcs libmorestack.a morestack.o
as -march=i386 --32 -o compiler-rt.o src//dummy-compiler-rt.s
ar rcs libcompiler-rt.a compiler-rt.o
cc -E src//arch/x86/_context.S > src//arch/x86/_context.s
as -march=i386 --32 -o _context.o src//arch/x86/_context.s
ar rcs lib_context.a _context.o
cargo rustc --features rustos --target i686-unknown-linux-gnu --verbose -- -L .
Compiling lazy_static v0.1.11 (file:///home/fviscomi/workspace/RustOS)
Running rustc lib/lazy-static.rs/src/lib.rs --crate-name lazy_static --crate-type lib -g -C metadata=60b0f8fbe3da5d37 -C extra-filename=-60b0f8fbe3da5d37 --out-dir /home/fviscomi/workspace/RustOS/target/i686-unknown-linux-gnu/debug/deps --emit=dep-info,link --target i686-unknown-linux-gnu -L dependency=/home/fviscomi/workspace/RustOS/target/i686-unknown-linux-gnu/debug/deps -L dependency=/home/fviscomi/workspace/RustOS/target/i686-unknown-linux-gnu/debug/deps
Compiling core v0.0.1 (file:///home/fviscomi/workspace/RustOS)
Running rustc lib/rust/cargo/core/src/lib.rs --crate-name core --crate-type lib -g -C metadata=216513b79742f6df -C extra-filename=-216513b79742f6df --out-dir /home/fviscomi/workspace/RustOS/target/i686-unknown-linux-gnu/debug/deps --emit=dep-info,link --target i686-unknown-linux-gnu -L dependency=/home/fviscomi/workspace/RustOS/target/i686-unknown-linux-gnu/debug/deps -L dependency=/home/fviscomi/workspace/RustOS/target/i686-unknown-linux-gnu/debug/deps
lib/lazy-static.rs/src/lib.rs:1:1: 1:1 error: can't find crate for core [E0463]
lib/lazy-static.rs/src/lib.rs:1 /*!
^
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
lib/rust/cargo/core/src/ops.rs:408:5: 408:24 error: associated type defaults are unstable
lib/rust/cargo/core/src/ops.rs:408 type Output = Self;
^~~~~~~~~~~~~~~~~~~
lib/rust/cargo/core/src/ops.rs:408:5: 408:24 help: add #![feature(associated_type_defaults)] to the crate attributes to enable
lib/rust/cargo/core/src/simd.rs:43:1: 46:50 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:43 pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
lib/rust/cargo/core/src/simd.rs:44 pub i8, pub i8, pub i8, pub i8,
lib/rust/cargo/core/src/simd.rs:45 pub i8, pub i8, pub i8, pub i8,
lib/rust/cargo/core/src/simd.rs:46 pub i8, pub i8, pub i8, pub i8);
lib/rust/cargo/core/src/simd.rs:52:1: 53:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:52 pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
lib/rust/cargo/core/src/simd.rs:53 pub i16, pub i16, pub i16, pub i16);
lib/rust/cargo/core/src/simd.rs:59:1: 59:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:59 pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/rust/cargo/core/src/simd.rs:65:1: 65:36 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:65 pub struct i64x2(pub i64, pub i64);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/rust/cargo/core/src/simd.rs:71:1: 74:50 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:71 pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
lib/rust/cargo/core/src/simd.rs:72 pub u8, pub u8, pub u8, pub u8,
lib/rust/cargo/core/src/simd.rs:73 pub u8, pub u8, pub u8, pub u8,
lib/rust/cargo/core/src/simd.rs:74 pub u8, pub u8, pub u8, pub u8);
lib/rust/cargo/core/src/simd.rs:80:1: 81:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:80 pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
lib/rust/cargo/core/src/simd.rs:81 pub u16, pub u16, pub u16, pub u16);
lib/rust/cargo/core/src/simd.rs:87:1: 87:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:87 pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/rust/cargo/core/src/simd.rs:93:1: 93:36 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:93 pub struct u64x2(pub u64, pub u64);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/rust/cargo/core/src/simd.rs:99:1: 99:54 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:99 pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/rust/cargo/core/src/simd.rs:105:1: 105:36 warning: the #[simd] attribute is deprecated, use #[repr(simd)] instead
lib/rust/cargo/core/src/simd.rs:105 pub struct f64x2(pub f64, pub f64);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile lazy_static.

Caused by:
Process didn't exit successfully: rustc lib/lazy-static.rs/src/lib.rs --crate-name lazy_static --crate-type lib -g -C metadata=60b0f8fbe3da5d37 -C extra-filename=-60b0f8fbe3da5d37 --out-dir /home/fviscomi/workspace/RustOS/target/i686-unknown-linux-gnu/debug/deps --emit=dep-info,link --target i686-unknown-linux-gnu -L dependency=/home/fviscomi/workspace/RustOS/target/i686-unknown-linux-gnu/debug/deps -L dependency=/home/fviscomi/workspace/RustOS/target/i686-unknown-linux-gnu/debug/deps (exit code: 101)
make: ** [target/i686-unknown-linux-gnu/debug/librustos.a] Error 101
rm morestack.o _context.o src//arch/x86/_context.s

The problem is that the repo is old and will not work with the nightly build of rustc.

The head is built with Rust 1.2.0-nightly and other versions are untested. I've been meaning to update the code-base but haven't gotten around to it, so unless you can get that version in the meantime, things won't work.

Alright I updated everything to rustc 1.6.0-nightly (1e3e7e73c 2015-11-07). It should work -- please reopen issue if it doesn't.