Skip to content

fix rustc build with llvm head #96362

Description

@nico

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

Activity

  1. nikic commented on Apr 24, 2022

    @nikic
    Contributor

    There's a patch for this at #96215.

  2. added a commit that references this issue on Apr 24, 2022
    433f1f4
  3. nico commented on Apr 25, 2022

    @nico
    Author

    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.)

  4. nikic commented on Apr 25, 2022

    @nikic
    Contributor

    @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.

  5. nikic commented on Apr 25, 2022

    @nikic
    Contributor

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

  6. nico commented on Apr 25, 2022

    @nico
    Author

    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?

  7. nico commented on Apr 25, 2022

    @nico
    Author

    @chbaker0 too :)

  8. emilyalbini commented on Apr 29, 2022

    @emilyalbini
    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).

  9. added a commit that references this issue on May 12, 2022
  10. added a commit that references this issue on May 13, 2022
  11. added a commit that references this issue on Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions