Skip to content
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

download-ci-llvm does not include llvm-tblgen #86890

Closed
jyn514 opened this issue Jul 5, 2021 · 4 comments · Fixed by #102790
Closed

download-ci-llvm does not include llvm-tblgen #86890

jyn514 opened this issue Jul 5, 2021 · 4 comments · Fixed by #102790
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself A-cross Area: Cross compilation C-bug Category: This is a bug. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Jul 5, 2021

In particular, this means you have to rebuild llvm for the host when cross-compiling.

I tried this code: x build --host i686-unknown-linux-gnu.

I expected to see this happen: The compiler builds successfully.

Instead, this happened:

-- Build files have been written to: /home/joshua/rustc3/build/i686-unknown-linux-gnu/llvm/build
running: "cmake" "--build" "." "--target" "install" "--config" "Release" "--" "-j" "8"
ninja: error: '/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/llvm/bin/llvm-tblgen', needed by 'include/llvm/IR/Attributes.inc', missing and no known rule to make it
thread 'main' panicked at '
command did not execute successfully, got: exit status: 1

build script failed, must exit now', /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
	finished in 8.264 seconds
failed to run: /home/joshua/rustc3/build/bootstrap/debug/bootstrap build --host i686-unknown-linux-gnu
Build completed unsuccessfully in 0:00:09

I think there's a secondary bug which is that x.py hard-codes llvm instead of ci-llvm/. But that seems easier to fix.

Meta

rustc --version --verbose:

<version>
Backtrace

<backtrace>

@jyn514 jyn514 added C-bug Category: This is a bug. A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself A-cross Area: Cross compilation T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 5, 2021
@jyn514
Copy link
Member Author

jyn514 commented Mar 29, 2022

Mentoring instructions:

  1. Find where in src/bootstrap it generates the rust-dev component (I think I might be RustDev in dist.rs?)
  2. Add llvm-tblgen to the binaries that are copied
  3. Open a PR and ask someone to run @bors try, which will generate CI artifacts.
  4. Checkout the merge commit from the try build locally and confirm that x build --host i686-unknown-linux-gnu works successfully (or if you're not on Linux, some other platform that's binary compatible).

@jyn514
Copy link
Member Author

jyn514 commented Mar 29, 2022

@rustbot label: +E-mentor

@rustbot rustbot added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Mar 29, 2022
@bjorn3
Copy link
Member

bjorn3 commented Mar 30, 2022

Add llvm-tblgen to the binaries that are copied

Make sure to only copy it if it exists. It doesn't get build if the llvm backend isn't enabled.

@cuviper
Copy link
Member

cuviper commented Oct 7, 2022

Make sure to only copy it if it exists. It doesn't get build if the llvm backend isn't enabled.

It looks like RustDev unconditionally copies llvm binaries right now, so I think llvm-tblgen should be no different.

rust/src/bootstrap/dist.rs

Lines 2020 to 2033 in 43c22af

for bin in &[
"llvm-config",
"llvm-ar",
"llvm-objdump",
"llvm-profdata",
"llvm-bcanalyzer",
"llvm-cov",
"llvm-dwp",
"llvm-nm",
"llvm-dwarfdump",
"llvm-dis",
] {
tarball.add_file(src_bindir.join(exe(bin, target)), "bin", 0o755);
}

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 8, 2022
Fix llvm-tblgen for cross compiling

- Let llvm-config tell us where to find its tools
- Add llvm-tblgen to rust-dev for cross-compiling

Fixes rust-lang#86890.
r? `@jyn514`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 8, 2022
Fix llvm-tblgen for cross compiling

- Let llvm-config tell us where to find its tools
- Add llvm-tblgen to rust-dev for cross-compiling

Fixes rust-lang#86890.
r? ``@jyn514``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 8, 2022
Fix llvm-tblgen for cross compiling

- Let llvm-config tell us where to find its tools
- Add llvm-tblgen to rust-dev for cross-compiling

Fixes rust-lang#86890.
r? ```@jyn514```
@bors bors closed this as completed in 21c6a0e Oct 9, 2022
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 contributors to rust itself A-cross Area: Cross compilation C-bug Category: This is a bug. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants