Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows下使用Android NDK构建失败,提示找不到pthread库 #2097

Closed
AelecTi opened this issue Jul 18, 2024 · 2 comments
Closed

Windows下使用Android NDK构建失败,提示找不到pthread库 #2097

AelecTi opened this issue Jul 18, 2024 · 2 comments

Comments

@AelecTi
Copy link

AelecTi commented Jul 18, 2024

如题,在链接时出错:ld.lld: error: unable to find library -lpthread

复现BUG

  • 运行vcpkg install drogon[ctl]:arm64-android,随后查看错误日志
  • 或者创建一个使用了drogon的Android动态库并编译,等待报错

修复

问题出在drogon/trantor/CMakeList.txt第284行,这样修改能暂时解决问题:

elseif(NOT ANDROID)  #原先是else(WIN32)
   target_link_libraries(${PROJECT_NAME} PRIVATE pthread $<$<PLATFORM_ID:SunOS>:socket>) 

问题原因

Android NDK将pthread整合到了libc中,因此找不到也不需要独立的pthread

@an-tao
Copy link
Member

an-tao commented Jul 19, 2024

感谢反馈,可以提交个PR吗

@AelecTi
Copy link
Author

AelecTi commented Jul 19, 2024

提交了,感谢回复
an-tao/trantor#344

@AelecTi AelecTi closed this as completed Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants