android移植第三方库,找不到pthread

不知名小ITer 2011-06-30 02:42:51
第三方库中有pthread的一些接口,但是好像android系统的源码中,没有提供POSIX的库。
结果在编译的时候报错:
ld :cannot find -lpthread.

大家是怎么解决的啊?给点意见,谢谢。
...全文
2081 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
majiaking018 2011-12-28
  • 打赏
  • 举报
回复
回复,阅读
ctroll 2011-10-20
  • 打赏
  • 举报
回复
在android中使用POSIX线程
1、在Android.mk中LOCAL_C_INCLUDES += system/core/include/cutils
线程库的头文件在这里。
2、在Android.mk中LOCAL_SHARED_LIBRARIES := libcutil
3、程序中加入 include threads.h

本文来源于<a href='http://newfaction.net'>Venus</a> , 原文地址:<a href='http://newfaction.net/2010/12/21/android-c-library-libcutils-the-underlying-language.html'> http://newfaction.net/2010/12/21/android-c-library-libcutils-the-underlying-language.html </a>
不知名小ITer 2011-07-01
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 fontlose 的回复:]

我也是看别的帖子才看到的,具体文档也没找到
http://comments.gmane.org/gmane.comp.gnome.mono.devel/34639
[/Quote]
谢谢,马上结贴。
fontlose 2011-07-01
  • 打赏
  • 举报
回复
我也是看别的帖子才看到的,具体文档也没找到
http://comments.gmane.org/gmane.comp.gnome.mono.devel/34639
不知名小ITer 2011-07-01
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 fontlose 的回复:]

Android runs the Linux kernel, but moves many things around compared to a "normal" desktop Linux distro. In particular, note that Android includes pthread_*()functions within libc, not libpthread, t……
[/Quote]
果然是的,只不过支持不全,不需要引用-lpthread,pthread_cancel()确实没有。
你们这些文档是在哪里看的啊?我在android的source下的docs里面没有看到呀。
fontlose 2011-06-30
  • 打赏
  • 举报
回复
Android runs the Linux kernel, but moves many things around compared to a "normal" desktop Linux distro. In particular, note that Android includes pthread_*()functions within libc, not libpthread, thus the added configure check.
* include/private/gcconfig.h: Android platforms are built atop Linux,
don't use glibc, and uses `environ` instead of `__environ`.
* configure.in: Use AC_CHECK_LIB() to check for pthread instead of
just blindly linking to -lpthread, as Android includes pthread
support within libc and doesn't provide a separate libpthread
oyq_yangy 2011-06-30
  • 打赏
  • 举报
回复
有啊,只是pthread在c库里了,如果我没有记错的话。

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