Skip to content

Missing linked library? #185

Closed
Closed
@fehmud

Description

@fehmud

I cannot build CppFormat with Clang on GNU/Linux. Maybe the build file is missing a link to libpthread? I don't know CMake, otherwise I would have given a look on my own. Below is the log. Thank you for your attention.

$ make
Scanning dependencies of target format
[  3%] Building CXX object CMakeFiles/format.dir/format.cc.o
[  7%] Building CXX object CMakeFiles/format.dir/posix.cc.o
Linking CXX static library libformat.a
[  7%] Built target format
Scanning dependencies of target gmock
[ 11%] Building CXX object CMakeFiles/gmock.dir/gmock/gmock-gtest-all.cc.o
Linking CXX static library libgmock.a
[ 11%] Built target gmock
Scanning dependencies of target test-main
[ 14%] Building CXX object test/CMakeFiles/test-main.dir/test-main.cc.o
[ 18%] Building CXX object test/CMakeFiles/test-main.dir/gtest-extra.cc.o
[ 22%] Building CXX object test/CMakeFiles/test-main.dir/util.cc.o
Linking CXX static library libtest-main.a
[ 22%] Built target test-main
Scanning dependencies of target format-impl-test
[ 25%] Building CXX object test/CMakeFiles/format-impl-test.dir/format-impl-test.cc.o
Linking CXX executable ../bin/format-impl-test
../libgmock.a(gmock-gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::~ThreadLocal()':
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev]+0x15): undefined reference to `pthread_getspecific'
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev]+0x2e): undefined reference to `pthread_key_delete'
../libgmock.a(gmock-gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::~ThreadLocal()':
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev]+0xb): undefined reference to `pthread_getspecific'
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev]+0x20): undefined reference to `pthread_key_delete'
../libgmock.a(gmock-gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::Sequence*>::~ThreadLocal()':
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_8SequenceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_8SequenceEED2Ev]+0xb): undefined reference to `pthread_getspecific'
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_8SequenceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_8SequenceEED2Ev]+0x20): undefined reference to `pthread_key_delete'
../libgmock.a(gmock-gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::Sequence*>::GetOrCreateValue() const':
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_8SequenceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_8SequenceEE16GetOrCreateValueEv]+0x9): undefined reference to `pthread_getspecific'
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_8SequenceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_8SequenceEE16GetOrCreateValueEv]+0x49): undefined reference to `pthread_setspecific'
../libgmock.a(gmock-gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::Sequence*>::CreateKey()':
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_8SequenceEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalIPNS_8SequenceEE9CreateKeyEv]+0x10): undefined reference to `pthread_key_create'
../libgmock.a(gmock-gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::CreateKey()':
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE9CreateKeyEv]+0x10): undefined reference to `pthread_key_create'
../libgmock.a(gmock-gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::CreateKey()':
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE9CreateKeyEv]+0x10): undefined reference to `pthread_key_create'
../libgmock.a(gmock-gtest-all.cc.o): In function `testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::GetOrCreateValue() const':
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0x9): undefined reference to `pthread_getspecific'
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0x49): undefined reference to `pthread_setspecific'
../libgmock.a(gmock-gtest-all.cc.o): In function `testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::GetOrCreateValue() const':
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0xe): undefined reference to `pthread_getspecific'
/home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0xcc): undefined reference to `pthread_setspecific'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
test/CMakeFiles/format-impl-test.dir/build.make:88: recipe for target 'bin/format-impl-test' failed
make[2]: *** [bin/format-impl-test] Error 1
CMakeFiles/Makefile2:180: recipe for target 'test/CMakeFiles/format-impl-test.dir/all' failed
make[1]: *** [test/CMakeFiles/format-impl-test.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
make: *** [all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions