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

Use --features=external_include_paths for Bazel builds to allow angle-bracketed includes. #4640

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented Apr 27, 2024

Reintroduce the system includes and use a trick suggested in abseil/abseil-cpp#1637 (comment). We can add the feature flag --features=external_include_paths which enables system includes.

This is a newish feature: bazelbuild/bazel@08936ae

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Apr 27, 2024
@fruffy fruffy requested a review from smolkaj April 27, 2024 17:48
@fruffy fruffy force-pushed the fruffy/abseil_system_includes branch from 4f4e69f to bb95bee Compare April 29, 2024 00:14
@fruffy fruffy marked this pull request as ready for review April 29, 2024 00:14
@fruffy fruffy changed the title Revert "Revert using Abseil system includes. (#4594)" Use --features=external_include_paths for Bazel builds to allow angle-bracketed includes. Apr 29, 2024
Copy link
Member

@smolkaj smolkaj left a comment

Choose a reason for hiding this comment

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

Nice find!

@smolkaj
Copy link
Member

smolkaj commented Apr 29, 2024

Do you now if everyone depending on p4c using bazel will also have to set --features=external_include_paths? Hopefully no?

@fruffy
Copy link
Collaborator Author

fruffy commented Apr 29, 2024

Do you now if everyone depending on p4c using bazel will also have to set --features=external_include_paths? Hopefully no?

The question is whether parameters defined in.bazelrc are respected by downstream dependencies. Unclear to me unfortunately.

@fruffy fruffy added the infrastructure Topics related to code style and build and test infrastructure. label Apr 29, 2024
@vlstill
Copy link
Contributor

vlstill commented Apr 30, 2024

Do you now if everyone depending on p4c using bazel will also have to set --features=external_include_paths? Hopefully no?

The question is whether parameters defined in.bazelrc are respected by downstream dependencies. Unclear to me unfortunately.

(The Altera/Intel compiler is not using Bazel.)

@fruffy
Copy link
Collaborator Author

fruffy commented May 1, 2024

Do you now if everyone depending on p4c using bazel will also have to set --features=external_include_paths? Hopefully no?

abseil/abseil-cpp#1637 (comment) back to the drawing board...

On an unrelated note: Here is an amusing read of someone trying to fix Protobuf's quote includes: https://rachelbythebay.com/w/2024/04/29/pb/

@smolkaj
Copy link
Member

smolkaj commented May 1, 2024

The question is whether parameters defined in.bazelrc are respected by downstream dependencies. Unclear to me unfortunately.

Looks like you have already determined that the answer is likely no. We can also find out easily empirically, by running the following experiment:

  • Revert your changes under bazel/example/
  • Check if CI passes.

Note that bazel/example basically contains a "downstream project" depending on p4c, so building it tests exactly this sort of thing.

@fruffy fruffy force-pushed the fruffy/abseil_system_includes branch from bb95bee to 95b605b Compare May 1, 2024 23:54
@fruffy
Copy link
Collaborator Author

fruffy commented May 2, 2024

The question is whether parameters defined in.bazelrc are respected by downstream dependencies. Unclear to me unfortunately.

Looks like you have already determined that the answer is likely no. We can also find out easily empirically, by running the following experiment:

* Revert your changes under `bazel/example/`

* Check if CI passes.

Note that bazel/example basically contains a "downstream project" depending on p4c, so building it tests exactly this sort of thing.

Did that and, as expected, the test fails. Unfortunate.

@fruffy fruffy added the breaking-change This change may break assumptions of compiler back ends. label May 29, 2024
@fruffy fruffy force-pushed the fruffy/abseil_system_includes branch from 95b605b to ff7fb61 Compare June 12, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This change may break assumptions of compiler back ends. core Topics concerning the core segments of the compiler (frontend, midend, parser) infrastructure Topics related to code style and build and test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants