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 Abseil system includes #4511

Merged
merged 4 commits into from
Mar 18, 2024
Merged

Use Abseil system includes #4511

merged 4 commits into from
Mar 18, 2024

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented Mar 7, 2024

Partially addresses #4523. Try to patch Abseil.

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Mar 7, 2024
@asl
Copy link
Contributor

asl commented Mar 8, 2024

@fruffy maybe you're having abseil installed globally? Bazel explicitly does on CI:

-iquote external/com_google_absl -iquote bazel-out/k8-fastbuild/bin/external/com_google_absl

So, you can only use #include "absl/foo/bar.h"

@fruffy
Copy link
Collaborator Author

fruffy commented Mar 8, 2024

@fruffy maybe you're having abseil installed globally? Bazel explicitly does on CI:

I do not have libabseil-dev installed, but it turns out to be some old caching. I do not exactly understand what Abseil does differently from Protobuf that prohibits angle-bracketed includes.

Will use this PR as a scratchpad to see whether I can patch Abseil appropriately to support angle-bracketed includes.

@fruffy fruffy force-pushed the fruffy/absl_system_includes branch from 38780f8 to 1229caf Compare March 14, 2024 12:28
@fruffy fruffy marked this pull request as ready for review March 14, 2024 12:28
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.

Just for my understanding, what's the motivation here? Are angled brackets what's generally preferred in OSS for depending on other libraries?

@fruffy
Copy link
Collaborator Author

fruffy commented Mar 18, 2024

Just for my understanding, what's the motivation here? Are angled brackets what's generally preferred in OSS for depending on other libraries?

abseil/abseil-cpp#740 provides some rationale. There are also arch or nix users who want to supply their own abseil/protobuf system packages.

@fruffy fruffy added this pull request to the merge queue Mar 18, 2024
Merged via the queue into main with commit ad7772e Mar 18, 2024
17 checks passed
@fruffy fruffy deleted the fruffy/absl_system_includes branch March 18, 2024 19:34
@smolkaj
Copy link
Member

smolkaj commented Apr 2, 2024

@fruffy, this PR is causing some trouble for upstream users.

Specifically, imagine an upstream user X depends on both absl and p4c. Then X would declare an absl version in their x_deps.bzl file. And now X need to also patch their absl version, or otherwise will trigger a compilation error in p4c.

Do we really want to require all users (and their transitive dependents) to patch their abseil versions?

I didn't realize this had such a big blast radius when I approved.

Would it be possible to revert this PR and think about a better solution?

@fruffy
Copy link
Collaborator Author

fruffy commented Apr 2, 2024

This is for open-source Bazel users, right? Which repository is affected by this change? I do not really see a good way to solve this.

I think it might be better to lobby the Abseil maintainers to fix the way they export their includes.

@smolkaj
Copy link
Member

smolkaj commented Apr 2, 2024

Yes, correct. Off the top of my head, at least http://github.com/p4lang/p4-constraints and https://github.com/sonic-net/sonic-pins, though I suspect there are others.

I think it might be better to lobby the Abseil maintainers to fix the way they export their includes.

Agreed, let's definitely do this.

However, we probablyu also need some short term solution here, because we don't if and when the above will converge. Could this PR be rolled back in the meantime?

@fruffy
Copy link
Collaborator Author

fruffy commented Apr 2, 2024

This also seems like a big limitation in Bazel, how do you consolidate dependencies there if two repositories require a different version of the same dependency?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants