Skip to content

x.py setup could detect llvm-config in the user's path and propose to set it #77579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alarsyo opened this issue Oct 5, 2020 · 8 comments
Closed
Assignees
Labels
A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@alarsyo
Copy link
Contributor

alarsyo commented Oct 5, 2020

New contributors might not necessarily need to recompile LLVM from scratch, especially if they already have a version on their system.

The setup script could detect the presence of llvm-config in the path and propose to set it automatically (this is common advice from here https://rustc-dev-guide.rust-lang.org/building/suggested.html#skipping-llvm-build)

@alarsyo alarsyo changed the title x.py setup x.py setup could detect llvm-config in the user's path and propose to set it Oct 5, 2020
@alarsyo
Copy link
Contributor Author

alarsyo commented Oct 5, 2020

@rustbot claim

I'm willing to work on this, if @jyn514 thinks it would be a useful addition

@jonas-schievink jonas-schievink added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Oct 5, 2020
@jyn514
Copy link
Member

jyn514 commented Oct 5, 2020

I would like to suggest download-ci-llvm on Linux. On Mac or windows I agree this is a good change, although installing llvm on windows sounds painful.

@jyn514 jyn514 added A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Oct 5, 2020
@Mark-Simulacrum
Copy link
Member

FWIW if you have a windows machine, looking into making download-ci-llvm work would be amazing, and likely benefit everyone using Windows since it'd "just work" presumably. I still need to find time to investigate on a mac (which I do have ready access to).

@alarsyo
Copy link
Contributor Author

alarsyo commented Oct 5, 2020

I'm on Linux, unfortunately, and don't have easy access to a Windows machine. I'll keep that in mind though :)

@alarsyo
Copy link
Contributor Author

alarsyo commented Oct 9, 2020

@jyn514 so on linux, do you want the setup to ask the user whether they want to use the CI-built llvm, or build their own? Or just add a download-ci-llvm = true for everyone by default in the templates?

@jyn514
Copy link
Member

jyn514 commented Oct 9, 2020

The templates in src/bootstrap/defaults are on every machine, so we can't add download-ci-llvm there - it would cause weird compile failures on Mac and Windows. What we can do instead is add it to the generated config.toml that setup creates.

Personally I think I'd always set download-ci-llvm = true on Linux without asking - the only reason you wouldn't is because it broke, but I think it's been working pretty reliably on linux. Maybe print out a message that you're downloading LLVM so they can debug issues if they go wrong?

@Mark-Simulacrum
Copy link
Member

I would be onboard with adding a download-ci-llvm = "if-available" or something like that; we can check if we're on x86_64-unknown-linux-gnu and use it then.

bors added a commit to rust-lang-ci/rust that referenced this issue Oct 15, 2020
Detect configuration for LLVM during setup

This is a first draft to address rust-lang#77579, setting `download-ci-llvm` to true on Linux, but I could also implement the `if-available` setting mentioned in the issue.

On other platforms I was thinking about using [the which crate](https://crates.io/crates/which), if adding a dependency on it is considered okay of course, to detect the presence of `llvm-config` in the path, and use it if found. Still a work in progress of course.
@jyn514
Copy link
Member

jyn514 commented Apr 30, 2021

I'm going to close this, download-ci-llvm should be working on every tier 1 platform and I'd rather recommend that than system llvm.

@jyn514 jyn514 closed this as completed Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

4 participants