Stream: t-compiler/help

Topic: Reason for in-tree LLVM?


osa1 (Nov 26 2019 at 15:49, on Zulip):

Hi all. I'm trying to make it faster to re-build rustc after a ./x.py clean (or git clean -xfd etc.). rustc guide shows a way to use system LLVM which I haven't tried it yet, but I'm wondering why we need to build LLVM from source if standard LLVM dists work. I think rustc guide doesn't say. Can I always use LLVM 7 to bootstrap rustc, or are there any features that won't work or tests that fail if I do that?

(Sorry if this is not the right place for this question! Let me know if that's the case and I'll ask elsewhere)

Christian Poveda (Nov 26 2019 at 15:49, on Zulip):

I'm using llvm9 and it works

Christian Poveda (Nov 26 2019 at 15:50, on Zulip):

you can set it in config.toml there is a field with the llvm-config path

osa1 (Nov 26 2019 at 15:52, on Zulip):

Thanks. I have LLVM 8 installed and I'm trying with that currently. The question mainly is what do I lose by using system LLVM instead of in-tree.

osa1 (Nov 26 2019 at 15:54, on Zulip):

Hmm, I'm getting

thread 'main' panicked at 'FileCheck executable "/usr/lib/llvm-8/bin/FileCheck" does not exist', src/bootstrap/sanity.rs:167:9
osa1 (Nov 26 2019 at 15:55, on Zulip):

NVM fixed.

nagisa (Nov 26 2019 at 16:08, on Zulip):

We have a couple of patches in our fork of LLVM that are rust specific. Sometimes they can be critical for Rust to produce working machine code while we wait for upstream to catch up

nagisa (Nov 26 2019 at 16:08, on Zulip):

but currently its just a few patches that e.g. enable dead allocations to be removed by making llvm know about our symbol names.

osa1 (Nov 26 2019 at 16:13, on Zulip):

OK, thanks. Do we have a specified LLVM version that's supposed to work when booting rustc? Or is only the in-tree one is officially supported? I'm currently trying with LLVM 8 but build fails when building rustc_llvm.

nagisa (Nov 26 2019 at 16:18, on Zulip):

we used to support back to LLVM 6 back when we needed emscripten to work, but now that it is no longer the case, I believe the only version we actively maintain support for is the in-tree one. The same release of external LLVM should in most cases still work.

Christian Poveda (Nov 26 2019 at 16:20, on Zulip):

I suppose that an alternative is having the llvm repository locally, build it and point to it in the config.toml. You can rebuild it once in a while

rkruppe (Nov 26 2019 at 18:30, on Zulip):

FWIW we do have a CI builder that tests on Linux with LLVM 6, so it should not break at least on that platform. I don't expect we'll get rid of that any time soon, either, since some Linux distros package rustc with their system LLVM instead of our fork.

osa1 (Nov 26 2019 at 18:59, on Zulip):

Update: I was able to build rustc with LLVM 9 (failed to build with 7 and 8).

Last update: Dec 12 2019 at 00:45UTC