Stream: t-compiler

Topic: Clang in run-make tests


mw (Dec 10 2018 at 13:36, on Zulip):

How hard would it be to make clang available for run-make tests? What would it take?

mw (Dec 10 2018 at 13:37, on Zulip):

(cc @simulacrum @kennytm @Pietro Albini @Alex Crichton)

mw (Dec 10 2018 at 13:38, on Zulip):

I'm talking about the clang that we already build for LLDB, i.e. a version that matches rustc's LLVM

kennytm (Dec 10 2018 at 13:38, on Zulip):

must it be "clang"? you could already use $(CC)

mw (Dec 10 2018 at 13:39, on Zulip):

Yes, it must be Clang

mw (Dec 10 2018 at 13:39, on Zulip):

the use case would be testing cross-language optimizations

simulacrum (Dec 10 2018 at 13:47, on Zulip):

If it's already built, should be quite easy... we don't have the budget to build it though

simulacrum (Dec 10 2018 at 13:47, on Zulip):

time wise

mw (Dec 10 2018 at 14:22, on Zulip):

I think it should cache very well via sccache. I don't know if we build the final executable currently, but we are building libclang for the LLDB component.

Alex Crichton (Dec 10 2018 at 18:34, on Zulip):

I don't think it'd be too too hard b/c we're already compiling the compiler's LLVM with clang on most builders

Alex Crichton (Dec 10 2018 at 18:34, on Zulip):

I suspect we'd probably add an opt-in flag to enable the tests but we could enable that on the bots

mw (Dec 11 2018 at 09:15, on Zulip):

It would have to be a clang that matches the LLVM version of rustc though.

mw (Dec 11 2018 at 14:31, on Zulip):

OK, I just did some testing and it seems that clang is already available in run-make-fulldeps because it ends up in the llvm/bin directory with the other LLVM tools. It's only built if rust.lldb is set in config.toml.

mw (Dec 11 2018 at 14:33, on Zulip):

I guess we don't want to build clang by default together with LLVM, so I'm wondering what the best option would be here.

mw (Dec 11 2018 at 14:35, on Zulip):

one thing we could do is:
1. provide a simple way for run-make tests to check whether clang is available and has the right version, and then
2. enable building lldb for some of the CI jobs

mw (Dec 11 2018 at 14:35, on Zulip):

that's a bit brittle though since if someone disables building lldb for some reason, tests would go ignored and no one would notice...

mw (Dec 11 2018 at 14:38, on Zulip):

is there a way to build clang "lazily", i.e. only when run-make-fulldeps is executed?

oli (Dec 11 2018 at 14:41, on Zulip):

You can probably make sure that https://github.com/rust-lang/rust/blob/master/src/bootstrap/test.rs#L733 gets a ensure method call for clang only when running run-make-fulldeps

mw (Dec 11 2018 at 14:58, on Zulip):

I don't think that quite works because we already need to know whether LLDB/Clang needs to be built when LLVM is being built. At least it looks like that in the current setup.

mw (Dec 11 2018 at 14:59, on Zulip):

see: https://github.com/rust-lang/rust/blob/3a3121337122637fa11f0e5d42aec67551e8c125/src/bootstrap/native.rs#L201

Last update: Nov 22 2019 at 04:30UTC