gperftools: Undefined reference to `TCMallocGetenvSafe` on PPC and i386

This error popped up when adding gperftools 2.14 to spack (full log: https://gitlab.spack.io/spack/spack/-/jobs/9711611#L937L):

libtool: link: /builds/spack/spack/lib/spack/env/gcc/g++ -std=gnu++11 -DNO_TCMALLOC_SAMPLES -g -O2 -o low_level_alloc_unittest src/base/low_level_alloc_unittest-low_level_alloc.o src/low_level_alloc_unittest-malloc_hook.o src/low_level_alloc_unittest-mmap_hook.o src/tests/low_level_alloc_unittest-low_level_alloc_unittest.o  ./.libs/libspinlock.a ./.libs/libsysinfo.a ./.libs/liblogging.a -lunwind
/bin/bash ./libtool  --tag=CXX   --mode=link /builds/spack/spack/lib/spack/env/gcc/g++ -std=gnu++11 -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-unused-result -fsized-deallocation -faligned-new   -DSTACKTRACE_IS_TESTED -g -O2 -export-dynamic -lunwind -o stacktrace_unittest src/tests/stacktrace_unittest-stacktrace_unittest.o src/stacktrace_unittest-stacktrace.o src/base/stacktrace_unittest-elf_mem_image.o src/base/stacktrace_unittest-vdso_support.o      -lunwind libspinlock.la libsysinfo.la liblogging.la liblogging.la libfake_stacktrace_scope.la  
libtool: link: /builds/spack/spack/lib/spack/env/gcc/g++ -std=gnu++11 -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Wno-unused-result -fsized-deallocation -faligned-new -DSTACKTRACE_IS_TESTED -g -O2 -o stacktrace_unittest src/tests/stacktrace_unittest-stacktrace_unittest.o src/stacktrace_unittest-stacktrace.o src/base/stacktrace_unittest-elf_mem_image.o src/base/stacktrace_unittest-vdso_support.o -Wl,--export-dynamic  ./.libs/libspinlock.a ./.libs/libsysinfo.a ./.libs/liblogging.a ./.libs/libfake_stacktrace_scope.a -lunwind
/usr/bin/ld: ./.libs/liblogging.a(dynamic_annotations.o): in function `RunningOnValgrind':
/tmp/root/spack-stage/spack-stage-gperftools-2.14-yhb2lpga7yyb63xsmnvew4zncsdphkj7/spack-src/src/base/dynamic_annotations.cc:46: undefined reference to `TCMallocGetenvSafe'
collect2: error: ld returned 1 exit status
make: *** [Makefile:4410: stacktrace_unittest] Error 1
make: *** Waiting for unfinished jobs....

x86 builds seem to be fine. I don’t have direct access to the PPC environment so I can’t really do interactive debugging, but I can try out patches if that’s helpful. Pinging @barracuda156 in case you have some ideas and/or debugging help since I’ve seen you test PPC builds before (apologies if you’re not interested or don’t have the time).

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 23 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Ah, mystery solved. We only pull one specific stuff on i386 and ppc: https://github.com/gperftools/gperftools/blob/d5c1edf4f5fe901f40d96f4a9d4914f651742c88/src/base/vdso_support.h#L68

So that pulls vdso bits which pull RunningOnValgrind which trigger the .a ordering issue. And on other platforms, this doesn’t happen and we’re good.

Okay. Should be fixed on master. Please test and ack or nack.

@alk I can confirm that the spack CI successfully built 2.15 on PPC (https://github.com/spack/spack/pull/41984, can’t comment about i386, but I guess it should work trivially there as well if it works on PPC). Thanks for the very quick fix!

ok. I am able to reproduce on Debian’s i686-linux-gnu-g++. So hopefully I’ll figure out soon what’s up.