Building android source code

前端 未结 4 493
不思量自难忘°
不思量自难忘° 2021-01-16 12:53

I downloaded android source from source.android.com and followed the instruction to setup build environment on MAC OS X, Everything went fine except when i run make it gives

相关标签:
4条回答
  • 2021-01-16 13:10

    To build ICS on newer GCC versions, you must apply these patches:

    https://groups.google.com/forum/#!msg/android-building/2EwtWQTqjdI/fbZlzXErscwJ

    0 讨论(0)
  • 2021-01-16 13:15

    Just to expand on Pete's answer, in case anyone really wants to know:

    The indexOfKey is defined in DefaultKeyVector's parent class, KeyedVector. For class templates, a function call is resolved during compile-time, not during run-time. The error happens because at the point indexOfKey is called, the compiler wouldn't know where that template function might be located. Here is how the base and derived classes look like:

    template <typename KEY, typename VALUE>
    class KeyedVector
    {
    ...
        ssize_t indexOfKey(const KEY& key) const;
    ...
    
    
    template <typename KEY, typename VALUE>
    class DefaultKeyedVector : public KeyedVector<KEY, VALUE>
    {
    ...
    

    And the offending call:

    template<typename KEY, typename VALUE> inline
    const VALUE& DefaultKeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
        ssize_t i = indexOfKey(key);
    ...
    

    Most likely, using the older MacOS SDK compiler (or other compilers) works because it was probably just guessing the function exists in some base class, instead of failing. However, that is not standard behavior.

    More info from this clang entry, and from the C++ FAQ.

    0 讨论(0)
  • 2021-01-16 13:17

    I faced this problem several times when building Browser for Android 4.0.3 with make -j Browser on MAC OS X 10.8.4. I dont have any problem with Android 4.2.1. So my solution is

    make CC=gcc CXX=g++ -j Browser

    Hope it helps

    0 讨论(0)
  • 2021-01-16 13:30

    I finally figured out the problem. There's an error in the sourcecode of frameworks/base/include/utils/KeyedVector.h:193

    Some of the member functions require Scope resolution operator "this->" to build the android source on MAC OS X Lion with xcode 4.3.x and on gcc version 4.9.2 (Debian 4.9.2-10). Without scope resolution operator compiler will not be able to identify the existence of the function.

    Open frameworks/base/include/utils/KeyedVector.h

    Change the line 193 from:

    ssize_t i = indexOfKey(key);
    

    to

    ssize_t i = this->indexOfKey(key);
    

    and Android 4.0.1 compiles.

    0 讨论(0)
提交回复
热议问题