winsoft666 / zoe

C++ File Download Library.
GNU General Public License v3.0
37 stars 12 forks source link

centos make error #22

Closed haiki closed 5 months ago

haiki commented 2 years ago

在linux下面使用此源码,curl 版本 7.29.0, 执行make时发生下面的问题:

/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp: In function ‘void teemo::{anonymous}::locking_function(int, int, const char*, int)’:
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:39:23: error: ‘pthread_mutex_lock’ was not declared in this scope
 #define MUTEX_LOCK(x) pthread_mutex_lock(&(x))
                       ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:48:5: note: in expansion of macro ‘MUTEX_LOCK’
     MUTEX_LOCK(mutex_buf[n]);
     ^~~~~~~~~~
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:39:23: note: suggested alternative: ‘pthread_mutex_t’
 #define MUTEX_LOCK(x) pthread_mutex_lock(&(x))
                       ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:48:5: note: in expansion of macro ‘MUTEX_LOCK’
     MUTEX_LOCK(mutex_buf[n]);
     ^~~~~~~~~~
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:40:25: error: ‘pthread_mutex_unlock’ was not declared in this scope
 #define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x))
                         ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:50:5: note: in expansion of macro ‘MUTEX_UNLOCK’
     MUTEX_UNLOCK(mutex_buf[n]);
     ^~~~~~~~~~~~
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:40:25: note: suggested alternative: ‘pthread_mutex_t’
 #define MUTEX_UNLOCK(x) pthread_mutex_unlock(&(x))
                         ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:50:5: note: in expansion of macro ‘MUTEX_UNLOCK’
     MUTEX_UNLOCK(mutex_buf[n]);
     ^~~~~~~~~~~~
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp: In function ‘long unsigned int teemo::{anonymous}::id_function()’:
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:41:19: error: ‘pthread_self’ was not declared in this scope
 #define THREAD_ID pthread_self()
                   ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:54:26: note: in expansion of macro ‘THREAD_ID’
   return ((unsigned long)THREAD_ID);
                          ^~~~~~~~~
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:41:19: note: suggested alternative: ‘pthread_key_t’
 #define THREAD_ID pthread_self()
                   ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:54:26: note: in expansion of macro ‘THREAD_ID’
   return ((unsigned long)THREAD_ID);
                          ^~~~~~~~~
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp: In function ‘int teemo::{anonymous}::THREAD_setup()’:
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:37:24: error: ‘pthread_mutex_init’ was not declared in this scope
 #define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL)
                        ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:63:5: note: in expansion of macro ‘MUTEX_SETUP’
     MUTEX_SETUP(mutex_buf[i]);
     ^~~~~~~~~~~
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:37:24: note: suggested alternative: ‘pthread_mutex_t’
 #define MUTEX_SETUP(x) pthread_mutex_init(&(x), NULL)
                        ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:63:5: note: in expansion of macro ‘MUTEX_SETUP’
     MUTEX_SETUP(mutex_buf[i]);
     ^~~~~~~~~~~
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp: In function ‘int teemo::{anonymous}::THREAD_cleanup()’:
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:38:26: error: ‘pthread_mutex_destroy’ was not declared in this scope
 #define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x))
                          ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:76:5: note: in expansion of macro ‘MUTEX_CLEANUP’
     MUTEX_CLEANUP(mutex_buf[i]);
     ^~~~~~~~~~~~~
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:38:26: note: suggested alternative: ‘pthread_mutexattr_t’
 #define MUTEX_CLEANUP(x) pthread_mutex_destroy(&(x))
                          ^
/data2/workspace/outer_third_party/teemo/src/curl_utils.cpp:76:5: note: in expansion of macro ‘MUTEX_CLEANUP’
     MUTEX_CLEANUP(mutex_buf[i]);
     ^~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/teemo.dir/curl_utils.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/teemo.dir/all] Error 2
make: *** [all] Error 2

我看头文件中确实也没有包含 thread.h 头文件,能帮忙看下吗?不知是否是我的用法有问题。

winsoft666 commented 2 years ago

我在Ubuntu系统上编译是没有问题的,我使用vcpkg安装的libcurl