在ubuntu 10.04 32位下编译 android 系统问题总结

源码获取:

http://source.android.com/source/building.html

 

Ubuntu镜像下载:

http://mirrors.163.com/

 

 

  问题一

       Error occurred during initialization of VM
       Could not reserve enough space for object heap
       Could not create the Java virtual machine.
       make: *** [out/target/common/obj/JAVA_LIBRARIES/core_intermediates/noproguard.classes-with-local.dex] Error 1

   解决方法:
        进入 build/core/definitions.mk 
        $(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx900M)
         因为运行JVM需要较大的内存,需要修改JXmx的值,因为我的内存只有1G 所以修改成900m,发现还是可以跑得起的,只是比较慢。必须大于512m才可以···
        

问题二 

host C: emulator64-arm <= external/qemu/audio/audio.c
ERROR: prebuilts/tools/gcc-sdk/http://www.cnblogs.com/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.      6/bin/x86_64-linux-gcc only run on 64-bit linux
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator64-arm_intermediates/audio      /audio.o] 错误 1


解决方法:

 
external/qemu/Makefile.target
 
252 line,
    LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
换成
 
    ifneq ($(BUILD_HOST_64bit),)
    LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
    else
      ifneq ($(HOST_ARCH),x86_64)
    LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m32
      endif
    endif
 
 
external/qemu/Makefile.target
 
446 line,
        LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) -m64
        LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
换成
 
    ifneq ($(BUILD_HOST_64bit),)
        LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) -m64
        LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
    else
      ifneq ($(HOST_ARCH),x86_64)
        LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) -m32
        LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m32
      endif
    endif
 
 
external/qemu/Makefile.common
 
149 line,
    LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
换成
 
    ifneq ($(BUILD_HOST_64bit),)
    LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
    else
      ifneq ($(HOST_ARCH),x86_64)
    LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m32
      endif
    endif
 
301 line,
        LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
换成
 
    ifneq ($(BUILD_HOST_64bit),)
        LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
    else
      ifneq ($(HOST_ARCH),x86_64)
        LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m32
      endif
    endif
 
641 line,
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m64
换成
 
    ifneq ($(BUILD_HOST_64bit),)
        LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m64
    else
      ifneq ($(HOST_ARCH),x86_64)
        LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m32
      endif
    endif
 
730 line,
    LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
换成
 
    ifneq ($(BUILD_HOST_64bit),)
    LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
    else
      ifneq ($(HOST_ARCH),x86_64)
    LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m32
      endif
    endif

参考网址:http://www.eoeandroid.com/home.php?mod=space&uid=23065&do=blog&id=2778

问题三:

/usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h: 没有那个文件或目录
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/lib64EGL_translator_intermediates/EglX11Api.o] 错误 1

解决方法:

sudo apt-get install lib64z1-dev libc6-dev-amd64 g++-multilib lib64stdc++6


未解决问题:

host Executable: emulator64-arm (out/host/linux-x86/obj/EXECUTABLES/emulator64-arm_intermediates/emulator64-arm)
out/host/linux-x86/obj/STATIC_LIBRARIES/lib64SDL_intermediates/lib64SDL.a: could not read symbols: File format not recognized
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator64-arm_intermediates/emulator64-arm] 错误 1

终极解决方法,完全按照官网的方法,把系统也换成64位的,编译成功!!!!

下载源码的时候 repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
记得-b 指定你的版本,像我要下载2.3.1的,就改为
repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.1_r1

posted on 2012-07-05 11:55  w——杰  阅读(2061)  评论(0编辑  收藏  举报

导航