[cmake-developers] [CMake 0015510]: After 15.04 upgrade, cannot link against against pthread using C++11 <thread>

Mantis Bug Tracker mantis at public.kitware.com
Mon Apr 13 03:07:29 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15510 
====================================================================== 
Reported By:                nickdesaulniers
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15510
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-04-13 03:07 EDT
Last Modified:              2015-04-13 03:07 EDT
====================================================================== 
Summary:                    After 15.04 upgrade, cannot link against against
pthread using C++11 <thread>
Description: 
So I recently upgraded my headless server from 14.04 to 15.04 using `sudo
do-release-upgrade -d`. After the upgrade, I had to reinstall boost, but one of
my projects that I build with cmake stopped building.

➜  build git:(master) ✗ make
Scanning dependencies of target main
[ 33%] Building CXX object CMakeFiles/main.dir/hello.cpp.o
[ 66%] Building CXX object CMakeFiles/main.dir/packet.cpp.o
[100%] Building CXX object CMakeFiles/main.dir/key_value_store.cpp.o
Linking CXX executable main
/usr/bin/ld: CMakeFiles/main.dir/hello.cpp.o: undefined reference to symbol
'pthread_create@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from
command line
collect2: error: ld returned 1 exit status
CMakeFiles/main.dir/build.make:136: recipe for target 'main' failed
make[2]: *** [main] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/main.dir/all' failed
make[1]: *** [CMakeFiles/main.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2

I had to explicitly link against pthread to have <thread> support for C++11,
when prior to my upgrade to 15.04, I did not have to.  Not sure if this is cmake
related or not.

Steps to Reproduce: 
git checkout https://github.com/nickdesaulniers/cpp11-memcached.git
cd cpp11-memcached
git checkout b419bd
mkdir build
cd build
cmake ..
make

Additional Information: 
Originally posted here: http://ubuntuforums.org/showthread.php?t=2273365

Not sure if there's some incompatibility between cmake and new versions of
Ubuntu, or if I have a botched upgrade.  It's just odd that this used to work
without this patch:
https://github.com/nickdesaulniers/cpp11-memcached/commit/4ce7505335c59754033b3c90409be050eb48d134
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-04-13 03:07 nickdesaulniersNew Issue                                    
======================================================================



More information about the cmake-developers mailing list