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

chore(build): use includes argument in BUILD.bazel #154

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

dmehala
Copy link
Collaborator

@dmehala dmehala commented Sep 16, 2024

Description

Envoy was failing to build becase it couldn't locate the necessary headers in the src directory, even with the -Isrc/datadog flag. After investigating, I found that dd-trace-cpp srouce code is actually located at external/com_github_datadog_dd_trace_cpp/src/datadog. This means the correct include path should be -Iexternal/com_github_datadog_dd_trace_cpp/src/datadog. For some reson Bazel isn't able to handle this path expansion automatically.

After researching, it seems the recommended solution is to use the includes argument in cc_library. However, the Bazel documentation includes this warning:

This should only be used for third-party libraries that do not conform to the Google style of writing #include statements. Unlike COPTS, these flags are added for this rule and every rule that depends on it. (Note: not the rules it depends upon!) Be very careful, since this may have far-reaching effects.

I'm not entirely sure about the implications here, so I went ahead with this approach despite the warning. If someone with a bigger brain, IQ and experience can suggest a better way™️, I'm happy to adjust accordingly!

Motivation

Preparing the new release 🎉

includes argument has the benefit to prepended with the package path
and passed to the C++ toolchain for expansion via the "include_paths"
CROSSTOOL feature.
@dmehala dmehala requested a review from a team as a code owner September 16, 2024 12:45
@dmehala dmehala requested review from pablomartinezbernardo and removed request for a team September 16, 2024 12:45
@dmehala dmehala merged commit 407ab5b into main Sep 17, 2024
22 checks passed
@dmehala dmehala deleted the dmehala/fix/envoy-comp branch September 17, 2024 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant