Repository navigation
Closed
Description
Envoy build fails when the build system has libunwind installed:
ERROR: /home/vagrant/dev/envoy/source/exe/BUILD:17:1: Linking of rule '//source/exe:envoy-static' failed: Process exited with status 1 [sandboxed].
src/stacktrace_libunwind-inl.h:110: error: undefined reference to '_Ux86_64_getcontext'
src/stacktrace_libunwind-inl.h:114: error: undefined reference to '_ULx86_64_init_local'
src/stacktrace_libunwind-inl.h:118: error: undefined reference to '_ULx86_64_step'
src/stacktrace_libunwind-inl.h:136: error: undefined reference to '_ULx86_64_step'
src/stacktrace_libunwind-inl.h:129: error: undefined reference to '_ULx86_64_get_reg'
src/stacktrace_libunwind-inl.h:110: error: undefined reference to '_Ux86_64_getcontext'
src/stacktrace_libunwind-inl.h:114: error: undefined reference to '_ULx86_64_init_local'
src/stacktrace_libunwind-inl.h:118: error: undefined reference to '_ULx86_64_step'
src/stacktrace_libunwind-inl.h:136: error: undefined reference to '_ULx86_64_step'
src/stacktrace_libunwind-inl.h:129: error: undefined reference to '_ULx86_64_get_reg'
src/stacktrace_libunwind-inl.h:110: error: undefined reference to '_Ux86_64_getcontext'
src/stacktrace_libunwind-inl.h:114: error: undefined reference to '_ULx86_64_init_local'
src/stacktrace_libunwind-inl.h:122: error: undefined reference to '_ULx86_64_get_reg'
src/stacktrace_libunwind-inl.h:141: error: undefined reference to '_ULx86_64_get_reg'
src/stacktrace_libunwind-inl.h:110: error: undefined reference to '_Ux86_64_getcontext'
src/stacktrace_libunwind-inl.h:114: error: undefined reference to '_ULx86_64_init_local'
collect2: error: ld returned 1 exit status
Use --strategy=CppLink=standalone to disable sandboxing for the failing actions.
Target //source/exe:envoy-static failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 2.294s, Critical Path: 1.47s
$
This is due to glog, which in this case uses libunwind, but fails to add it to the link options, see glog issue 207. That issue has a proposed patch that fixes this, but in the meanwhile I have locally solved this by:
diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl
index f176710..083289e 100644
--- a/bazel/envoy_build_system.bzl
+++ b/bazel/envoy_build_system.bzl
@@ -121,6 +121,7 @@ def envoy_cc_binary(name,
linkopts = [
"-pthread",
"-lrt",
+ "-lunwind",
# Force MD5 hash in build. This is part of the workaround for
# https://github.com/bazelbuild/bazel/issues/2805. Bazel actually
# does this by itself prior to
@@ -170,7 +171,7 @@ def envoy_cc_test(name,
copts = envoy_copts(repository, test = True),
# TODO(mattklein123): It's not great that we universally link against the following libs.
# In particular, -latomic is not needed on all platforms. Make this more granular.
- linkopts = ["-pthread", "-latomic"],
+ linkopts = ["-lunwind", "-pthread", "-latomic"],
linkstatic = 1,
malloc = tcmalloc_external_dep(repository),
deps = [
Metadata
Metadata
Assignees
Labels
No labels
Activity
mattklein123 commentedon Jun 8, 2017
We are removing glog in #1061. Will just merge it now.
mattklein123 commentedon Jun 8, 2017
Merged. Closing.
jrajahalme commentedon Jun 9, 2017
Unfortunately also tcmalloc links to unwind if it is found at configure time, I had to do the following to get envoy to link:
libunwind is disabled for gperftools by default on ARM and OSX. My reading of the configure.ac is that when frame pointers are available libunwind is not needed. We explicitly enable frame pointers already, so this change should be harmless. With this change envoy now builds both in the docker image and on my VM.
jrajahalme commentedon Jun 9, 2017
Not sure if anyone sees comments on closed issues, so I opened a new one (#1071).
lizan commentedon Jun 9, 2017
This was the problem that @qiwzhang faced before.
I don't think #1061 resolved this, since glog was never involved in any real build targets yet. @mattklein123 can reopen the issue.
mattklein123 commentedon Jun 9, 2017
We can just work from the other issue.
chore: group all dependabot updates (#1069)