欢迎来到 Android人的问与答 ,在这里提问或帮助他人解答。 Question2Answer的1.6.x和1.7.x版本的中文翻译包我修改更新:

Question2answer

如何使用中文语言包

Q2A 1.6.x - Chinese Simplified (简体中文)

Q2A 1.7.x - Chinese Simplified (简体中文)


国内服务器推荐 阿里云服务器
国外服务器推荐 DigitalOcean
VPN推荐 正版Green VPN
阿里云推荐码:ldvq50

Ubuntu 11.04 下 Android4.0.1 编译错误解决方法

0 喜欢 0 不喜欢
250 浏览

1.错误一:error: ‘ptrdiff_t’ does not name a type

In file included from external/gtest/src/../include/gtest/gtest-param-test.h:157:0,

                 from external/gtest/src/../include/gtest/gtest.h:69,

                 from external/gtest/src/gtest_main.cc:32:

external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11: error: ‘ptrdiff_t’ does not name a type

In file included from external/gtest/src/../include/gtest/gtest-param-test.h:157:0,

                 from external/gtest/src/../include/gtest/gtest.h:69,

                 from external/gtest/src/../src/gtest.cc:34,

                 from external/gtest/src/gtest-all.cc:36:

external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11: error: ‘ptrdiff_t’ does not name a type

In file included from external/gtest/src/gtest-all.cc:38:0:

解决方法:

$vi external/gtest/src/../include/gtest/internal/gtest-param-util.h

#include <cstddef>

 

2.错误二: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>

 

3.错误三:error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]

frameworks/compile/slang/slang_rs_export_foreach.cpp:247:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]

cc1plus: all warnings being treated as errors

解决方法:

$ vi frameworks/compile/slang/Android.mk 

#local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror

local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter

 

这些错误有GCC4.6的,也有Android4.0的,在ubuntu和Android的官网上都有记载,可参看:

http://code.google.com/p/android/issues/detail?id=22011

http://code.google.com/p/android/issues/detail?id=22006#c0

http://groups.google.com/group/android-building/browse_thread/thread/0207abb98ed72304

https://wiki.edubuntu.org/GCC4.6

最新提问 1月 18, 2015 分类:Android编译 | 用户: forlong401 (7,050 分)

登录 或者 注册 后回答这个问题。

...