This is an archive of the discontinued LLVM Phabricator instance.

Fix bazel build --incompatible_no_implicit_file_export
ClosedPublic

Authored by Benoit on Jun 8 2023, 7:39 PM.

Details

Summary

The Bazel build relies, for the two files enumerated in this diff, on the legacy implicit-export semantics described here:
https://bazel.build/reference/be/functions#exports_files

This documentation page encourages migrating away from this legacy behavior, and indeed we have a user who reported a Bazel build error and it appears that they were already using the new, stricter behavior:
https://github.com/openxla/iree/pull/13982
and while examining fixes on our side and trying to get a clean Bazel build, I ran into this similar issue in the LLVM overlay.

It would arguably be cleaner (in the sense of more structured) to rely on filegroup to export this, but I am insufficiently familiar with the Clang build (the dependent targets seem to be below Clang) to do this myself. The present exports_files solution has the merit of being localized in these few lines here.

Diff Detail

Event Timeline

Benoit created this revision.Jun 8 2023, 7:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2023, 7:39 PM
Herald added a subscriber: hanchung. · View Herald Transcript
Benoit requested review of this revision.Jun 8 2023, 7:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2023, 7:39 PM
GMNGeoffrey accepted this revision.Jun 13 2023, 3:40 PM
GMNGeoffrey added a subscriber: aeubanks.

Let's turn this flag on in the CI @aeubanks. We could maybe just put it in the bazelrc?

This revision is now accepted and ready to land.Jun 13 2023, 3:40 PM

yeah in the bazelrc is good (not sure if these incompatible flags are present in all supported bazel versions though?)

yeah in the bazelrc is good (not sure if these incompatible flags are present in all supported bazel versions though?)

The flag was added in https://github.com/bazelbuild/bazel/commit/2bb1bf9422ba22d0e1ab15363664339f022b29a1, which was in Bazel 1.2. We definitely don't support things older than that (I'd guess we probably don't even support Bazel 4 or even 5 at this point given https://github.com/llvm/llvm-project/blob/main/utils/bazel/.bazelversion has 6.1)

Benoit updated this revision to Diff 531325.Jun 14 2023, 7:33 AM

Add the flag to .bazelrc

I'd land the two changes separately but both lgtm

aeubanks added inline comments.Jun 14 2023, 10:59 AM
utils/bazel/.bazelrc
28

Opt

Benoit updated this revision to Diff 531433.Jun 14 2023, 11:08 AM

Add more files discovered by running the CI Bazel command.

Benoit updated this revision to Diff 531447.Jun 14 2023, 11:43 AM

more exported files. fix typo in comment.

This revision was automatically updated to reflect the committed changes.