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

Missing tools in LLVM CI tarball #91710

Closed
nox opened this issue Dec 9, 2021 · 9 comments · Fixed by #91720
Closed

Missing tools in LLVM CI tarball #91710

nox opened this issue Dec 9, 2021 · 9 comments · Fixed by #91720
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Comments

@nox
Copy link
Contributor

nox commented Dec 9, 2021

I've rebased this morning and I can't build the repo anymore since #91685 landed.

Copy "/Users/nox/src/rust/build/x86_64-apple-darwin/ci-llvm/bin/llvm-dwp" to "/Users/nox/src/rust/build/x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/bin/rust-llvm-dwp"
Copy "/Users/nox/src/rust/build/x86_64-apple-darwin/ci-llvm/bin/llvm-cov" to "/Users/nox/src/rust/build/x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/bin/llvm-cov"
Copy "/Users/nox/src/rust/build/x86_64-apple-darwin/ci-llvm/bin/llvm-nm" to "/Users/nox/src/rust/build/x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/bin/llvm-nm"
thread 'main' panicked at 'src.symlink_metadata() failed with No such file or directory (os error 2)', src/bootstrap/lib.rs:1324:24

It seems there are missing tools in the LLVM CI tarball.

AFAICT, these are the tools CI copies in the tarball:

rust/src/bootstrap/dist.rs

Lines 2077 to 2087 in 3b263ce

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

And these are the tools bootstrap tries to install in build/:

rust/src/bootstrap/compile.rs

Lines 1169 to 1177 in 3b263ce

// Since we've already built the LLVM tools, install them to the sysroot.
// This is the equivalent of installing the `llvm-tools-preview` component via
// rustup, and lets developers use a locally built toolchain to
// build projects that expect llvm tools to be present in the sysroot
// (e.g. the `bootimage` crate).
for tool in LLVM_TOOLS {
let tool_exe = exe(tool, target_compiler.host);
builder.copy(&llvm_bin_dir.join(&tool_exe), &libdir_bin.join(&tool_exe));
}

LLVM_TOOLS being defined as:

rust/src/bootstrap/lib.rs

Lines 172 to 186 in 3b263ce

const LLVM_TOOLS: &[&str] = &[
"llvm-cov", // used to generate coverage report
"llvm-nm", // used to inspect binaries; it shows symbol names, their sizes and visibility
"llvm-objcopy", // used to transform ELFs into binary format which flashing tools consume
"llvm-objdump", // used to disassemble programs
"llvm-profdata", // used to inspect and merge files generated by profiles
"llvm-readobj", // used to get information from ELFs/objects that the other tools don't provide
"llvm-size", // used to prints the size of the linker sections of a program
"llvm-strip", // used to discard symbols from binary files to reduce their size
"llvm-ar", // used for creating and modifying archive files
"llvm-as", // used to convert LLVM assembly to LLVM bitcode
"llvm-dis", // used to disassemble LLVM bitcode
"llc", // used to compile LLVM bytecode
"opt", // used to optimize LLVM bytecode
];

As you can see, there are many tools in LLVM_TOOLS that are not included in that dist step shown above.

I'm on macOS, and here is the list of tools that I found in the downloaded LLVM CI tarball:

± tar tf build/cache/llvm-09d8a50ea26df391b58373e22f5891740efdd6cc-False/rust-dev-nightly-x86_64-apple-darwin.tar.xz 'rust-dev-nightly-*/rust-dev/bin/'
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin/llvm-profdata
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin/lld
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin/llvm-config
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin/FileCheck
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin/llvm-objdump
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin/llvm-dwp
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin/llvm-ar
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin/llvm-bcanalyzer
rust-dev-nightly-x86_64-apple-darwin/rust-dev/bin/llvm-cov

Cc @Aaron1011 who authored #91685.

@nox nox added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Dec 9, 2021
@Aaron1011
Copy link
Member

I think we should disable copying those tools under ci-llvm for now, and then decide if we want to include them in the ci-llvm artifact or not.

@Mark-Simulacrum
Copy link
Member

@Aaron1011 makes sense to me!

@nox
Copy link
Contributor Author

nox commented Dec 9, 2021

Actually the problem seems to be bigger, for now I disabled using the LLVM CI tarball locally and it still failed.

@Aaron1011
Copy link
Member

@nox What error are you getting with it disabled?

@nox
Copy link
Contributor Author

nox commented Dec 9, 2021

Exactly the same. I restarted the whole build after running git clean -dfx, I'll report back once (if) the error reproduces again.

@nox
Copy link
Contributor Author

nox commented Dec 9, 2021

Ah! The compiler profile sets download-ci-llvm to if-available, my bad, I'll explicitly override that to false in my config and the problem will probably go away. I should have noticed I didn't actually rebuild LLVM hah.

@Aaron1011
Copy link
Member

I'll open a PR to make copying the tools conditional on LLVM being built locally.

@jyn514
Copy link
Member

jyn514 commented Dec 9, 2021

Or just call builder.ensure, like I suggested originally ... I'm not sure why dist is being treated differently from all the other build commands.

@Aaron1011
Copy link
Member

@jyn514 Those tools don't exist in the downloaded archive, so ensure won't help here

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 9, 2021
…k-Simulacrum

Don't copy llvm tools to sysroot when using download-ci-llvm

Fixes rust-lang#91710
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 11, 2021
…Simulacrum

Don't copy llvm tools to sysroot when using download-ci-llvm

Fixes rust-lang#91710
@bors bors closed this as completed in faf407d Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants