Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to build Android from sources on Ubuntu 13.04, yet there are numerous issues:

  1. Setting up the environment issues (wrong tool chains)
  2. Compilation/Build errors
share|improve this question
    
It's OK now, but you could edit your original question instead of deleting. I think I lose my vote. –  Danatela Jul 25 '13 at 10:10
    
I deleted the post in order to avoid duplication. I'm somewhat new to StackExchange. What does "losing your vote" mean? Is there anything that I can do to fix it? –  levengli Jul 25 '13 at 10:11
    
Ah, don't care about it. It doesn't hurt. Just wish to tell you about your abilities. Anyway, you somehow reached 200 points on StackOverflow, so you probably must know how StackExchange works and what is voting. And thanks for your wish to fixing it :) –  Danatela Jul 25 '13 at 10:18
    
I know how it works to that extent. I don't understand the concept of losing a vote. Can't you re-vote? –  levengli Jul 25 '13 at 10:20
    
But.. thank you for the suggestion to move to Q&A. –  levengli Jul 25 '13 at 10:22
show 1 more comment

1 Answer

up vote 3 down vote accepted

After having spent an entire day setting up the environment and building Android from its sources; I want to share the useful information that I found floating around.

My system is an Asus S56C (i7-3537U) with 4GB RAM. I downloaded the master branch, which at this time is android-4.0.1_r1

The first thing to do, is to set up the environment. This is clearly explained in source.android.com. There are three things to pay attention to:

  1. While source.android.com gives the option of using make 3.81 - 3.82, the build will fail if you don't have 3.81 set. Therefore, this is the one you should use.
  2. I initially installed openjdk-6-jre, however this was the wrong version of the jre. Following this link, I installed oracle-java6-installer instead
  3. There is a typo on the section about configuring the ccache. It should read prebuilt/misc/linux-x86/ccache/ccache -M 50G

The following is a list of links form which I derived the changes to the source/make files that'll follow.

  1. [GUIDE] Building CyanogenMod 9 from Source with openSuSE 12.1.
  2. Fix for Dalvik compile error on CyanogenMod 9
  3. Debian Bug report logs
  4. lenario bug report
  5. Building Android 4.0.4 (Master branch) on Arch Linux 64-bit

As a result, the following changes were made:

  1. On line 31 of frameworks/base/tools/aapt/Android.mk, add -fpermissive

    LOCAL_CFLAGS += -Wno-format-y2k -fpermissive
    
  2. On line 64 of frameworks/base/libs/utils/Android.mk, add -fpermissive

    LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive
    
  3. On line 183 of frameworks/base/libs/rs/Android.mk, add -fpermissive

    LOCAL_CFLAGS += -Werror -Wall -Wno-unused-parameter -Wno-unused-variable -fpermissive
    
  4. On line 22 of frameworks/compile/slang/Android.mk, remove -Werror

    local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter
    
  5. On line 125 of frameworks/compile/linkloader/Android.mk, replace LOCAL_LDFLAGS with LOCAL_LDLIBS

    LOCAL_LDLIBS := \
      -lpthread \
      -ldl
    
  6. On line 94 of external/oprofile/libpp/format_output.h, remove the specifier mutable

  7. on line 41 of external/gtest/include/gtest/internal/gtest-param-util.h, after #include <vector>, add #include <stddef.h>

  8. On lines 52 and 71 of external/gtest/src/Android.mk, add -fpermissive

    LOCAL_CFLAGS += -O0 -fpermissive 
    LOCAL_CFLAGS += -O0 -fpermissive
    
  9. On line 25 of development/tools/emulator/opengl/Android.mk, add -fpermissive

    EMUGL_COMMON_CFLAGS := -DWITH_GLES2 -fpermissive
    
  10. After line 7 of development/tools/emulator/opengl/host/renderer/Android.mk, add new line

    LOCAL_LDLIBS += -lX11
    

I hope that this makes your life easier when building Android.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.