Build failure: papi_avail not linked with -lpthread
Issue #71
resolved
The following currently doesn’t work:
./configure --with-static-lib=yes --with-static-tools && make
The build fails with
make[2]: Entering directory `/home/efagerho/git/papi/src/utils'
gcc -o papi_avail papi_avail.o print_header.o ../libpapi.a -ldl -static
../libpapi.a(papi_hl.o): In function `_internal_hl_library_init':
/home/efagerho/git/papi/src/high-level/papi_hl.c:218: undefined reference to `pthread_self'
../libpapi.a(papi.o): In function `_internal_papi_init':
/home/efagerho/git/papi/src/papi.c:92: undefined reference to `pthread_self'
collect2: error: ld returned 1 exit status
make[2]: *** [papi_avail] Error 1
make[2]: Leaving directory `/home/efagerho/git/papi/src/utils'
make[1]: *** [utils] Error 2
make[1]: Leaving directory `/home/efagerho/git/papi/src'
make: *** [libpfm4/lib/libpfm.a] Error 2
One clearly sees that gcc is not being given the -lpthread flag.
Comments (2)
-
reporter -
- changed status to resolved
- Log in to comment
The same bug has apparently been reported already two years ago: https://bitbucket.org/icl/papi/issues/48/static-build-breaks-if-with-pthread
It should be a trivial add “-lpthread” to LDFLAGS somewhere in the configure script. I made my own patch which fixes the problem for myself, but someone who knows how the library is supposed to get built on other platforms should probably add it to the right place.