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

Missing linked library? #185

Closed
fehmud opened this issue Jun 28, 2015 · 10 comments
Closed

Missing linked library? #185

fehmud opened this issue Jun 28, 2015 · 10 comments

Comments

@fehmud
Copy link

fehmud commented Jun 28, 2015

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
@fehmud fehmud changed the title Missing dependencies? Missing linked library? Jun 28, 2015
@vitaut
Copy link
Contributor

vitaut commented Jun 28, 2015

Thanks for the bug report. Could you please post the full output of CMake run on a clean repository and output of make VERBOSE=1?

@fehmud
Copy link
Author

fehmud commented Jun 29, 2015

CMake

-- CMake version: 3.2.3
-- The C compiler identification is Clang 3.5.0
-- The CXX compiler identification is Clang 3.5.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type: Release
-- Performing Test HAVE_STD_CPP11_FLAG
-- Performing Test HAVE_STD_CPP11_FLAG - Success
-- Looking for open
-- Looking for open - found
-- Target 'doc' disabled (requires breathe module)
-- Looking for include file pthread.h
-- Looking for include file pthread.h - not found
-- Could NOT find Threads (missing:  Threads_FOUND) 
-- Performing Test FMT_VARIADIC_TEMPLATES
-- Performing Test FMT_VARIADIC_TEMPLATES - Success
-- Performing Test FMT_INITIALIZER_LIST
-- Performing Test FMT_INITIALIZER_LIST - Failed
-- Performing Test HAVE_TYPE_TRAITS
-- Performing Test HAVE_TYPE_TRAITS - Success
-- Performing Test HAVE_FNO_EXCEPTIONS_FLAG
-- Performing Test HAVE_FNO_EXCEPTIONS_FLAG - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/egarrulo/Downloads/cppformat-1.1.0/build

make VERBOSE=1

