benim ortamıdır " "-pthread" yerine -lpthread:?cmake kullanımı
- OS: Ubuntu
- gcc 14.10: 4.9
- cmake: 2.8, 3.1 (hem çalıştı)
- projesi:. kaynağını inşa etmek sorunları varken son muduo
, ben bec, ağ programlama öğrenmek ve öğrenme için muduo indirmek için başladık ause cmake "-lpthreads" bulamıyor.
Bazı araştırmalar yaptım. Çoğunlukla Ubuntu 14.10'un altındaki yeni gcc versiyonundan kaynaklanır. Gcc-4.9, pthread kütüphanesine bağlanmak için "-pthread" kullanır, ancak gcc'nin eski sürümü "-lpthreads" kullanır.
File /home/jack/workspace/github/build/release/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/jack/workspace/github/build/release/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTryCompileExec2265723491/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2265723491.dir/build.make CMakeFiles/cmTryCompileExec2265723491.dir/build
make[1]: Entering directory '/home/jack/workspace/github/build/release/CMakeFiles/CMakeTmp'
/usr/local/bin/cmake -E cmake_progress_report /home/jack/workspace/github/build/release/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2265723491.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTryCompileExec2265723491.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-3.1/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec2265723491
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2265723491.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTryCompileExec2265723491.dir/CheckFunctionExists.c.o -o cmTryCompileExec2265723491 -rdynamic -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTryCompileExec2265723491.dir/build.make:88: recipe for target 'cmTryCompileExec2265723491' failed
make[1]: Leaving directory '/home/jack/workspace/github/build/release/CMakeFiles/CMakeTmp'
Makefile:118: recipe for target 'cmTryCompileExec2265723491/fast' failed
make[1]: *** [cmTryCompileExec2265723491] Error 1
make: *** [cmTryCompileExec2265723491/fast] Error 2
Herkes Bunu düzeltmek ve bana derlemek izin bilir: O Aşağıda
hata günlüğü olduğunu ... cmake hala "-lpthreads" kullanır ve bu düzeltmek için nasıl bilmiyorum görünüyor Ubuntu 14.10 muduo mu?
'CMakeLists.txt'inizde' find_package (Threads REQUIRED) 'ifadesini kullanıyor musunuz? Dosyanızı göstermelisiniz .. – stefan
http://stackoverflow.com/questions/23250863/difference-between-pthread-and-lpthread-while-compiling – DumbCoder
Yardımına Yardımcı Olursa Yardımcı Olun muduo. Bu libboost-dev eksikliği nedeniyle. Hata iletisi yanıltıcı ... –