Android 开发环境建立

安装配置UbuntuAndroid开发环境现在开始了漫长的编译过程,当然成功不会一蹴而就的,不出所料,错误出现了

ost C: adb <= system/core/adb/fdevent.c

host Executable: adb (out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb)

out/host/linux-x86/obj/STATIC_LIBRARIES/libzipfile_intermediates/libzipfile.a(centraldir.o): In function `memset':

/usr/include/bits/string3.h:82: warning: memset used with constant zero length parameter; this could be due to transposed parameters

true

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

host C++: atree <= build/tools/atree/atree.cpp

host C++: atree <= build/tools/atree/files.cpp

host C++: atree <= build/tools/atree/fs.cpp

host Executable: atree (out/host/linux-x86/obj/EXECUTABLES/atree_intermediates/atree)

true

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

host C++: bb2sym <= development/emulator/qtools/bb2sym.cpp

host C++: bb2sym <= development/emulator/qtools/trace_reader.cpp

development/emulator/qtools/trace_reader.cpp: In function ‘char* ExtractDexPathFromMmap(const char*)’:

development/emulator/qtools/trace_reader.cpp:1012: error: invalid conversion from ‘const char*’ to ‘char*’

development/emulator/qtools/trace_reader.cpp:1015: error: invalid conversion from ‘const char*’ to ‘char*’

make: *** [out/host/linux-x86/obj/EXECUTABLES/bb2sym_intermediates/trace_reader.o] 错误 1

继续求教于,Google和百度吧,原来是gcc版本的问题

$gcc --version

gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1

Copyright (C) 2009 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

研究了一下发现问题主要出在Ubuntu10.4预置了gcc的版本是4.4,该版本编译时对语法要求比较高,因此无法编译源代码,解决方法就是将gcc-4.4降级成gcc-4.3

具体操作:sudo apt-get install gcc-4.3(安装gcc-4.3)

sudo apt-get install g++-4.3(安装g++-4.3)

安装完4.3版本后,执行gcc --version后会发现版本仍然是4.4,因为gcc已经和4.4版本进行了链接,因此需要对gcc重新进行链接

具体操作:sudo ln -f /usr/bin/gcc-4.3 gcc

sudo ln -f/usr/bin/g++-4.3 g++

这样就可以用4.3版本的gcc和g++将原来的覆盖掉,重新进入android源码目录执行make就可以正常编译~~

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwsfyd.html