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

Patch rules_foreign_cc to not link bazel default libraries into GNUMake #37632

Merged
merged 3 commits into from
Dec 12, 2024

Conversation

asedeno
Copy link
Contributor

@asedeno asedeno commented Dec 12, 2024

When upstream rules_foreign_cc builds its own GNUMake, it injects bazel's default libraries into LDFLAGS, which causes trouble on Darwin in newer versions of Bazel that added -lm to the list of default libraries.

As explained nicely in bazel-contrib/rules_foreign_cc#1227, Apple's libm re-exports a bunch of symbols and, due to linker argument order, clobbers some symbols from make itself. We don't need any of the default libraries in GNUMake, so disable the feature to link them.

Risk Level: low
Testing: CI

Things that rules_foreign_cc is building, including its own tools, are
not built by bazel directly, so don't inject libraries into them. The
tooling that's actually building those tools knows what it is doing.

This patch should be upstreamed.

Signed-off-by: Alejandro R Sedeño <[email protected]>
@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Dec 12, 2024
Copy link

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @phlax

🐱

Caused by: #37632 was opened by asedeno.

see: more, trace.

@asedeno
Copy link
Contributor Author

asedeno commented Dec 12, 2024

bazel/repositories.bzl Outdated Show resolved Hide resolved
Signed-off-by: Alejandro R. Sedeño <[email protected]>
phlax
phlax previously approved these changes Dec 12, 2024
Copy link
Member

@phlax phlax left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @asedeno

@repokitteh-read-only repokitteh-read-only bot removed the deps Approval required for changes to Envoy's external dependencies label Dec 12, 2024
@phlax phlax enabled auto-merge (squash) December 12, 2024 16:37
@asedeno
Copy link
Contributor Author

asedeno commented Dec 12, 2024

Patch needs more work to scope it down.

auto-merge was automatically disabled December 12, 2024 18:07

Head branch was pushed to by a user without write access

@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Dec 12, 2024
@asedeno asedeno changed the title Patch rules_foreign_cc to not inject bazel default libs into things Patch rules_foreign_cc to not bazel default libraries into GNUMake Dec 12, 2024
@asedeno asedeno changed the title Patch rules_foreign_cc to not bazel default libraries into GNUMake Patch rules_foreign_cc to not link bazel default libraries into GNUMake Dec 12, 2024
@repokitteh-read-only repokitteh-read-only bot removed the deps Approval required for changes to Envoy's external dependencies label Dec 12, 2024
@phlax phlax merged commit 43d9ac4 into envoyproxy:main Dec 12, 2024
26 of 29 checks passed
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.

2 participants