首页 / 操作系统 / Linux / Android 开发环境建立-gcc 的问题
安装配置Ubuntu 的Android开发环境现在开始了漫长的编译过程,当然成功不会一蹴而就的,不出所料,错误出现了ost C: adb <= system/core/adb/fdevent.chost 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 parameterstrueInstall: out/host/linux-x86/bin/adbhost C++: atree <= build/tools/atree/atree.cpphost C++: atree <= build/tools/atree/files.cpphost C++: atree <= build/tools/atree/fs.cpphost Executable: atree (out/host/linux-x86/obj/EXECUTABLES/atree_intermediates/atree)trueInstall: out/host/linux-x86/bin/atreehost C++: bb2sym <= development/emulator/qtools/bb2sym.cpphost C++: bb2sym <= development/emulator/qtools/trace_reader.cppdevelopment/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 --versiongcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1Copyright (C) 2009 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; 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 gccsudo ln -f/usr/bin/g++-4.3 g++这样就可以用4.3版本的gcc和g++将原来的覆盖掉,重新进入android源码目录执行make就可以正常编译~~