undefined reference to `pthread_mutexattr_destroy’

host C++: libgtest_host <= external/gtest/src/gtest-all.cc
true
host C++: libgtest_main_host <= external/gtest/src/gtest_main.cc
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Signals.o): In function `PrintStackTrace':
/home/aa/project/android4.0.1/external/llvm/lib/Support/Unix/Signals.inc:219: undefined reference to `dladdr'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Unix/Signals.inc:231: undefined reference to `dladdr'
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Threading.o): In function `llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
/home/aa/project/android4.0.1/external/llvm/lib/Support/Threading.cpp:96: undefined reference to `pthread_create'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Threading.cpp:91: undefined reference to `pthread_attr_setstacksize'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Threading.cpp:100: undefined reference to `pthread_join'
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o): In function `MutexImpl':
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:69: undefined reference to `pthread_mutexattr_init'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:75: undefined reference to `pthread_mutexattr_settype'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:80: undefined reference to `pthread_mutexattr_setpshared'
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:89: undefined reference to `pthread_mutexattr_destroy'
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Mutex.o): In function `llvm::sys::MutexImpl::tryacquire()':
/home/aa/project/android4.0.1/external/llvm/lib/Support/Mutex.cpp:143: undefined reference to `pthread_mutex_trylock'
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] Error 1
make: *** Waiting for unfinished jobs....
解决方法:
$vi external/llvm/llvm-host-build.mk
LOCAL_LDLIBS := -lpthread -ldl
下面这个解决方法没成功,会有新的错误:errors again :can't find threads.h file or dir.
$ vi external/llvm/lib/Support/Android.mk
LOCAL_C_INCLUDES += system/core/include/cutils
LOCAL_SHARED_LIBRARIES := libcutil
$ vi external/llvm/lib/Support/Mutex.cpp
#include <threads.h>
$ vi external/llvm/lib/Support/Threading.cpp
#include <threads.h>

原文链接: https://www.cnblogs.com/googlegis/archive/2012/01/07/2978730.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    undefined reference to `pthread_mutexattr_destroy'

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/39889

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月8日 下午4:33
下一篇 2023年2月8日 下午4:33

相关推荐