在android4.0.几的版本上会出现这个问题,在线求解答

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在android4.0.几的版本上会出现这个问题,在线求解答相关的知识,希望对你有一定的参考价值。

  在Ubuntu12.04(64位)编译android4.0源码时,遇到各种各样的问题。不是缺这个,就是少那个。现把这些问题和解决方法罗列出来(最新统计)。

  错误(1):
  /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
  make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] 错误 1

  解决:
  sudo apt-get install libc6-dev-i386

  错误(2):
  make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp] error 1

  解决:
  sudo apt-get install g++-4.4-multilib

  错误(3):
  external/clearsilver/cgi/cgi.c:22: fatal error: zlib.h: No such file or directory
  compilation terminated.
  make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libneo_cgi_intermediates/cgi.o] Error 1

  解决:
  sudo apt-get install zlib1g-dev

  错误(4):
  /usr/bin/ld: cannot find -lz
  collect2: ld returned 1 exit status
  make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1

  解决:
  sudo apt-get install lib32z1-dev

  错误(5):
  bison -d -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
  /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

  错误(6):
  Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
  /bin/bash: flex: command not found
  make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127

  解决:
  sudo apt-get install flex

  错误(7):
  /usr/bin/ld: cannot find -lncurses
  collect2: ld returned 1 exit status
  make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1

  解决:
  sudo apt-get install lib32ncurses5-dev

  错误(8):
  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/EXECUTABLES/emulator_intermediates/android/main-common.o] Error 1

  解决:
  sudo apt-get install libx11-dev

  错误(9):
  sh: gperf: not found
  calling gperf failed: 32512 at ./makeprop.pl line 96.
  make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h] Error 25
  make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/WebCore/css/CSSPropertyNames.h\'

  解决:
  sudo apt-get install gperf

  错误(10):
  build/core/java.mk:9: *** bin: Target java module does not define any source or resource files. Stop.

  解决:
  删除源码根目录下的bin文件夹,这个文件夹是导入eclipse时创建的。

  错误(11):
  /usr/bin/ld: cannot find -lX11
  collect2: ld returned 1 exit status
  make: *** [out/host/linux-x86/obj/lib/libOpenglRender.so] 错误 1

  解决/usr/bin/ld: Cannot Find -lxxx错误
  /usr/bin/ld: cannot find -lltdl
  collect2: ld returned 1 exit status

  解决办法是(方法一):

  [root@9-104 php-5.2.8]# updatedb
  [root@9-104 php-5.2.8]# locate libltdl //提示/usr/bin/ld: cannot find -lxxx ,查找时候前面加lib:libxxx 住一 第一个l去掉
  /usr/lib64/libltdl.so.3
  /usr/lib64/libltdl.so.3.1.4
  /usr/share/libtool/libltdl
  /usr/share/libtool/libltdl/COPYING.LIB
  /usr/share/libtool/libltdl/Makefile.am
  /usr/share/libtool/libltdl/Makefile.in
  /usr/share/libtool/libltdl/README
  /usr/share/libtool/libltdl/acinclude.m4
  /usr/share/libtool/libltdl/aclocal.m4
  /usr/share/libtool/libltdl/config-h.in
  /usr/share/libtool/libltdl/config.guess
  ...
  注意拉:
  [root@9-104 php-5.2.8]# ln -s /usr/lib64/libltdl.so.3 /usr/lib64/libltdl.so
  原理:给查找到的libxxx文件做软链接
  ln -s /usr/lib64/libxxx.so.X(X代表数字) /usr/lib64/lxxx.so

  解决办法是(方法二):
  apt-get install libxx-dev(如:apt-get install libltdl-dev)
  /usr/bin/ld: cannot find -lXt 这种情况一般就是库找不到,有可能你没安装,有可能你安装了但是路径不对。你可以先用 #locate libxt查看下,时候跟这有光的库,没有就安装。

  以上两种办法若再出现如下错误:

  <built-in>:0:0: note: this is the location of the previous definition
  host StaticLib: libOpenglCodecCommon (out/host/linux-x86/obj/STATIC_LIBRARIES/li
  bOpenglCodecCommon_intermediates/libOpenglCodecCommon.a)
  host SharedLib: libOpenglRender (out/host/linux-x86/obj/lib/libOpenglRender.so)
  /usr/bin/ld: cannot find -lX11
  collect2: ld returned 1 exit status
  make: *** [out/host/linux-x86/obj/lib/libOpenglRender.so] Error 1

  解决方法(办法三亲测一定可行):$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so

  错误(12):
  development/tools/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp:22: fatal error: GL/glx.h: No such file or directory compilation terminated.
  make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libGLcommon_intermediates/GLDispatch.o] Error 1

  解决方法:sudo apt-get install libgl1-mesa-dev

  错误(13):
  host SharedLib: lib64EGL_translator (out/host/linux-x86/obj/lib/lib64EGL_translator.so)
  /usr/bin/ld: cannot find -lGL
  collect2: ld returned 1 exit status
  make: *** [out/host/linux-x86/obj/lib/lib64EGL_translator.so] Error 1
  make: *** Waiting for unfinished jobs....
  
  解决方法 :
  
  sudo apt-get install libglu1-mesa-dev

  错误(14):
  host StaticLib: libGLcommon (out/host/linux-x86/obj/STATIC_LIBRARIES/libGLcommon
  _intermediates/libGLcommon.a)
  host SharedLib: libGLES_CM_translator (out/host/linux-x86/obj/lib/libGLES_CM_tra
  nslator.so)
  /usr/bin/ld: cannot find -lGL
  collect2: ld returned 1 exit status
  make: *** [out/host/linux-x86/obj/lib/libGLES_CM_translator.so] Error 1

  由于libGL.so系统默认没有进行库路径下的链接,还需要手动链接一下
  解决方法: sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
  解决方法: sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/mesa/libGL.so

  在网上搜到上面的解决方法,可是按照上述方法做了,问题依旧。经过多方实验,才发现问题所在。通过apt-get install的库不是libGL.so.1.2了。而是libGL.so.1.2.0.

  错误(15):
  make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1

  后来发现了,原来是Ubuntu11.10里的gcc和g++版本太高了,于是执行下面的操作:

  sudo apt-get install gcc-4.4

  sudo apt-get install g++-4.4

  sudo rm -rf /usr/bin/gcc /usr/bin/g++

  sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc

  sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++

  把默认的4.6版本换为了4.4,继续编译源码,又出现了另一个错误,大致提示为:

  g++ selected multilib \'32\' not installed

  继续奋战吧,安装相应的工具吧:sudo apt-get install g++-4.4-multilib,现在正在make -j8(开启多线程编译(不推荐),可能有时候会出现问题,最好是直接make)

  2.解决各种依赖问题
  首先安装一些库
  ?View Code BASH

  1 sudo apt-get install gnupg flex bison gperf libsdl1.2-dev libesd0-dev
  2 sudo apt-get install libwxgtk2.6-dev squashfs-tools build-essential
  3 sudo apt-get install zlib1g-dev pngcrush schedtool ia32-libs libncurses5-dev

  这些库可能不全,如果出现问题,再google一下吧

  2.error: “_FORTIFY_SOURCE” redefined [-Werror]
  这个问题,据说与gcc版本有关,4.4版不会出现。
  后来在google code 上找到了使用gcc 4.6编译的方法
  修改build/core/combo/HOST_linux-x86.mk 文件 line 61

  ?View Code BASH

  1 -HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
  2 +HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

  这是CyanogenMod打上的补丁

  3.No rule to make target ‘out/target/product/generic/obj/lib/libcamera.so’
  修改 /home/Android-2.3.4/frameworks/base/services/camera/libcameraservice/Android.mk,USE_CAMERA_STUB:=false ->ture
  ?View Code BASH
  
  1 LOCAL_PATH:= $(call my-dir)
  2
  3 # Set USE_CAMERA_STUB if you don\'t want to use the hardware camera.
  4
  5 # force these builds to use camera stub only
  6 ifneq ($(filter sooner generic sim,$(TARGET_DEVICE)),)
  7 USE_CAMERA_STUB:=true
  8 endif
  9
  10 #########CHANGE THIS LINE############
  11 USE_CAMERA_STUB:=true
  12
  13 ifeq ($(USE_CAMERA_STUB),)
  14 USE_CAMERA_STUB:=false
  15 endif
参考技术A 看不见 参考技术B 什么问题呢? 参考技术C 什么问题

以上是关于在android4.0.几的版本上会出现这个问题,在线求解答的主要内容,如果未能解决你的问题,请参考以下文章

android4.0.4是啥意思?

什么是Android4.0或IOS8.0及以上版本智能手机?

Android4.0.4有没有遇到界面变坏开发问题,在开机出现锁屏界面后,并未解锁,过一会儿界面会自动变坏?

android4.0是啥意思

Android4.0 Design之设计规范的十大革新

如何在 Pyspark 2.1 中使用窗口函数来计算星期几的出现次数