我使用的是ubuntu10.10 配置了如下环境
sudo apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev genromfs
很可能个别软件包会安装失败,比如sun-java6-jdk
出现的错误和解决方法我列出在下面:
1
/bin/bash: bison: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127
解决:sudo apt-get install bison
2
/bin/bash: g++: command not found
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/pseudolocalize.o] Error 127
解决: sudo apt-get install build-essential
3
/usr/include/gnu/stubs.h:9: fatal error: gnu/stubs-64.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libclearsilver-jni_intermediates/j_neo_util.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from /usr/include/features.h:387,
from /usr/include/stdio.h:28,
from external/clearsilver/util/neo_err.c:14:
/usr/include/gnu/stubs.h:9: fatal error: gnu/stubs-64.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_util_intermediates/neo_err.o] Error 1
解决:sudo apt-get install lib64z1-dev libc6-dev-amd64 g++-multilib lib64stdc++6
4
/bin/bash: flex: command not found
touch out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.hpp
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127
make: *** Waiting for unfinished jobs....
echo '#ifndef 'aidl_language_y_h > out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.h
echo '#define 'aidl_language_y_h >> out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.h
cat out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.hpp >> out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.h
echo '#endif' >> out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.h
rm -f out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.hpp
build/tools/merge-event-log-tags.py:29: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
解决:sudo apt-get install flex
5
external/qemu/android/skin/argb.h:543: warning: ‘scale_up_quick_4x4’ defined but not used
In file included from external/qemu/android/skin/window.c:19:
prebuilt/linux-x86/sdl/include/SDL/SDL_syswm.h:55: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/emulator-ui_intermediates/android/skin/window.o] Error 1
make: *** Waiting for unfinished jobs....
解决:sudo apt-get install libx11-dev
6
out/host/linux-x86/obj/STATIC_LIBRARIES/libelfcopy_intermediates/libelfcopy.a
/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....
解决:sudo apt-get install libncurses5-dev
7
sh: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 96.
make: *** [out/target/product/smdkv210/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h] Error 25
make: *** Deleting file `out/target/product/smdkv210/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h'
make: *** Waiting for unfinished jobs....
sh: gperf: not found
calling gperf failed: 32512 at makevalues.pl line 89.
make: *** [out/target/product/smdkv210/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSValueKeywords.h] Error 25
make: *** Deleting file `out/target/product/smdkv210/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSValueKeywords.h'
解决:sudo apt-get install gperf
8
Could not load ‘clearsilver-jni’
java.library.path = out/host/linux-x86/lib
make: *** [out/target/common/docs/api-stubs-timestamp] Error 45
make: *** Waiting for unfinished jobs….
Could not load ‘clearsilver-jni’
java.library.path = out/host/linux-x86/lib
make: *** [out/target/common/docs/doc-comment-check-timestamp] Error 45
解决:
解决办法一:使用jdk1.5
解决办法二:把
external/clearsilver/cgi/Android.mk,
external/clearsilver/java-jni/Android.mk
external/clearsilver/util/Android.mk
external/clearsilver/cs/Android.mk
这四个makefile中的以下红色部分注释掉
# This forces a 64-bit build for Java6
#LOCAL_CFLAGS += -m32
#LOCAL_LDFLAGS += -m32
#LOCAL_CFLAGS += -m64
#LOCAL_LDFLAGS += -m64
然后再makeclean一下阿,再make即可
解决办法三:
执行以下这行指令,这会将clearsilver 在 Makefile里的LOCAL_LDFLAGS += -m32 和 LOCAL_CFLAGS += -m32 由原本的 -m32设定为-m64。
find ./external/clearsilver/ -name ’*.mk’ -exec grep -l ’m32’ {} \; -exec sed -i ’s/m32/m64/g’ {} \;
而使用這个方法,若您将这源码拿到 32 位元的 Ubuntu Linux 环境编译时,则记得反过来将 -m64 修改为 -m32。
或者
执行以下指令, 这会将clearsilver 在 Makefile里的LOCAL_LDFLAGS += -m32 和 LOCAL_CFLAGS += -m32 直接註解掉。
find ./external/clearsilver/ -name ’*.mk’ -exec grep -l ’m32’ {} \; -exec sed -i ’s/LOCAL_CFLAGS\ +=\ -m32/#\ LOCAL_CFLAGS\ +=\ -m32/g’ {} \;
find ./external/clearsilver/ -name ’*.mk’ -exec grep -l ’m32’ {} \; -exec sed -i ’s/LOCAL_LDFLAGS\ +=\ -m32/#\ LOCAL_LDFLAGS\ +=\ -m32/g’ {} \;
採用這個方法時,您的原始碼不論在 32 位元或 64 位元的 Ubuntu Linux 编译时,都將不再遇上這個問題。