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

fix rustc build with llvm head #96362

Closed
nico opened this issue Apr 24, 2022 · 7 comments · Fixed by #96215
Closed

fix rustc build with llvm head #96362

nico opened this issue Apr 24, 2022 · 7 comments · Fixed by #96215
Labels
C-bug Category: This is a bug.

Comments

@nico
Copy link

nico commented Apr 24, 2022

building rust started failing like so:

rustc/x86_64-unknown-linux-gnu/release/build/rustc_llvm-475f372969e8d34a/out/llvm-wrapper/PassWrapper.o" "-c" "llvm-wrapper/PassWrapper.cpp"
   cargo:warning=llvm-wrapper/PassWrapper.cpp:124:15: error: use of undeclared identifier 'createAddressSanitizerFunctionPass'; did you mean 'createHWAddressSanitizerLegacyPassPass'?
   cargo:warning=  return wrap(createAddressSanitizerFunctionPass(CompileKernel, Recover, UseAfterScope));
   cargo:warning=              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cargo:warning=              createHWAddressSanitizerLegacyPassPass
   cargo:warning=/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h:54:1: note: 'createHWAddressSanitizerLegacyPassPass' declared here
   cargo:warning=createHWAddressSanitizerLegacyPassPass(bool CompileKernel = false,
   cargo:warning=^
   cargo:warning=llvm-wrapper/PassWrapper.cpp:130:15: error: use of undeclared identifier 'createModuleAddressSanitizerLegacyPassPass'; did you mean 'createHWAddressSanitizerLegacyPassPass'?
   cargo:warning=  return wrap(createModuleAddressSanitizerLegacyPassPass(CompileKernel, Recover));
   cargo:warning=              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cargo:warning=              createHWAddressSanitizerLegacyPassPass
   cargo:warning=/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h:54:1: note: 'createHWAddressSanitizerLegacyPassPass' declared here
   cargo:warning=createHWAddressSanitizerLegacyPassPass(bool CompileKernel = false,
   cargo:warning=^
   cargo:warning=llvm-wrapper/PassWrapper.cpp:136:15: error: use of undeclared identifier 'createMemorySanitizerLegacyPassPass'
   cargo:warning=  return wrap(createMemorySanitizerLegacyPassPass(
   cargo:warning=              ^
   cargo:warning=llvm-wrapper/PassWrapper.cpp:168:17: error: no member named 'populateThinLTOPassManager' in 'llvm::PassManagerBuilder'; did you mean 'populateModulePassManager'?
   cargo:warning=  unwrap(PMBR)->populateThinLTOPassManager(*unwrap(PMR));
   cargo:warning=                ^~~~~~~~~~~~~~~~~~~~~~~~~~
   cargo:warning=                populateModulePassManager
   cargo:warning=/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h:226:8: note: 'populateModulePassManager' declared here
   cargo:warning=  void populateModulePassManager(legacy::PassManagerBase &MPM);
   cargo:warning=       ^
   cargo:warning=4 errors generated.
   exit status: 1

Need to update rust code to work after https://reviews.llvm.org/D124216 (createAddressSanitizerFunctionPass, createModuleAddressSanitizerLegacyPassPass removal, https://reviews.llvm.org/D123882 populateThinLTOPassManager removal).

6234a56 has a related example.

@nikic Do you know if Augie (or anyone else) has a patch for this already?

@adetaylor

@nico nico added the C-bug Category: This is a bug. label Apr 24, 2022
@nikic
Copy link
Contributor

nikic commented Apr 24, 2022

There's a patch for this at #96215.

@nico
Copy link
Author

nico commented Apr 25, 2022

It builds now, but at least on our bots, src/test/ui/numeric/numeric-cast.rs fails with trunk LLVM: https://ci.chromium.org/ui/p/chromium/builders/try/linux_upload_clang/2200/overview => https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8815915618951615473/+/u/package_rust/stdout?format=raw

 {"message":"aborting due to 113 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 113 previous errors\n\n"}
 {"message":"For more information about this error, try `rustc --explain E0308`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0308`.\n"}
 thread '[ui] src/test/ui/numeric/numeric-cast.rs' panicked at 'explicit panic', src/tools/compiletest/src/json.rs:121:21
 
 
 failures:
     [ui] src/test/ui/numeric/numeric-cast.rs

(And many more lines of output before that.)

@nikic
Copy link
Contributor

nikic commented Apr 25, 2022

@nico Augie hit that as well. From the zulip discussion, this is due to #94322. The size of the output is sensitive to the length of the path the build is happening in.

@nikic
Copy link
Contributor

nikic commented Apr 25, 2022

#96229 is specifically about the interaction with JSON parsing that makes the failure extra non-obvious.

@nico
Copy link
Author

nico commented Apr 25, 2022

Hm, someone on #94322 says "#94327 should help with this specific instance", but that's been merged a while ago. So I guess #94322 covers something more general than the specific instance fixed by that change.

If the test doesn't consistently pass, the failure is understood, and a fix won't happen soon, maybe that test should be disabled for now?

@nico
Copy link
Author

nico commented Apr 25, 2022

@chbaker0 too :)

@pietroalbini
Copy link
Member

Opened #96551 to try and remove the nondeterminism based on the path length, which should alleviate the problem (it fixed the numeric-cast.rs tests at least).

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue May 12, 2022
…mulacrum

Add compiletest and bootstrap "--skip" option forwarded to libtest

With this PR,  "x.py test --skip SKIP ..." will run the specified test suite, but forward "--skip SKIP" to the test tool. libtest already supports this option. The PR also adds it to compiletest which itself just forwards it to libtest.

Adds the functionality requested in rust-lang#96342. This is useful to work around tests broken upstream.

rust-lang#96362 (comment) is the specific test issue my project is trying to work around.
bors added a commit to rust-lang-ci/rust that referenced this issue May 13, 2022
…lacrum

Add compiletest and bootstrap "--skip" option forwarded to libtest

With this PR,  "x.py test --skip SKIP ..." will run the specified test suite, but forward "--skip SKIP" to the test tool. libtest already supports this option. The PR also adds it to compiletest which itself just forwards it to libtest.

Adds the functionality requested in rust-lang#96342. This is useful to work around tests broken upstream.

rust-lang#96362 (comment) is the specific test issue my project is trying to work around.
bors added a commit to rust-lang-ci/rust that referenced this issue Jun 6, 2022
…iating, r=Mark-Simulacrum

[compiletest] Ignore known paths when abbreviating output

To prevent out of memory conditions, compiletest limits the amount of output a test can generate, abbreviating it if the test emits more than a threshold. While the behavior is desirable, it also causes some issues (like rust-lang#96229, rust-lang#94322 and rust-lang#92211).

The latest one happened recently, when the `src/test/ui/numeric/numeric-cast.rs` test started to fail on systems where the path of the rust-lang/rust checkout is too long. This includes my own development machine and [LLVM's CI](rust-lang#96362 (comment)). Rust's CI uses a pretty short directory name for the checkout, which hides these sort of problems until someone runs the test suite on their own computer.

When developing the fix I tried to find the most targeted fix that would prevent this class of failures from happening in the future, deferring the decision on if/how to redesign abbreviation to a later date. The solution I came up with was to ignore known base paths when calculating whether the output exceeds the abbreviation threshold, which removes this kind of nondeterminism.

This PR is best reviewed commit-by-commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants