Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Work around https://github.com/bazelbuild/bazel/issues/3828 #130

Merged
merged 3 commits into from
Mar 10, 2021

Conversation

scentini
Copy link
Contributor

@scentini scentini commented Jan 7, 2021

Current Bazel has a bug (bazelbuild/bazel#3828) when using strip_include_prefix that causes Bazel to erroneosly report a missing dependency declaration.

This bug shows up when trying to bazel build @llvm-project//llvm:NVPTXCodeGen:

 undeclared inclusion(s) in rule '@llvm-project//llvm:NVPTXCodeGen':
this rule is missing dependency declarations for the following files included by 'external/llvm-project/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp':
  'external/llvm-project/llvm/lib/Target/NVPTX/TargetInfo/NVPTXTargetInfo.h'

This has been fixed in bazelbuild/bazel@e3b7e17. This PR is a workaround until we have a Bazel version that contains the fix.

@scentini
Copy link
Contributor Author

scentini commented Jan 7, 2021

cc @mihaimaruseac

Copy link
Contributor

@GMNGeoffrey GMNGeoffrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch!

Are you able to reproduce this issue just with

bazel build @llvm-project//llvm:NVPTXCodeGen ?

I can't on Linux Debian, although I have heard reports from people building on Windows. Note that I'm building with --config=generic_clang. At least some config is required, since that sets the C++ standard and such and I don't think there's anything in generic_clang that would somehow fix this issue.

llvm-bazel/llvm-project-overlay/llvm/BUILD Show resolved Hide resolved
@mihaimaruseac
Copy link
Member

I am able to reproduce on the Linux work desktop using that build command. Will apply patch manually and validate, after a the remaining meetings for today.

Thank you very much for the patch.

@GMNGeoffrey
Copy link
Contributor

I am able to reproduce on the Linux work desktop using that build command. Will apply patch manually and validate, after a the remaining meetings for today.

Thank you very much for the patch.

Huh. What config are you using? I don't get the issue with either generic_clang or generic_gcc. I'm curious what's different about your setup vs mine, since I think we're running the exact same OS. Are you building directly in llvm-bazel itself or through TF?

@mihaimaruseac
Copy link
Member

This seems to make bazel build @llvm-project//llvm:NVPTXCodeGen work on my system. Trying to build TF now.

@GMNGeoffrey it is through TF, via Bazel. I can send more details via chat.

@GMNGeoffrey
Copy link
Contributor

This seems to make bazel build @llvm-project//llvm:NVPTXCodeGen work on my system. Trying to build TF now.

@GMNGeoffrey it is through TF, via Bazel. I can send more details via chat.

Ok well I don't understand why that would make a difference, but that at least explains what's different about how you're building :-D

@chandlerc, is adding these includes back in going to mess up the build on OSX? Can you test it out?

@mihaimaruseac
Copy link
Member

Any updates? I cannot apply the patch via Bazel patching when fetching the repository :(

@GMNGeoffrey GMNGeoffrey requested a review from chandlerc January 19, 2021 22:38
@GMNGeoffrey
Copy link
Contributor

@chandlerc waiting for you input here

Any updates? I cannot apply the patch via Bazel patching when fetching the repository :(

Why not?

@mihaimaruseac
Copy link
Member

Wait, the problem was on my side, I was patching the wrong project. Seems to be working now.

@mihaimaruseac
Copy link
Member

So I think we no longer need this as I can patch TF. In fact, it seems we need to patch in several more places, depending on environment (Windows build fails on a different place)

@GMNGeoffrey
Copy link
Contributor

So I think we no longer need this as I can patch TF. In fact, it seems we need to patch in several more places, depending on environment (Windows build fails on a different place)

If this is indeed a fix for a Bazel bug, we should fix it here. I just want to check that it doesn't break other things in the process

@mihaimaruseac
Copy link
Member

Bazel 4.0 that has been released in the past 24 hours no longer has the issue (it has the proper fix inside Bazel)

@mihaimaruseac
Copy link
Member

Actually it seems Bazel 4.0 still has the same issue, after testing with the TF patch removed

@GMNGeoffrey
Copy link
Contributor

Actually it seems Bazel 4.0 still has the same issue, after testing with the TF patch removed

I don't see anything about this fix in the release notes. Maybe it's not included?

@GMNGeoffrey
Copy link
Contributor

@scentini can you comment on whether this is supposed to be in Bazel 4.0?

@scentini
Copy link
Contributor Author

No, the 4.0 baseline is a couple of days older than the fix, we'll need to wait for the next release.

Copy link
Contributor

@GMNGeoffrey GMNGeoffrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't heard from Chandler. I'm going to merge this.

@GMNGeoffrey GMNGeoffrey enabled auto-merge (squash) March 10, 2021 00:43
@GMNGeoffrey GMNGeoffrey merged commit 5d2cd83 into google:main Mar 10, 2021
lelandjansen pushed a commit to lelandjansen/llvm-bazel that referenced this pull request May 2, 2021
Current Bazel has a bug (bazelbuild/bazel#3828) when using `strip_include_prefix` that causes Bazel to erroneously report a missing dependency declaration.

This bug shows up when trying to `bazel build @llvm-project//llvm:NVPTXCodeGen`:
```
 undeclared inclusion(s) in rule '@llvm-project//llvm:NVPTXCodeGen':
this rule is missing dependency declarations for the following files included by 'external/llvm-project/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp':
  'external/llvm-project/llvm/lib/Target/NVPTX/TargetInfo/NVPTXTargetInfo.h'
```

This has been fixed in bazelbuild/bazel@e3b7e17. This PR is a workaround until we have a Bazel version that contains the fix.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants