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

Undefined symbol errors when compiling for cygwin/x64 #643

Open
GoogleCodeExporter opened this issue Jul 4, 2015 · 4 comments
Open

Undefined symbol errors when compiling for cygwin/x64 #643

GoogleCodeExporter opened this issue Jul 4, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Download & extract sources
2. ./configure --enable-frame-pointers  LIBS=-lpthread
3. make

I would expect it to compile when following the instructions in INSTALL. The 
latter says to specify --disable-shared because cygwin doesn't support weak 
symbols... which I think is not actually true any more (and weak symbols don't 
work properly with static linking). The --enable-frame-pointer is needed to 
avoid errors about missing libunwind. The LIBS=lpthread allows test cases to 
compile (otherwise they also fail because pthread functions are missing). I 
also had to change casting in maybe_threads.cc to avoid errors and warnings 
about differing size of int and pthread_key_t (which is a pointer on cygwin). 

The root of the issue seems to lurk in the black magic invoked by 
maybe_threads.cc

Using gperftools-2.1.1, 64-bit cygwin on Windows 7, gcc-4.8.3

Relevant makefile output:

/bin/sh ./libtool  --tag=CXX   --mode=link g++ -DNO_TCMALLOC_SAMPLES  -DNDEBUG 
-Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare 
-fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc 
-fno-builtin-cfree -fno-builtin-memalign -fno-builtin-posix_memalign 
-fno-builtin-valloc -fno-builtin-pvalloc  -Wno-unused-result 
-fno-omit-frame-pointer  -g -O2  -version-info 5:2:1 -no-undefined   -o 
libtcmalloc_minimal.la -rpath /home/Ryan/apps/gperftools-2.1/lib 
libtcmalloc_minimal_la-tcmalloc.lo    libtcmalloc_minimal_internal.la
libtool: link: rm -fr  .libs/libtcmalloc_minimal.dll.a
libtool: link: g++ -shared -nostdlib 
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/crtbegin.o  
.libs/libtcmalloc_minimal_la-tcmalloc.o  -Wl,--whole-archive 
./.libs/libtcmalloc_minimal_internal.a -Wl,--no-whole-archive  
-L/usr/lib/gcc/x86_64-pc-cygwin/4.8.3 
-L/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../lib -L/lib/../lib 
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../.. -lstdc++ 
-lgcc_s -lgcc -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc 
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/crtend.o  -O2   -o 
.libs/cygtcmalloc_minimal-4.dll -Wl,--enable-auto-image-base -Xlinker 
--out-implib -Xlinker .libs/libtcmalloc_minimal.dll.a
./.libs/libtcmalloc_minimal_internal.a(libtcmalloc_minimal_internal_la-maybe_thr
eads.o): In function `perftools_pthread_key_create(__pthread_key_t**, void 
(*)(void*))':
/scratch/gperftools-2.1/src/maybe_threads.cc:83:(.text+0x7): relocation 
truncated to fit: R_X86_64_PC32 against undefined symbol `pthread_key_create'
./.libs/libtcmalloc_minimal_internal.a(libtcmalloc_minimal_internal_la-maybe_thr
eads.o): In function `perftools_pthread_getspecific(__pthread_key_t*)':
/scratch/gperftools-2.1/src/maybe_threads.cc:93:(.text+0x37): relocation 
truncated to fit: R_X86_64_PC32 against undefined symbol `pthread_getspecific'
./.libs/libtcmalloc_minimal_internal.a(libtcmalloc_minimal_internal_la-maybe_thr
eads.o): In function `perftools_pthread_setspecific(__pthread_key_t*, void*)':
/scratch/gperftools-2.1/src/maybe_threads.cc:101:(.text+0x67): relocation 
truncated to fit: R_X86_64_PC32 against undefined symbol `pthread_setspecific'
./.libs/libtcmalloc_minimal_internal.a(libtcmalloc_minimal_internal_la-maybe_thr
eads.o): In function `perftools_pthread_once(pthread_once_t*, void (*)())':
/scratch/gperftools-2.1/src/maybe_threads.cc:131:(.text+0xa3): relocation 
truncated to fit: R_X86_64_PC32 against undefined symbol `pthread_once'
collect2: error: ld returned 1 exit status
Makefile:3247: recipe for target 'libtcmalloc_minimal.la' failed
make: *** [libtcmalloc_minimal.la] Error 1

Original issue reported on code.google.com by [email protected] on 18 Aug 2014 at 3:36

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

No branches or pull requests

1 participant