zoukankan      html  css  js  c++  java
  • Android开发编译ICS时遇到collect2: ld returned 1 exit status错误解决方案

    编译Android4.0时遇到下面的问题,
    /home/joeyjiaojg/android/src/cm4/external/llvm/lib/Support/Mutex.cpp:69: undefined reference to `pthread_mutexattr_init'
    /home/joeyjiaojg/android/src/cm4/external/llvm/lib/Support/Mutex.cpp:75: undefined reference to `pthread_mutexattr_settype'
    /home/joeyjiaojg/android/src/cm4/external/llvm/lib/Support/Mutex.cpp:80: undefined reference to `pthread_mutexattr_setpshared'
    /home/joeyjiaojg/android/src/cm4/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/joeyjiaojg/android/src/cm4/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

    解决方法:

    进入源码的根目录
    使用命令:gedit external/llvm/lib/Support/Android.mk

    在文件中的两部分都加入LOCAL_C_INCLUDES+=system/core/include/cutils和LOCAL_SHARED_LIBRARIES := libcutil

    使用命令:gedit external/llvm/lib/Support/Mutex.cpp

    在Mutex.cpp中加入头文件 “#include <threads.h>”

    使用命令:gedit external/llvm/lib/Support/Threading.cpp

    在Threading.cpp中加入头文件 “#include <threads.h>”

  • 相关阅读:
    大学生程序猿IT情书“2014爱的告白挑战赛”获奖名单及优秀情书展示系列之
    Codeforces 385C Bear and Prime Numbers
    CSU1659: Graph Center(最短路)
    新版ADT出现appcompat_v7的问题
    @IBDesignable和@IBInspectable
    FTP命令详解
    R语言屏幕输出
    R语言常用基础知识(入门)
    R语言数据类型转换
    使用建议(内部使用)
  • 原文地址:https://www.cnblogs.com/thinkfeed/p/2293633.html
Copyright © 2011-2022 走看看