<!-- @page { margin: 2cm } P { margin-bottom: 0.21cm } -->

问题1:

Copying: out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes-full-debug.jar

Install: out/host/linux-x86/framework/dx.jar

Install: out/host/linux-x86/bin/dx

host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)

/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): in function thread_store_set:system/core/libcutils/threads.c:36: error: undefined reference to 'pthread_key_create'

/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): in function thread_store_set:system/core/libcutils/threads.c:44: error: undefined reference to 'pthread_setspecific'

/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a(threads.o): in function thread_store_get:system/core/libcutils/threads.c:27: error: undefined reference to 'pthread_getspecific'

collect2: ld returned 1 exit status

make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] 错误 1

[email protected]:~/android/Android-2.0$

解决这个出错的办法,找到目录:

/home/tony/android/Android-2.0/frameworks/base/tools/aapt

然后打开文件Android.mk,编辑下面一行:

LOCAL_LDLIBS := -lz

ifeq ($(HOST_OS),linux)

#LOCAL_LDLIBS += -lrt       把这行注释掉,改为下面一行。

LOCAL_LDLIBS += -lrt -lpthread

endif

请问编译时加-lpthread有何作用?

链接多线程的库在程序中用到了pthread.h头文件中的函数时需要加这个选项编译时加与不加-lpthread,在执行时究竟有哪些具体区别呢?
区别在于 ELF解析器,而不是内核。 内核execve返回到用户空间时,执行的是interpreter;如果有链接到libpthread库,interpreter程序会先加载这个库,然后再回到a.out去执行。

更多相关文章

  1. Android 拦截TextView中超链接点击事件
  2. Android中自带的RSA加密算法和JAVA中的区别
  3. android超链接
  4. android中将静态库链接进动态库成功的例子
  5. android textView加载html 解决a标签链接无效
  6. Android内核驱动开发中的Kconfig文件结构分析(图文)
  7. Android注册广播两种方式的区别
  8. Android中Application、静态变量和Sharedpreferences的使用与区

随机推荐

  1. Android加固技术分析与多渠道打包实践
  2. Android(安卓)技术-- 图形系统详解
  3. Android开发人员必须掌握的10 个开发工具
  4. Android系统服务接口
  5. [Android]LayoutInflater的inflate方法半
  6. Android我还可以相信你多少系列文章五之
  7. android framework 启动流程
  8. 《Java和Android开发实战详解》
  9. Android中图片Bitmap的缩放
  10. php与android的简单交互