/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -H/home/egarrulo/Downloads/cppformat-1.1.0 -B/home/egarrulo/Downloads/cppformat-1.1.0/build --check-build-system CMakeFiles/Makefile.cmake 0
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_start /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
make -f CMakeFiles/format.dir/build.make CMakeFiles/format.dir/depend
make[2]: Entering directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
cd /home/egarrulo/Downloads/cppformat-1.1.0/build && /opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_depends "Unix Makefiles" /home/egarrulo/Downloads/cppformat-1.1.0 /home/egarrulo/Downloads/cppformat-1.1.0 /home/egarrulo/Downloads/cppformat-1.1.0/build /home/egarrulo/Downloads/cppformat-1.1.0/build /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/format.dir/DependInfo.cmake --color=
Dependee "/home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/format.dir/DependInfo.cmake" is newer than depender "/home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/format.dir/depend.internal".
Dependee "/home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/format.dir/depend.internal".
�[35m�[1mScanning dependencies of target format
�[0mmake[2]: Leaving directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
make -f CMakeFiles/format.dir/build.make CMakeFiles/format.dir/build
make[2]: Entering directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles 1
[  3%] �[32mBuilding CXX object CMakeFiles/format.dir/format.cc.o
�[0m/usr/bin/clang++   -DFMT_USE_FILE_DESCRIPTORS=1 -DGTEST_LANG_CXX11=0 -O3 -DNDEBUG -I/home/egarrulo/Downloads/cppformat-1.1.0/. -I/home/egarrulo/Downloads/cppformat-1.1.0/gmock    -o CMakeFiles/format.dir/format.cc.o -c /home/egarrulo/Downloads/cppformat-1.1.0/format.cc
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles 2
[  7%] �[32mBuilding CXX object CMakeFiles/format.dir/posix.cc.o
�[0m/usr/bin/clang++   -DFMT_USE_FILE_DESCRIPTORS=1 -DGTEST_LANG_CXX11=0 -O3 -DNDEBUG -I/home/egarrulo/Downloads/cppformat-1.1.0/. -I/home/egarrulo/Downloads/cppformat-1.1.0/gmock    -o CMakeFiles/format.dir/posix.cc.o -c /home/egarrulo/Downloads/cppformat-1.1.0/posix.cc
�[31m�[1mLinking CXX static library libformat.a
�[0m/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -P CMakeFiles/format.dir/cmake_clean_target.cmake
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/format.dir/link.txt --verbose=1
/usr/bin/ar cq libformat.a  CMakeFiles/format.dir/format.cc.o CMakeFiles/format.dir/posix.cc.o
/usr/bin/ranlib libformat.a
make[2]: Leaving directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles  1 2
[  7%] Built target format
make -f CMakeFiles/gmock.dir/build.make CMakeFiles/gmock.dir/depend
make[2]: Entering directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
cd /home/egarrulo/Downloads/cppformat-1.1.0/build && /opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_depends "Unix Makefiles" /home/egarrulo/Downloads/cppformat-1.1.0 /home/egarrulo/Downloads/cppformat-1.1.0 /home/egarrulo/Downloads/cppformat-1.1.0/build /home/egarrulo/Downloads/cppformat-1.1.0/build /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/gmock.dir/DependInfo.cmake --color=
Dependee "/home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/gmock.dir/DependInfo.cmake" is newer than depender "/home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/gmock.dir/depend.internal".
Dependee "/home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles/gmock.dir/depend.internal".
�[35m�[1mScanning dependencies of target gmock
�[0mmake[2]: Leaving directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
make -f CMakeFiles/gmock.dir/build.make CMakeFiles/gmock.dir/build
make[2]: Entering directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles 5
[ 11%] �[32mBuilding CXX object CMakeFiles/gmock.dir/gmock/gmock-gtest-all.cc.o
�[0m/usr/bin/clang++   -DFMT_USE_FILE_DESCRIPTORS=1 -DGTEST_LANG_CXX11=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -O3 -DNDEBUG -I/home/egarrulo/Downloads/cppformat-1.1.0/. -I/home/egarrulo/Downloads/cppformat-1.1.0/gmock    -o CMakeFiles/gmock.dir/gmock/gmock-gtest-all.cc.o -c /home/egarrulo/Downloads/cppformat-1.1.0/gmock/gmock-gtest-all.cc
�[31m�[1mLinking CXX static library libgmock.a
�[0m/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -P CMakeFiles/gmock.dir/cmake_clean_target.cmake
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/gmock.dir/link.txt --verbose=1
/usr/bin/ar cq libgmock.a  CMakeFiles/gmock.dir/gmock/gmock-gtest-all.cc.o
/usr/bin/ranlib libgmock.a
make[2]: Leaving directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles  5
[ 11%] Built target gmock
make -f test/CMakeFiles/test-main.dir/build.make test/CMakeFiles/test-main.dir/depend
make[2]: Entering directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
cd /home/egarrulo/Downloads/cppformat-1.1.0/build && /opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_depends "Unix Makefiles" /home/egarrulo/Downloads/cppformat-1.1.0 /home/egarrulo/Downloads/cppformat-1.1.0/test /home/egarrulo/Downloads/cppformat-1.1.0/build /home/egarrulo/Downloads/cppformat-1.1.0/build/test /home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/test-main.dir/DependInfo.cmake --color=
Dependee "/home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/test-main.dir/DependInfo.cmake" is newer than depender "/home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/test-main.dir/depend.internal".
Dependee "/home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/test-main.dir/depend.internal".
�[35m�[1mScanning dependencies of target test-main
�[0mmake[2]: Leaving directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
make -f test/CMakeFiles/test-main.dir/build.make test/CMakeFiles/test-main.dir/build
make[2]: Entering directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles 24
[ 14%] �[32mBuilding CXX object test/CMakeFiles/test-main.dir/test-main.cc.o
�[0mcd /home/egarrulo/Downloads/cppformat-1.1.0/build/test && /usr/bin/clang++   -DFMT_USE_FILE_DESCRIPTORS=1 -DFMT_USE_TYPE_TRAITS=1 -DGTEST_LANG_CXX11=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -O3 -DNDEBUG -I/home/egarrulo/Downloads/cppformat-1.1.0/. -I/home/egarrulo/Downloads/cppformat-1.1.0/gmock    -o CMakeFiles/test-main.dir/test-main.cc.o -c /home/egarrulo/Downloads/cppformat-1.1.0/test/test-main.cc
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles 25
[ 18%] �[32mBuilding CXX object test/CMakeFiles/test-main.dir/gtest-extra.cc.o
�[0mcd /home/egarrulo/Downloads/cppformat-1.1.0/build/test && /usr/bin/clang++   -DFMT_USE_FILE_DESCRIPTORS=1 -DFMT_USE_TYPE_TRAITS=1 -DGTEST_LANG_CXX11=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -O3 -DNDEBUG -I/home/egarrulo/Downloads/cppformat-1.1.0/. -I/home/egarrulo/Downloads/cppformat-1.1.0/gmock    -o CMakeFiles/test-main.dir/gtest-extra.cc.o -c /home/egarrulo/Downloads/cppformat-1.1.0/test/gtest-extra.cc
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles 26
[ 22%] �[32mBuilding CXX object test/CMakeFiles/test-main.dir/util.cc.o
�[0mcd /home/egarrulo/Downloads/cppformat-1.1.0/build/test && /usr/bin/clang++   -DFMT_USE_FILE_DESCRIPTORS=1 -DFMT_USE_TYPE_TRAITS=1 -DGTEST_LANG_CXX11=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -O3 -DNDEBUG -I/home/egarrulo/Downloads/cppformat-1.1.0/. -I/home/egarrulo/Downloads/cppformat-1.1.0/gmock    -o CMakeFiles/test-main.dir/util.cc.o -c /home/egarrulo/Downloads/cppformat-1.1.0/test/util.cc
�[31m�[1mLinking CXX static library libtest-main.a
�[0mcd /home/egarrulo/Downloads/cppformat-1.1.0/build/test && /opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -P CMakeFiles/test-main.dir/cmake_clean_target.cmake
cd /home/egarrulo/Downloads/cppformat-1.1.0/build/test && /opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/test-main.dir/link.txt --verbose=1
/usr/bin/ar cq libtest-main.a  CMakeFiles/test-main.dir/test-main.cc.o CMakeFiles/test-main.dir/gtest-extra.cc.o CMakeFiles/test-main.dir/util.cc.o
/usr/bin/ranlib libtest-main.a
make[2]: Leaving directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles  24 25 26
[ 22%] Built target test-main
make -f test/CMakeFiles/format-impl-test.dir/build.make test/CMakeFiles/format-impl-test.dir/depend
make[2]: Entering directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
cd /home/egarrulo/Downloads/cppformat-1.1.0/build && /opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_depends "Unix Makefiles" /home/egarrulo/Downloads/cppformat-1.1.0 /home/egarrulo/Downloads/cppformat-1.1.0/test /home/egarrulo/Downloads/cppformat-1.1.0/build /home/egarrulo/Downloads/cppformat-1.1.0/build/test /home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/format-impl-test.dir/DependInfo.cmake --color=
Dependee "/home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/format-impl-test.dir/DependInfo.cmake" is newer than depender "/home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/format-impl-test.dir/depend.internal".
Dependee "/home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/egarrulo/Downloads/cppformat-1.1.0/build/test/CMakeFiles/format-impl-test.dir/depend.internal".
�[35m�[1mScanning dependencies of target format-impl-test
�[0mmake[2]: Leaving directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
make -f test/CMakeFiles/format-impl-test.dir/build.make test/CMakeFiles/format-impl-test.dir/build
make[2]: Entering directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
/opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_progress_report /home/egarrulo/Downloads/cppformat-1.1.0/build/CMakeFiles 3
[ 25%] �[32mBuilding CXX object test/CMakeFiles/format-impl-test.dir/format-impl-test.cc.o
�[0mcd /home/egarrulo/Downloads/cppformat-1.1.0/build/test && /usr/bin/clang++   -DFMT_USE_FILE_DESCRIPTORS=1 -DFMT_USE_TYPE_TRAITS=1 -DGTEST_LANG_CXX11=0 -DGTEST_USE_OWN_TR1_TUPLE=1 -O3 -DNDEBUG -I/home/egarrulo/Downloads/cppformat-1.1.0/. -I/home/egarrulo/Downloads/cppformat-1.1.0/gmock    -o CMakeFiles/format-impl-test.dir/format-impl-test.cc.o -c /home/egarrulo/Downloads/cppformat-1.1.0/test/format-impl-test.cc
�[31m�[1mLinking CXX executable ../bin/format-impl-test
�[0mcd /home/egarrulo/Downloads/cppformat-1.1.0/build/test && /opt/cmake/cmake-3.2.3-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/format-impl-test.dir/link.txt --verbose=1
/usr/bin/clang++   -O3 -DNDEBUG   CMakeFiles/format-impl-test.dir/format-impl-test.cc.o  -o ../bin/format-impl-test -rdynamic libtest-main.a ../libformat.a ../libgmock.a 
../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
make[2]: Leaving directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
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
make[1]: Leaving directory '/home/egarrulo/Downloads/cppformat-1.1.0/build'
Makefile:126: recipe for target 'all' failed
make: *** [all] Error 2

@vitaut
Copy link
Contributor

vitaut commented Jun 29, 2015

Thanks for the build logs. Looks like CMake cannot find pthreads:

-- Looking for include file pthread.h
-- Looking for include file pthread.h - not found
-- Could NOT find Threads (missing:  Threads_FOUND) 

Do you have pthreads installed?

@fehmud
Copy link
Author

fehmud commented Jun 29, 2015

I think so: if I compile a .cpp file with #include "pthread.h", it compiles, with no additional include directories for clang++.

By the way, why does CMake generate a Makefile if some requirements are missing? Since CMake didn't fail, I thought that that was an optional requirement.

@vitaut
Copy link
Contributor

vitaut commented Jun 29, 2015

By the way, why does CMake generate a Makefile if some requirements are missing? Since CMake didn't fail, I thought that that was an optional requirement.

Good point. I've adjusted the CMake config so that the project compiles even if pthreads are missing: 7859f81.

But it is strange that CMake cannot find pthread.h. Where is this file located on your system?

@fehmud
Copy link
Author

fehmud commented Jun 29, 2015

/usr/include/pthread.h. It looks like a standard path..

I've adjusted the CMake config so that the project compiles even if pthreads are missing

Hence, is pthread.h needed or not? Does CppFormat builds two versions of the library: single-threaded and multi-threaded? Sorry, but I am new in developing C++ on GNU/Linux.

@fehmud
Copy link
Author

fehmud commented Jun 29, 2015

However, now CMake finds the header, but not a required function:

-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found

@vitaut
Copy link
Contributor

vitaut commented Jun 29, 2015

Hence, is pthread.h needed or not? Does CppFormat builds two versions of the library: single-threaded and multi-threaded?

pthread.h is not needed any more. There is only one version of the library and it doesn't require pthreads, the latter is only optionally used by Google Test. So you can ignore pthreads-related messages from CMake.

@fehmud
Copy link
Author

fehmud commented Jun 29, 2015

Now the build works and the tests are successful.

Thanks for your assistance.

@vitaut
Copy link
Contributor

vitaut commented Jun 29, 2015

Cool, thanks for the update.

@vitaut vitaut closed this as completed Jun 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants