android4.0源码编译错误

GhostKang 2011-12-20 08:30:43
ubuntu11.10,32位操作系统,编译源码的时候出现一下错误,求帮助。

host Executable: test-librsloader (out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader)
out/host/linux-x86/obj/STATIC_LIBRARIES/libLLVMSupport_intermediates/libLLVMSupport.a(Signals.o): In function `PrintStackTrace':
/data/Android4.0SourceCode2/Android4.0SourceCode/external/llvm/lib/Support/Unix/Signals.inc:219: undefined reference to `dladdr'
/data/Android4.0SourceCode2/Android4.0SourceCode/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)':
/data/Android4.0SourceCode2/Android4.0SourceCode/external/llvm/lib/Support/Threading.cpp:96: undefined reference to `pthread_create'
/data/Android4.0SourceCode2/Android4.0SourceCode/external/llvm/lib/Support/Threading.cpp:91: undefined reference to `pthread_attr_setstacksize'
/data/Android4.0SourceCode2/Android4.0SourceCode/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':
/data/Android4.0SourceCode2/Android4.0SourceCode/external/llvm/lib/Support/Mutex.cpp:69: undefined reference to `pthread_mutexattr_init'
/data/Android4.0SourceCode2/Android4.0SourceCode/external/llvm/lib/Support/Mutex.cpp:75: undefined reference to `pthread_mutexattr_settype'
/data/Android4.0SourceCode2/Android4.0SourceCode/external/llvm/lib/Support/Mutex.cpp:80: undefined reference to `pthread_mutexattr_setpshared'
/data/Android4.0SourceCode2/Android4.0SourceCode/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()':
/data/Android4.0SourceCode2/Android4.0SourceCode/external/llvm/lib/Support/Mutex.cpp:143: undefined reference to `pthread_mutex_trylock'
collect2: ld 返回 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] 错误 1
...全文
1522 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
yotagee 2012-01-12
  • 打赏
  • 举报
回复
7楼说到对,是gcc 4.6版本的问题。不过你说你是32的,我的是64位的ubuntu11.10 改用gcc 4.5的 安装以下四个包
sudo apt-get install gcc-4.5 g++-4.5 gcc-4.5-multilib g++-4.5-multilib

cd /usr/bin
sudo ln -sf cpp-4.5 cpp
sudo ln -sf gcc-4.5 gcc
sudo ln -sf g++-4.5 g++
沙丘-毒药 2011-12-22
  • 打赏
  • 举报
回复
谢谢11楼,我按照你写的做了,但是又出现下面的问题,出现一大堆关于V8的LINK 问题,让人抓狂啊:

ptions(v8::Local<v8::Value>, bool&):external/webkit/Source/WebCore/bindings/v8/custom/V8GeolocationCustom.cpp:117: error: undefined reference to 'v8::Value::ToInt32() const'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a(V8Int16ArrayCustom.o): in function WebCore::toV8(WebCore::Int16Array*):external/webkit/Source/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp:62: error: undefined reference to 'v8::Object::SetIndexedPropertiesToExternalArrayData(void*, v8::ExternalArrayType, int)'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a(V8SQLTransactionCustom.o): in function WebCore::V8SQLTransaction::executeSqlCallback(v8::Arguments const&):external/webkit/Source/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp:71: error: undefined reference to 'v8::Object::GetPropertyNames()'
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a(V8SQLTransactionSyncCustom.o): in function WebCore::V8SQLTransactionSync::executeSqlCallback(v8::Arguments const&):external/webkit/Source/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp:71: error: undefined reference to 'v8::Object::GetPropertyNames()'
collect2: ld returned 1 exit status
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libwebcore_intermediates/LINKED/libwebcore.so] Error 1
make: *** Waiting for unfinished jobs....
沙丘-毒药 2011-12-22
  • 打赏
  • 举报
回复
ubuntu11.10,32位操作系统,编译源码的时候出现一下错误:

Install: out/target/product/generic/system/lib/libstdc++.so
Install: out/target/product/generic/system/lib/libm.so
target SharedLib: liblog (out/target/product/generic/obj/SHARED_LIBRARIES/liblog_intermediates/LINKED/liblog.so)
target SharedLib: libicuuc (out/target/product/generic/obj/SHARED_LIBRARIES/libicuuc_intermediates/LINKED/libicuuc.so)
Install: out/target/product/generic/system/lib/libgabi++.so
Install: out/host/linux-x86/bin/adb
target SharedLib: libext4_utils (out/target/product/generic/obj/SHARED_LIBRARIES/libext4_utils_intermediates/LINKED/libext4_utils.so)
Install: out/host/linux-x86/bin/simg2img
acp: file 'out/host/linux-x86/obj/EXECUTABLES/vm-tests_intermediates/tests/data' does not exist
make: *** [out/host/linux-x86/bin/../cts_dalviktests/timestamp] Error 1
make: *** Waiting for unfinished jobs....
Note: Some input files use unchecked or unsafe operations.
沙丘-毒药 2011-12-21
  • 打赏
  • 举报
回复
谢谢 9楼的建议,回家试试~~~~
firecxx 2011-12-21
  • 打赏
  • 举报
回复
请切换至英文环境。中文因为编码的问题,可能导致这种坑爹情况发生
沙丘-毒药 2011-12-21
  • 打赏
  • 举报
回复
就是啊,我在11.10上编译就出了许多千奇百怪的问题,比如:
麻烦各位大侠帮解决一下
host Executable: minigzip (out/host/linux-x86/obj/EXECUTABLES/minigzip_intermediates/minigzip)
host Executable: mkbootfs (out/host/linux-x86/obj/EXECUTABLES/mkbootfs_intermediates/mkbootfs)
true
host StaticLib: libmincrypt (out/host/linux-x86/obj/STATIC_LIBRARIES/libmincrypt_intermediates/libmincrypt.a)
true
true
host Executable: mksdcard (out/host/linux-x86/obj/EXECUTABLES/mksdcard_intermediates/mksdcard)
host Executable: mkyaffs2image (out/host/linux-x86/obj/EXECUTABLES/mkyaffs2image_intermediates/mkyaffs2image)
host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp
true
true
host C++: post_trace <= sdk/emulator/qtools/post_trace.cpp
host C++: post_trace <= sdk/emulator/qtools/trace_reader.cpp
true
host C++: post_trace <= sdk/emulator/qtools/decoder.cpp
<命令行>:0:16: 错误: #undef 指示的末尾有多余的标识符 [-Werror]
<命令行>:0:16: 警告: #undef 指示的末尾有多余的标识符 [默认启用]
<命令行>:0:16: 警告: #undef 指示的末尾有多余的标识符 [默认启用]
cc1plus:所有的警告都被当作是错误

make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] 错误 1
make: *** 正在等待未完成的任务....
<命令行>:0:16: 警告: #undef 指示的末尾有多余的标识符 [默认启用]
最后一个菜鸟 2011-12-21
  • 打赏
  • 举报
回复
我用fedora14,也遇到挺多问题,写了总结,希望对你有用
wyx100 2011-12-20
  • 打赏
  • 举报
回复
支持2楼。。。
GhostKang 2011-12-20
  • 打赏
  • 举报
回复
2楼你说的这些包我都安装了,甚至更多!但我还是遇到了各种各样的错误。ubunut11.10和11.04有很多不同,32位的系统和64位的也有很多的不同,所以会遇到各种问题,在我编译过程中我就修改了很多源代码。
yyhzpk 2011-12-20
  • 打赏
  • 举报
回复
android 源代码一般不需要修改的,除非你环境哪里有问题
TARGET_CPU_ABI属性设置了吧?
试一下以下组件
1. sudo apt-get install bison

2. sudo apt-get install build-essential

3. sudo apt-get install zlib1g-dev

4. sudo apt-get install flex

5. sudo apt-get install libncurses-dev

6. sudo apt-get install libx11-dev

7. sudo apt-get install gperf

GhostKang 2011-12-20
  • 打赏
  • 举报
回复
进入源码的根目录
使用命令: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>”
Fiven_Luo 2011-12-20
  • 打赏
  • 举报
回复
你用11.10的话,必须把gcc从4.5降回4.4,否则会报错。我现在用的就是11.10,4.0编译OK。
以下供参考:
sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib

cd /usr/bin
sudo ln -sf cpp-4.4 cpp
sudo ln -sf gcc-4.4 gcc
sudo ln -sf g++-4.4 g++
jjyyhema 2011-12-20
  • 打赏
  • 举报
回复
没用的,当初我搞了好久都没搞定。。没办法,换回10.04LTS喽
yyhzpk 2011-12-20
  • 打赏
  • 举报
回复
我们编译都没有问题呀,不知道是不是平台的问题
另外你不能拉最新版本,需要checkout一个version

80,359

社区成员

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

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