当前位置: 代码迷 >> Android >> [odroid-pc] ubuntu12.04 64bit Android4.0.3 源代码编译报错及解决方法
  详细解决方案

[odroid-pc] ubuntu12.04 64bit Android4.0.3 源代码编译报错及解决方法

热度:599   发布时间:2016-04-27 23:41:58.0
[odroid-pc] ubuntu12.04 64bit Android4.0.3 源代码编译报错及解决办法
第一个错误:
        host Executable: cmu2nuance (out/host/linux-x86/obj/EXECUTABLES/cmu2nuance_intermediates/cmu2nuance)
        /usr/bin/ld: cannot find -lncurses
        collect2: ld returned 1 exit status
        make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1
        make: *** Waiting for unfinished jobs....
        host Executable: coverage (out/host/linux-x86/obj/EXECUTABLES/coverage_intermediates/coverage)

        安装libncurses5-dev:i386可以解决

        sudo apt-get install libncurses5-dev:i386

       编译kernel源码时出现如下错误:

        HOSTLD  scripts/kconfig/mconf
        scripts/kconfig/mconf.o: In function `show_help':
        mconf.c:(.text+0x811): undefined reference to `stdscr'
        scripts/kconfig/mconf.o: In function `main':
        mconf.c:(.text+0x1286): undefined reference to `initscr'
        mconf.c:(.text+0x128d): undefined reference to `stdscr'
        scripts/kconfig/lxdialog/checklist.o: In function `print_arrows':
        checklist.c:(.text+0x41): undefined reference to `wmove'
        checklist.c:(.text+0x61): undefined reference to `acs_map'

        安装libncurses5-dev可以解决

        sudo apt-get install libncurses5-dev

第二个错误:
      cc1plus: all warnings being treated as errors
    make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] 错误 1
    解决:通过SMBA服务器进入并修改源码目录下/build/core/combo/HOST_linux-x86.mk文件:

    将以下语句
    HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
    修改为
    HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

第三个错误:
    make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach
    在工程根目录下,打开下面的makefile文件:
    源码目录 frameworks/compile/slang/Android.mk
    .在打开的makefile文件中按照下面更改:
    #local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
    local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter

    原因很简单 把警告当作error处理,所以此处要修改

第四个错误:
    make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1

    solutions:external/mesa3d/src/glsl/linker.cpp
    +#include <stddef.h>
    #include <cstdlib>
    #include <cstdio>


第五个错误:
    In file included from external/oprofile/libpp/arrange_profiles.cpp:24:0:
    external/oprofile/libpp/format_output.h:94:22: 错误: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive]
    make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o] 错误 1

    修改external/oprofile/libpp/format_output.h:94行
        mutable counts_t & counts;
    改为:

        counts_t & counts;

第六个错误:

    target arm C: libc <= bionic/libc/bionic/pthread.c
    arm-linux-androideabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
    make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libc_intermediates/bionic/pthread.o] Error 1

    gcc -print-prog-name=cc1   

    执行命令:export PATH=path/to/cc1:$PATH    


后面的错误及解决方法:参照http://www.cnblogs.com/xingfuzzhd/archive/2012/09/05/2672000.html

编译成功后:

[email protected]:~# vim ~/.bashrc


在文件中适当位置添加
#java 程序开发/运行的一些环境变量
export ANDROID_PRODUCT_OUT=~/out/target/product/generic

ANDROID_PRODUCT_OUT_BIN=~/out/host/linux-x86/bin

export PATH=${PATH}:${ANDROID_PRODUCT_OUT_BIN}:${ANDROID_PRODUCT_OUT};
#以上为songjiachen添加20140303


[email protected]:~# source ~/.bashrc
[email protected]:~# cd ~/out/target/product/generic
[email protected]:~/out/target/product/generic# emulator -system system.img -data userdata.img -ramdisk ramdisk.img

emulator: WARNING: system partition size adjusted to match image file (166 MB > 66 MB)

此时模拟器已经成功运行

Could not configure '/dev/hpet' to have a 1024Hz timer. This is not a fatal
error, but for better emulation accuracy type:
'echo 1024 > /proc/sys/dev/hpet/max-user-freq' as root.

[email protected]:~/out/target/product/generic# emulator -system system.img -data userdata.img -ramdisk ramdisk.img -partition-size 1024

此时模拟器已经成功运行 添加 -partition-size 1024为使=warning消除

直接输入emulator也可

版权声明:本文为博主原创文章,未经博主允许不得转载。

  相关解决方案