riscv-rust/riscv-rust-toolchain

Fail to `make rust` due to trying to install things without permissions

aaazalea opened this issue · 3 comments

Currently trying to install on Ubuntu 16.04 with the default variables.

$ make rust
python2 rust/x.py install
Updating only changed submodules
<snip snip, build stuff, copy stuff, document stuff, generate stuff>
Install docs stage2 (Some("x86_64-unknown-linux-gnu"))
touch: cannot touch '/usr/local/lib/rust-install-probe': Permission denied
install: error: can't write to destination. consider `sudo`.


command did not execute successfully: "sh" "/home/jakobw/riscv/riscv-rust-toolchain/build/tmp/dist/rust-docs-1.26.0-dev-x86_64-unknown-linux-gnu/install.sh" "--prefix=/usr/local" "--sysconfdir=/etc" "--datadir=/usr/local/share" "--docdir=/usr/local/share/doc/rust" "--bindir=/usr/local/bin" "--libdir=/usr/local/lib" "--mandir=/usr/local/share/man" "--disable-ldconfig"
expected success, got: exit code: 1

failed to run: /home/jakobw/riscv/riscv-rust-toolchain/build/bootstrap/debug/bootstrap install
Build completed unsuccessfully in 0:00:40
Makefile:73: recipe for target 'rust-build' failed
make: *** [rust-build] Error 1

I was able to get slightly farther with this patch:

diff --git a/Makefile b/Makefile
index 286f361..b5ff0a2 100644
--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,7 @@ $(sysroot_dir)/bin/cc:
        ln -s $(shell which gcc) $(sysroot_dir)/bin/cc
 
 rust-build: $(sysroot_dir)/bin/cc
+       rust/configure --prefix=$(rust_dest)
        python2 rust/x.py install
 $(rust_dest)/bin/rustc: rust-build
 rust: $(rust_dest)/bin/rustc

although the root Makefile then gets overwritten with some rust Makefile so there are some other weird things going on here... At least I end up with a working ./toolchain/bin/rustc although I then hit #26 as well...

I wonder if the root cause is #25, namely that we are missing some rust patches which are needed to get all this working. Since the submodule commit 842ce79133db9632aaf9f7b4720e9bcb88e3914a doesn't exist anywhere, I just guessed and went with the riscv-rust-master branch from https://github.com/riscv-rust/rust. Maybe you did the same. But I guess that doesn't have everything we need...

This isn't the recommended way to get a working rust toolchain anymore. The reason why the commit doesn't exist is due to rebasing on rust upstream. LLVM is replaced in the current riscv-rust to directly build the riscv-llvm. You can build rust how you'd usually do it... python x.py build

Good to know.

Here is a PR to make a note of that in the README: #27