Skip to content

gperftools depends on libunwind if available and causes envoy build failure. #1071

Closed

Description

@jrajahalme

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
$ 

tcmalloc uses libunwind if it is found at configure time, I had to do the following to get envoy to link:

diff --git a/ci/build_container/build_recipes/gperftools.sh b/ci/build_container/build_recipes/gperftools.sh
index 78da24c..21867c7 100755
--- a/ci/build_container/build_recipes/gperftools.sh
+++ b/ci/build_container/build_recipes/gperftools.sh
@@ -7,5 +7,5 @@ VERSION=2.5
 wget -O gperftools-$VERSION.tar.gz https://github.com/gperftools/gperftools/releases/download/gperftools-$VERSION/gperftools-$VERSION.tar.gz
 tar xf gperftools-$VERSION.tar.gz
 cd gperftools-$VERSION
-LDFLAGS="-lpthread" ./configure --prefix=$THIRDPARTY_BUILD --enable-shared=no --enable-frame-pointers
+LDFLAGS="-lpthread" ./configure --prefix=$THIRDPARTY_BUILD --enable-shared=no --enable-frame-pointers --disable-libunwind
 make V=1 install

libunwind is disabled in 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.

Activity

  1. changed the title [-]gperftools depend on libunwind, if available.[/-] [+]gperftools depends on libunwind if available and causes envoy build failure.[/+] on Jun 9, 2017
  2. mattklein123 commented on Jun 9, 2017

    @mattklein123
    Member

    @htuch @dnoe this is related to #834. At this point is there any reason to not just set --disable-libunwind and call both issues good? Things seem to be working pretty well with frame pointers.

  3. added this to the 1.4.0 milestone on Jun 9, 2017
  4. htuch commented on Jun 9, 2017

    @htuch
    Member

    Well, @alk in #834 recommends switching to libunwind if you want any insight into libraries that are provided by the system/compiler. If we're comfortable not including these for now, we can set --disable-libunwind and call it done for now. We probably should do this anyway regardless actually, as we have random inconsistent behavior today during the build, the question is do we close out #834 or not.

  5. mattklein123 commented on Jun 9, 2017

    @mattklein123
    Member

    I don't have a strong opinion. I guess my vote would be to just set --disable-libunwind and close both issues for now until someone is trying to debug something that annoys them due to lack of libunwind support.

  6. mattklein123 commented on Jun 9, 2017

    @mattklein123
    Member

    @jrajahalme either way can you please do a PR with your patch? We will take it.

  7. jrajahalme commented on Jun 9, 2017

    @jrajahalme
    ContributorAuthor
  8. mattklein123 commented on Jun 9, 2017

    @mattklein123
    Member

    Fixed by #1077

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions