rustboot icon indicating copy to clipboard operation
rustboot copied to clipboard

Build issue on Arch Linux

Open nham opened this issue 11 years ago • 4 comments

Hi. I'm running Arch Linux, and while following the directions in the README, I'm unable to compile Rust master. I'm attempting to use the commands to minimize build time since I'm on a netbook and plain old "make" on Rust master takes several hours before I end up killing it.

So running this:

$ ./configure --target=i686-unknown-linux-gnu --llvm-root=/usr
$ make rustc-stage1

Results in the configure command succeeding, but "make rustc-stage1" failing thusly:

cp: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler-rt.a
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc
rustc: x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand
/home/nh/code/rust/src/librand/lib.rs:32:1: 32:19 error: multiple rlib candidates for `core` found
/home/nh/code/rust/src/librand/lib.rs:32 extern crate core;
                                         ^~~~~~~~~~~~~~~~~~
/home/nh/code/rust/src/librand/lib.rs:32:1: 32:19 note: candidate #1: /mnt/bits/code/rust/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c5ed6fb4-0.11.0-pre.rlib
/home/nh/code/rust/src/librand/lib.rs:32 extern crate core;
                                         ^~~~~~~~~~~~~~~~~~
/home/nh/code/rust/src/librand/lib.rs:32:1: 32:19 note: candidate #2: /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c5ed6fb4-0.11.0-pre.rlib
/home/nh/code/rust/src/librand/lib.rs:32 extern crate core;
                                         ^~~~~~~~~~~~~~~~~~
error: aborting due to previous error
/home/nh/code/rust/mk/target.mk:164: recipe for target 'x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/stamp.rand' failed
make: *** [x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/stamp.rand] Error 101

What is this I don't even.

Also, this is probably a stupid question, but is it necessary to compile Rust master in this way? I have thestinger's nightlies (http://pkgbuild.com/~thestinger/repo/x86_64/) installed, but rustboot make also fails:

make[1]: Entering directory '/mnt/bits/code/rustboot/arch/x86'
make[1]: *** No rule to make target 'config.mk'.  Stop.
make[1]: Leaving directory '/mnt/bits/code/rustboot/arch/x86'
make[1]: Entering directory '/mnt/bits/code/rustboot/arch/x86'
/usr/bin/rustc --target i686-unknown-linux-gnu -Z no-landing-pads --opt-level=2 -Z lto -L ./boot --out-dir ./boot --dep-info --emit=bc ../../common/lib.rs
../../common/lib.rs:6:1: 7:7 warning: phase(syntax) is a deprecated synonym for phase(plugin)
../../common/lib.rs:6 #[phase(syntax, link)]
../../common/lib.rs:7 extern crate core;
../../common/lib.rs:7:1: 7:19 error: can't find crate for `core`
../../common/lib.rs:7 extern crate core;
                      ^~~~~~~~~~~~~~~~~~
error: aborting due to previous error
../../common/Makefile:39: recipe for target 'boot/main.bc' failed
make[1]: *** [boot/main.bc] Error 101
make[1]: Leaving directory '/mnt/bits/code/rustboot/arch/x86'
Makefile:20: recipe for target 'all' failed
make: *** [all] Error 2

How can I solve these problems?

nham avatar Jun 23 '14 21:06 nham

  1. uninstall thestinger's nightlies
  2. or set RUST_ROOT to /usr and use nightlies

pczarn avatar Jun 23 '14 22:06 pczarn

For more context, stock rustc nighties can probably cross compile fine, but won't come with the std library compiled for the architectures rustboot runs. The README instructions have you build the compiler by hand to make sure you can cross compiler, and more importantly give you the libs you need.

Your first error when building the rust is because the boostrap libraries and thestinger-build libraries (native arch, needed to build the compiler itself) are both seen by the compiler, and it doesn't know which to chose.

Your second error is because you never built a libcore for the target architecture.

https://github.com/rust-lang/rfcs/pull/131 and/or something related should hopefully make cross compiling easier.

Ericson2314 avatar Jun 24 '14 03:06 Ericson2314

In case it helps, I just build the libcore crate directly from source in /common

alexchandel avatar Jun 25 '14 23:06 alexchandel

Yeah to be clear building libcore by hand should work, and avoids downloading the rust source.

Ericson2314 avatar Jun 26 '14 18:06 Ericson2314