DCache make 时报错
[ 1%] Built target TarsComm
[ 3%] Built target tars-RouterServer
[ 8%] Built target RouterServer
[ 12%] Built target cache_comm
[ 13%] Built target tars-ConfigServer
[ 16%] Built target ConfigServer
[ 16%] Built target tars-CombinDbAccessServer
[ 19%] Built target CombinDbAccessServer
[ 22%] Built target tars-KVCacheServer
[ 34%] Built target KVCacheServer
[ 38%] Built target tars-MKVCacheServer
[ 53%] Built target MKVCacheServer
[ 53%] Built target tars-DCacheOptServer
[ 53%] Built target tars-PropertyServer
[ 56%] Built target PropertyServer
[ 56%] Built target tars-ProxyServer
[ 61%] Built target ProxyServer
[ 66%] Built target DCacheOptServer
[ 71%] Built target libProxy
[ 72%] Linking CXX executable ../../bin/test-TimerThreadTest
../../lib/liblibProxy.a(ProxyImp.cpp.o): In function CacheCallbackComm::getThreadData()': ProxyImp.cpp:(.text._ZN17CacheCallbackComm13getThreadDataEv[_ZN17CacheCallbackComm13getThreadDataEv]+0x13): undefined reference to pthread_getspecific'
ProxyImp.cpp:(.text._ZN17CacheCallbackComm13getThreadDataEv[_ZN17CacheCallbackComm13getThreadDataEv]+0x13b): undefined reference to pthread_setspecific' ../../lib/liblibProxy.a(ProxyImp.cpp.o): In function int CacheCallbackComm::getCacheProxy<tars::TC_AutoPtrDCache::MKCacheProxy >(std::string const&, std::string const&, std::string&, tars::TC_AutoPtrDCache::MKCacheProxy&, std::string const&)':
ProxyImp.cpp:(.text.ZN17CacheCallbackComm13getCacheProxyIN4tars10TC_AutoPtrIN6DCache12MKCacheProxyEEEEEiRKSsS7_RSsRT_S7[ZN17CacheCallbackComm13getCacheProxyIN4tars10TC_AutoPtrIN6DCache12MKCacheProxyEEEEEiRKSsS7_RSsRT_S7]+0x27): undefined reference to pthread_getspecific' ProxyImp.cpp:(.text._ZN17CacheCallbackComm13getCacheProxyIN4tars10TC_AutoPtrIN6DCache12MKCacheProxyEEEEEiRKSsS7_RSsRT_S7_[_ZN17CacheCallbackComm13getCacheProxyIN4tars10TC_AutoPtrIN6DCache12MKCacheProxyEEEEEiRKSsS7_RSsRT_S7_]+0x19e): undefined reference to pthread_setspecific'
../../lib/liblibProxy.a(ProxyImp.cpp.o): In function int CacheCallbackComm::getWCacheProxy<tars::TC_AutoPtr<DCache::MKWCacheProxy> >(std::string const&, std::string const&, std::string&, tars::TC_AutoPtr<DCache::MKWCacheProxy>&)': ProxyImp.cpp:(.text._ZN17CacheCallbackComm14getWCacheProxyIN4tars10TC_AutoPtrIN6DCache13MKWCacheProxyEEEEEiRKSsS7_RSsRT_[_ZN17CacheCallbackComm14getWCacheProxyIN4tars10TC_AutoPtrIN6DCache13MKWCacheProxyEEEEEiRKSsS7_RSsRT_]+0x24): undefined reference to pthread_getspecific'
ProxyImp.cpp:(.text.ZN17CacheCallbackComm14getWCacheProxyIN4tars10TC_AutoPtrIN6DCache13MKWCacheProxyEEEEEiRKSsS7_RSsRT[ZN17CacheCallbackComm14getWCacheProxyIN4tars10TC_AutoPtrIN6DCache13MKWCacheProxyEEEEEiRKSsS7_RSsRT]+0x183): undefined reference to pthread_setspecific' ../../lib/liblibProxy.a(ProxyImp.cpp.o): In function CacheCallbackComm::reportException(std::string const&)':
ProxyImp.cpp:(.text._ZN17CacheCallbackComm15reportExceptionERKSs[_ZN17CacheCallbackComm15reportExceptionERKSs]+0x1e): undefined reference to pthread_getspecific' ProxyImp.cpp:(.text._ZN17CacheCallbackComm15reportExceptionERKSs[_ZN17CacheCallbackComm15reportExceptionERKSs]+0x183): undefined reference to pthread_setspecific'
../../lib/liblibProxy.a(ProxyImp.cpp.o): In function CacheCallbackComm::doResponse(int, std::string const&, StatType, tars::TC_AutoPtr<Responser>)': ProxyImp.cpp:(.text._ZN17CacheCallbackComm10doResponseEiRKSs8StatTypeN4tars10TC_AutoPtrI9ResponserEE[_ZN17CacheCallbackComm10doResponseEiRKSs8StatTypeN4tars10TC_AutoPtrI9ResponserEE]+0x9a): undefined reference to pthread_getspecific'
ProxyImp.cpp:(.text._ZN17CacheCallbackComm10doResponseEiRKSs8StatTypeN4tars10TC_AutoPtrI9ResponserEE[_ZN17CacheCallbackComm10doResponseEiRKSs8StatTypeN4tars10TC_AutoPtrI9ResponserEE]+0x337): undefined reference to pthread_setspecific' ../../lib/liblibProxy.a(ProxyImp.cpp.o): In function GetKVCallback::callback_getKV(int, DCache::GetKVRsp const&)':
ProxyImp.cpp:(.text._ZN13GetKVCallback14callback_getKVEiRKN6DCache8GetKVRspE[_ZN13GetKVCallback14callback_getKVEiRKN6DCache8GetKVRspE]+0x53d): undefined reference to pthread_getspecific' ProxyImp.cpp:(.text._ZN13GetKVCallback14callback_getKVEiRKN6DCache8GetKVRspE[_ZN13GetKVCallback14callback_getKVEiRKN6DCache8GetKVRspE]+0x920): undefined reference to pthread_setspecific'
../../lib/liblibProxy.a(ProxyImp.cpp.o): In function SetKVCallback::callback_setKV(int)': ProxyImp.cpp:(.text._ZN13SetKVCallback14callback_setKVEi[_ZN13SetKVCallback14callback_setKVEi]+0x4bd): undefined reference to pthread_getspecific'
ProxyImp.cpp:(.text._ZN13SetKVCallback14callback_setKVEi[_ZN13SetKVCallback14callback_setKVEi]+0x8a5): undefined reference to pthread_setspecific' ../../lib/liblibProxy.a(ProxyImp.cpp.o): In function InsertKVCallback::callback_insertKV(int)':
ProxyImp.cpp:(.text._ZN16InsertKVCallback17callback_insertKVEi[_ZN16InsertKVCallback17callback_insertKVEi]+0x4bd): undefined reference to pthread_getspecific' ProxyImp.cpp:(.text._ZN16InsertKVCallback17callback_insertKVEi[_ZN16InsertKVCallback17callback_insertKVEi]+0x8a5): undefined reference to pthread_setspecific'
../../lib/liblibProxy.a(ProxyImp.cpp.o): In function UpdateKVCallback::callback_updateKV(int, DCache::UpdateKVRsp const&)': ProxyImp.cpp:(.text._ZN16UpdateKVCallback17callback_updateKVEiRKN6DCache11UpdateKVRspE[_ZN16UpdateKVCallback17callback_updateKVEiRKN6DCache11UpdateKVRspE]+0x45d): undefined reference to pthread_getspecific'
ProxyImp.cpp:(.text._ZN16UpdateKVCallback17callback_updateKVEiRKN6DCache11UpdateKVRspE[_ZN16UpdateKVCallback17callback_updateKVEiRKN6DCache11UpdateKVRspE]+0x84e): undefined reference to pthread_setspecific' ../../lib/liblibProxy.a(ProxyImp.cpp.o): In function EraseKVCallback::callback_eraseKV(int)':
ProxyImp.cpp:(.text._ZN15EraseKVCallback16callback_eraseKVEi[_ZN15EraseKVCallback16callback_eraseKVEi]+0x4ce): undefined reference to pthread_getspecific' ProxyImp.cpp:(.text._ZN15EraseKVCallback16callback_eraseKVEi[_ZN15EraseKVCallback16callback_eraseKVEi]+0x78a): undefined reference to pthread_setspecific'
../../lib/liblibProxy.a(ProxyImp.cpp.o): In function DelKVCallback::callback_delKV(int)': ProxyImp.cpp:(.text._ZN13DelKVCallback14callback_delKVEi[_ZN13DelKVCallback14callback_delKVEi]+0x4ce): undefined reference to pthread_getspecific'
ProxyImp.cpp:(.text._ZN13DelKVCallback14callback_delKVEi[_ZN13DelKVCallback14callback_delKVEi]+0x78a): undefined reference to pthread_setspecific' ../../lib/liblibProxy.a(ProxyImp.cpp.o): In function GetZSetScoreCallback::callback_getZSetScore(int, double)':
ProxyImp.cpp:(.text._ZN20GetZSetScoreCallback21callback_getZSetScoreEid[_ZN20GetZSetScoreCallback21callback_getZSetScoreEid]+0x4d7): undefined reference to pthread_getspecific' ProxyImp.cpp:(.text._ZN20GetZSetScoreCallback21callback_getZSetScoreEid[_ZN20GetZSetScoreCallback21callback_getZSetScoreEid]+0x8a8): undefined reference to pthread_setspecific'
../../lib/liblibProxy.a(CacheCallbackComm.cpp.o): In function ThreadKey::KeyInitialize::~KeyInitialize()': CacheCallbackComm.cpp:(.text._ZN9ThreadKey13KeyInitializeD2Ev[_ZN9ThreadKey13KeyInitializeD5Ev]+0xa): undefined reference to pthread_key_delete'
../../lib/liblibProxy.a(CacheCallbackComm.cpp.o): In function ThreadKey::KeyInitialize::KeyInitialize()': CacheCallbackComm.cpp:(.text._ZN9ThreadKey13KeyInitializeC2Ev[_ZN9ThreadKey13KeyInitializeC5Ev]+0x17): undefined reference to pthread_key_create'
/usr/local/tars/cpp/thirdparty/lib64/libgtest.a(gtest-all.cc.o): In function testing::internal::ThreadLocal<testing::TestPartResultReporterInterface*>::~ThreadLocal()': gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x15): undefined reference to pthread_getspecific'
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x2a): undefined reference to pthread_key_delete' /usr/local/tars/cpp/thirdparty/lib64/libgtest.a(gtest-all.cc.o): In function testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocatortesting::internal::TraceInfo > >::~ThreadLocal()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED5Ev]+0x15): undefined reference to pthread_getspecific' gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED5Ev]+0x2a): undefined reference to pthread_key_delete'
/usr/local/tars/cpp/thirdparty/lib64/libgtest.a(gtest-all.cc.o): In function testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocator<testing::internal::TraceInfo> > >::GetOrCreateValue() const': gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0x16): undefined reference to pthread_getspecific'
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv]+0x79): undefined reference to pthread_setspecific' /usr/local/tars/cpp/thirdparty/lib64/libgtest.a(gtest-all.cc.o): In function testing::internal::ThreadLocaltesting::TestPartResultReporterInterface*::CreateKey()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE9CreateKeyEv]+0x16): undefined reference to pthread_key_create' /usr/local/tars/cpp/thirdparty/lib64/libgtest.a(gtest-all.cc.o): In function testing::internal::ThreadLocal<std::vector<testing::internal::TraceInfo, std::allocatortesting::internal::TraceInfo > >::CreateKey()':
gtest-all.cc:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE9CreateKeyEv[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE9CreateKeyEv]+0x16): undefined reference to pthread_key_create' /usr/local/tars/cpp/thirdparty/lib64/libgtest.a(gtest-all.cc.o): In function testing::internal::ThreadLocaltesting::TestPartResultReporterInterface*::GetOrCreateValue() const':
gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0x16): undefined reference to pthread_getspecific' gtest-all.cc:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[_ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv]+0x79): undefined reference to pthread_setspecific'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/test-TimerThreadTest] Error 1
make[1]: *** [test/Proxy/CMakeFiles/test-TimerThreadTest.dir/all] Error 2
make: *** [all] Error 2
cmake改一下, 要link一下pthread
不会,怎么加?
更改/usr/local/DCache/build 目录下的CMakeCache.txt
//Flags used by the linker. CMAKE_EXE_LINKER_FLAGS:STRING=-lpthread