首页 > Linux Usage, Other > 继续遭遇杯具

继续遭遇杯具

2012-10-24 18:39 星期三    浏览: 2,500    绿 发表评论 阅读评论

尝鲜尝到杯具了!

Ubuntu 12.10使用了最新的GCC编译器4.7.2:

bill@ubuntu:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v –with-pkgversion=’Ubuntu/Linaro 4.7.2-2ubuntu1′ –with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs –enable-languages=c,c++,go,fortran,objc,obj-c++ –prefix=/usr –program-suffix=-4.7 –enable-shared –enable-linker-build-id –with-system-zlib –libexecdir=/usr/lib –without-included-gettext –enable-threads=posix –with-gxx-include-dir=/usr/include/c++/4.7 –libdir=/usr/lib –enable-nls –with-sysroot=/ –enable-clocale=gnu –enable-libstdcxx-debug –enable-libstdcxx-time=yes –enable-gnu-unique-object –enable-plugin –enable-objc-gc –enable-targets=all –disable-werror –with-arch-32=i686 –with-tune=generic –enable-checking=release –build=i686-linux-gnu –host=i686-linux-gnu –target=i686-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)

但在编译Android(ICS版本)的本地工具的模板类时,可能是新的编译器对语法要求更严格,会遇到编译错误,Google了下,在Google groups(https://groups.google.com/forum/#!msg/android-building/2EwtWQTqjdI/fbZlzXErscwJ)发现Fedora17的GCC4.7.0也有此问题,因为Android代码的编译使用GCC4.4.3,还不支持高版本。

host C++: aapt <= frameworks/base/tools/aapt/AaptAssets.cpp
<command-line>:0:0: warning: “_FORTIFY_SOURCE” redefined [enabled by default]
frameworks/base/tools/aapt/AaptAssets.cpp:1:0: note: this is the location of the previous definition
In file included from frameworks/base/include/utils/AssetManager.h:25:0,
                 from frameworks/base/tools/aapt/AaptAssets.h:10,
                 from frameworks/base/tools/aapt/AaptAssets.cpp:5:
frameworks/base/include/utils/KeyedVector.h: In instantiation of ‘const VALUE& android::DefaultKeyedVector<KEY, VALUE>::valueFor(const KEY&) const [with KEY = android::String8; VALUE = android::sp<AaptSymbols>]’:
frameworks/base/tools/aapt/AaptAssets.h:446:59:   required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptSymbols> >’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
frameworks/base/include/utils/KeyedVector.h: In instantiation of ‘const VALUE& android::DefaultKeyedVector<KEY, VALUE>::valueFor(const KEY&) const [with KEY = android::String8; VALUE = android::sp<AaptGroup>]’:
frameworks/base/tools/aapt/AaptAssets.cpp:1636:41:   required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptGroup> >’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
frameworks/base/include/utils/KeyedVector.h: In instantiation of ‘const VALUE& android::DefaultKeyedVector<KEY, VALUE>::valueFor(const KEY&) const [with KEY = android::String8; VALUE = android::sp<AaptDir>]’:
frameworks/base/tools/aapt/AaptAssets.cpp:1700:53:   required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptDir> >’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/AaptAssets.o] Error 1

要么自己修改代码(有多个Android版本需要编译,放弃),要么坐等Google升级代码,要么重新搞个低版本的GCC。尽管最后一种方式最省时间,但也得折腾花时间。

后记:为了节省时间,并且不喜欢12.10中的Dash,最终退回到10.04.4,这也是Google所推荐的版本(环境配置可参见google官方指南: http://source.android.com/source/initializing.html)

本文链接地址: http://blog.redwolf-soft.com/?p=1801

原创文章,版权©红狼博客所有, 转载随意,但请注明出处。

    分享到:

相关文章:

  • 无相关文章
分类: Linux Usage, Other 标签: ,
  1. 水弟
    2012年12月17日16:10 | #1

    朋友 你现在改好了吗 求指点

  2. BillYANG
    2012年12月19日13:57 | #2

    参看在文末新加的后记以及http://blog.redwolf-soft.com/?p=1804 @水弟

  3. 别样年华
    2012年12月26日11:23 | #3

    @水弟
    将GCC替换成4.4.3版本,G++替换成4.6版本就OK了。

订阅评论
  欢迎参与讨论,请在这里发表您的看法、交流您的观点。