Conversation
PiperOrigin-RevId: 840871948
PiperOrigin-RevId: 859219669
PiperOrigin-RevId: 862386390
PiperOrigin-RevId: 869299341
PiperOrigin-RevId: 869329884
Fix upstreaming process so that it doesn't accidentally strip out cc and proto rules. Also, update our internal CI-for-upstream to use a newer docker container with a bazel 9.0 default. PiperOrigin-RevId: 871975647
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
| @@ -2,6 +2,9 @@ load("@rules_cc//cc:cc_binary.bzl", "cc_binary") | |||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | |||
There was a problem hiding this comment.
Your patch as is fails to link in my cloudtop machine (using a public bazel build). Can you reproduce this?
ERROR: /usr/local/google/home/victorvianna/repos/perf_data_converter/src/BUILD:149:10: Linking src/perf_to_profile failed: (Exit 1): gcc failed: error executing CppLink command (from cc_binary rule target //src:perf_to_profile) /usr/bin/gcc @bazel-out/k8-fastbuild/bin/src/perf_to_profile-0.params
Gemini-cli suggested this fix and now it works.
$ git diff
diff --git a/src/BUILD b/src/BUILD
index b12658e..dff870c 100644
--- a/src/BUILD
+++ b/src/BUILD
@@ -139,6 +139,7 @@ cc_library(
name = "perf_to_profile_lib",
srcs = ["perf_to_profile_lib.cc"],
hdrs = ["perf_to_profile_lib.h"],
+ alwayslink = 1,
deps = [
":perf_data_converter",
"//src/quipper:base",
@@ -149,6 +150,8 @@ cc_library(
cc_binary(
name = "perf_to_profile",
srcs = ["perf_to_profile.cc"],
+ copts = ["-fPIC"],
+ linkopts = ["-Wl,--gc-sections"],
deps = [
":perf_data_converter",
":perf_to_profile_lib",
There was a problem hiding this comment.
I reproduced some linker issues, but definitely not something that should be solved with alwayslink, which tends to be a pretty big bandaid.
Basically, Ubuntu (and internal gLiunux as a result) have picked up a broken version of GCC -- the details are here llvm/llvm-project#156667 (comment)
The bazel team recommends this in your bazelrc as a workaround until the toolchain gets into a proper state:
common --copt=-Wa,--gsframe=no
common --host_copt=-Wa,--gsframe=no
That worked on my gLinux machine.
Feel free to comment on b/483020832 internally with the full exact errors you're seeing, if this doesn't work.
(bugs like this are exactly why we shouldn't be using the system toolchain, but unfortunately bazel backtracked on the initial hermetic builds design)
|
@victorvianna did the gsframe workaround work? @blakej11 can you review please? |
|
@s-kanev Yes, adding that to ~/.bazelrc helped, thanks |
blakej11
left a comment
There was a problem hiding this comment.
Quipper source changes LGTM.
Closes #192