Stream: general

Topic: cant-build-stage1-libcore


Dale Wijnand (Sep 12 2018 at 14:14, on Zulip):

Hey. So I'm trying to get started hacking on rustc, but I can't even build the compiler. I've read CONTRIBUTING.md and the rustc-guide. I've unset RUSTC_WRAPPER, I'm not using RUSTFLAGS, and I'm not using a config.toml. I've been chatting with @eddyb in #compiler on Discord. I had it working, then in running some experiments with Eddy, now I can't get it compiling any more. Here's what I'm seeing running ./x.py build -i --verbose: https://gist.github.com/dwijnand/2335a671d417a1e4d7a5a14d61cfde9c. Any ideas?

Wesley Wiser (Sep 12 2018 at 14:21, on Zulip):

Is this on a clean checkout or do you have local modifications?

pnkfelix (Sep 12 2018 at 14:26, on Zulip):

I doubt this is related, but if you're trying to get yourself off the ground, maybe kill off the -i flag for now.

pnkfelix (Sep 12 2018 at 14:28, on Zulip):

this definitely seems weird though

pnkfelix (Sep 12 2018 at 14:28, on Zulip):

it looks like cargo complained about an inability to parse the output from one of the rustc commands it invoked; maybe try running that rustc invocation yourself and see what output it produces

pnkfelix (Sep 12 2018 at 14:28, on Zulip):

I'm referring to this line here: https://gist.github.com/dwijnand/2335a671d417a1e4d7a5a14d61cfde9c#file-gistfile1-txt-L616

Wesley Wiser (Sep 12 2018 at 14:30, on Zulip):

I've seen similar messages after adding println!() statements in the compiler. It's this issue https://github.com/rust-lang/rust/issues/43855

Dale Wijnand (Sep 12 2018 at 14:32, on Zulip):

Ah yes, I've got printlns!

Dale Wijnand (Sep 12 2018 at 14:32, on Zulip):

Re-running without :)

Wesley Wiser (Sep 12 2018 at 14:33, on Zulip):

If you switch those to eprintln!() that should fix it. Or you can use the debug!() logging

Dale Wijnand (Sep 12 2018 at 14:34, on Zulip):

Any pros/cons there? When I tried all 3 last time only println!() worked.

Wesley Wiser (Sep 12 2018 at 14:36, on Zulip):

I'm not aware of any real downsides to eprintln!() other than it will always print. debug!() gives you more control but you have to turn it on.

Wesley Wiser (Sep 12 2018 at 14:37, on Zulip):

There's more info on debug!() here https://rust-lang-nursery.github.io/rustc-guide/compiler-debugging.html#getting-logging-output

Wesley Wiser (Sep 12 2018 at 14:38, on Zulip):

I'll just copy this here because it's easy to glance over and if you miss it, you'll waste 20+ minutes waiting for a rebuild:

make sure that debug-assertions=yes is turned on in your config.toml

Dale Wijnand (Sep 12 2018 at 14:38, on Zulip):

Thank you.

Dale Wijnand (Sep 12 2018 at 16:08, on Zulip):

Does debug!()/RUST_LOG work with ./x.py test? I'd like to add some debug messages and see what they print while running my tests.

davidtwco (Sep 12 2018 at 16:10, on Zulip):

You need to compile with a config.toml where debug-assertions = true (I think that's the key, check the comments). After that, RUST_LOG will work.

Dale Wijnand (Sep 12 2018 at 16:11, on Zulip):

I have debug-assertions = true, but I'm not seeing my messages..

davidtwco (Sep 12 2018 at 16:11, on Zulip):

I found that I had to compile the whole compiler with it for it to work.

davidtwco (Sep 12 2018 at 16:11, on Zulip):

(that was a while ago, and I've just did it that way since, so there might be a quicker way)

davidtwco (Sep 12 2018 at 16:12, on Zulip):

Often you don't want that RUST_LOG while running all the tests, you'll instead run them with no logging and x.py and then run individual tests directly with rustc and use RUST_LOG then (saves your scrollback).

Dale Wijnand (Sep 12 2018 at 16:12, on Zulip):

Yeah I guess I'll go that way

Dale Wijnand (Sep 12 2018 at 16:13, on Zulip):

I've successfully avoid having to do the local/custom rustup toolchain till now

davidtwco (Sep 12 2018 at 16:13, on Zulip):

I've never needed to set up a local rustup toolchain when working on the compiler.

davidtwco (Sep 12 2018 at 16:13, on Zulip):

Normally you can just run rustc from the build directory.

Wesley Wiser (Sep 12 2018 at 16:15, on Zulip):

It's really pretty easy. The last time I did it, I wrote this up so I can just copy-paste in the future https://wesleywiser.github.io/post/custom-rust-toolchain/

lqd (Sep 12 2018 at 16:16, on Zulip):

(or in the guide as well)

davidtwco (Sep 12 2018 at 16:17, on Zulip):

I had no idea that was mentioned in the guide.

Dale Wijnand (Sep 12 2018 at 16:18, on Zulip):

Yup, all setup. I was just lazy.

davidtwco (Sep 12 2018 at 16:18, on Zulip):

Are the toolchain paths relative so it would work in any of my rustc directories or do I need to make a toolchain per rustc directory?

lqd (Sep 12 2018 at 16:18, on Zulip):

1 think they're absolute so 1 per rustc directory would be my guess (but I don't know :)

Wesley Wiser (Sep 12 2018 at 16:19, on Zulip):

Well your shell will expand relative paths before passing them to rustup I think

davidtwco (Sep 12 2018 at 16:19, on Zulip):

Makes sense. In that case I'll stick with just specifying the path to rustc in the build directory.

Wesley Wiser (Sep 12 2018 at 16:19, on Zulip):

I have one per rustc directory

Dale Wijnand (Sep 12 2018 at 16:20, on Zulip):

Look in ~/.rustup/toolchains. They're absolute for me:

├── [lrwxr-xr-x dnw      staff      40 Sep 12 17:15]  stage1 -> /d/rust/build/x86_64-apple-darwin/stage1/
├── [lrwxr-xr-x dnw      staff      40 Sep 12 17:15]  stage2 -> /d/rust/build/x86_64-apple-darwin/stage2/
Last update: Nov 21 2019 at 23:50UTC