现在的位置: 首页 > 综合 > 正文

linux mint13 android使用错误修改记录 implicit declaration of function 这种警告问题的原因及解决方法android 4.0.1源码编译成功后运行emulator提示No command ‘emulator’ found

2014年09月05日 ⁄ 综合 ⁄ 共 10004字 ⁄ 字号 评论关闭

android4.0 在我的115里面,下载,修改 .mp3 为.tar.zg,解压并编译,收集错误如下:

如果有人需要可以留言,留下邮箱。

ubuntu 下编译android源码错误解决记录

Ubuntu12.064Android4.0

第一次make报错:

********************************************************************************************

问题 1、

CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
cc1: error: unrecognized command line option "-mlittle-endian"
cc1: error: unrecognized command line option "-mapcs"
cc1: error: unrecognized command line option "-mno-sched-prolog"
cc1: error: unrecognized command line option "-mabi=apcs-gnu"
kernel/bounds.c:1: error: bad value (armv4t) for -march= switch

kernel/bounds.c:1: error: bad value (arm9tdmi) for -mtune= switch

类似问题 解决办法

make ARCH=arm CROSS_COMPILE='编译器位置'

由于是再pc  x86环境下编译所以修改为:ARCH=x86    CROSS_COMPILE=

没有交叉编译器的话,可以随便下载一个,我们是模拟的仅仅是学习一下所以无所谓了。


********************************************************************************************

问题2、 

CC      kernel/cgroup_freezer.o

  CC      kernel/cpuset.o
kernel/cpuset.c: In function ‘cpuset_can_attach’:
kernel/cpuset.c:1386:18: error: ‘task’ undeclared (first use in this function)
kernel/cpuset.c:1386:18: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [kernel/cpuset.o] Error 1
make: *** [kernel] Error 2

解决办法

kernel/cpuset.c:1380 将task 改成tsk  
即:task -->tsk


********************************************************************************************

问题3、

drivers/hello/hello.c:233:2: error: implicit declaration of function ‘init_MUTEX’

解决方法: 注释掉drivers/hello/hello.c:init_MUTEX(&(dev->sem));


********************************************************************************************

问题4、

used [-Wunused-function]
  CC [M]  drivers/gpio/sch_gpio.o
  CC [M]  drivers/gpio/rdc321x-gpio.o
  CC [M]  drivers/gpio/janz-ttl.o
drivers/gpio/janz-ttl.c: In function ‘ttl_set_value’:
drivers/gpio/janz-ttl.c:107:2: error: implicit declaration of function ‘iowrite16be’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [drivers/gpio/janz-ttl.o] Error 1
make[1]: *** [drivers/gpio] Error 2
make: *** [drivers] Error 2

解决方法:


down voteaccepted

Try including this header

#include<asm/io.h>

If it doesn't work then look at this for all the definitions ofiowrite16be
http://lxr.free-electrons.com/ident?i=iowrite16be

Choose the appropriate header based on your architecture.

EDIT : Generally implicit declaration of function xyz() is a warning. May be in your system its been forced to an error with-Werror-implicit-function-declaration. You can search for
this in your build structure and try to take it off ( Though itsnot a good practice, but anyways you can do it, if you want the work done ) But ifiowrite16be is really missing, then even this method wont help you from the linker's
wrath.

share|improve
this answer


including the header #include<asm/io.h> didn't fix the error, but i will try the remaining headers, thanks for your response. – usama
yaseen
Mar
13 '12 at 13:08

removing -Werror-implicit-function-declaration from the makefile fixed the error, thanks for your continuous help. :) – usama
yaseen
Mar
14 '12 at 12:58

@usamayaseen Glad to hear that :) – Pavan ManjunathMar
14 '12 at 13:02


解决方法:

leo linux-2.6.36-android # grep -r Werror=implicit-function-declaration .  //搜索错误提示
./arch/arm/kernel/asm-offsets.s:@ -Werror=implicit-function-declaration -Wno-format-security
./kernel/bounds.s:@ -Werror=implicit-function-declaration -Wno-format-security
leo linux-2.6.36-android #

修改:1、将-Werror=implicit-function-declaration -Wno-format-security     // 将错误提示删掉,像做手术一样哪里出问题,切哪里,
从/arch/arm/kernel/asm-offsets.s:@ -Werror=implicit-function-declaration -Wno-format-security中删掉

删除位置:@ -Wundef -Wstrict-prototypes -Wno-trigraphs
@ -Werror=implicit-function-declaration -Wno-format-security
@ -Wframe-larger-than=1024 -Wdeclaration-after-statement -Wno-pointer-sign

2、将-Werror=implicit-function-declaration -Wno-format-security
从/kernel/bounds.中删掉
删除位置:@ -Wundef -Wstrict-prototypes -Wno-trigraphs
@ -Werror=implicit-function-declaration -Wno-format-security
@ -Wframe-larger-than=1024 -Wdeclaration-after-statement -Wno-pointer-sign

以上方法都是了,还是不可以,然后找到这个错误是出现在janz-ttl这个模块,由于我们这时第一次编译这个系统,可能用不到这个模块,为了下一步的进展我就在janz-ttl目录里的makefile里面将这个模块屏蔽了。
补充:

implicit declaration of function 这种警告问题的原因及解决方法

1  没有把函数所在的c文件生成.o目标文件
2  在函数所在的c文件中定义了,但是没有在与之相关联的.h文件中声明

这个问题没有解决 换成了x86环境 继续编译


********************************************************************************************

问题5、此错误是在x86环境下编译(即:ARCH=x86
   CROSS_COMPILE=
)出现的错误:

VDSO    arch/x86/vdso/vdso.so.dbg
gcc: error: elf_x86_64: No such file or directory
  OBJCOPY arch/x86/vdso/vdso.so
objcopy: 'arch/x86/vdso/vdso.so.dbg': No such file
make[2]: *** [arch/x86/vdso/vdso.so] Error 1
make[1]: *** [arch/x86/vdso] Error 2
make: *** [arch/x86] Error 2
leo linux-2.6.36-android #


解决方法:
这个问题是由于 gcc 4.6 不再支持 linker-style 架构。讲 arch/x86/vdso/Makefile中,
将以 VDSO_LDFLAGS_vdso.lds 开头所在行的 "-m elf_x86_64" 替换为 "-m64"。 (只修改这一步,就可以了)
将以 VDSO_LDFLAGS_vdso32.lds 开头所在行的 "-m elf_x86" 替换为 "-m32"。


********************************************************************************************

问题6、

drivers/misc/pmem.c:1226:2: warning: (near initialization for ‘debug_fops.open’) [enabled by default]
drivers/misc/pmem.c: In function ‘pmem_setup’:
drivers/misc/pmem.c:1301:60: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cc1: some warnings being treated as errors
make[2]: *** [drivers/misc/pmem.o] Error 1
make[1]: *** [drivers/misc] Error 2
make: *** [drivers] Error 2
leo linux-2.6.36-android #

解决方法:


********************************************************************************************

问题7、

Your display is too small to run Menuconfig

  因工作需要,现在要编译Ubuntu系统的内核。在编译的过程中,遇到“Your display is too small to run Menuconfig”的问题,刚遇到时一阵紧张,怎么又出问题呢?后来,搜索之后一颗悬着的心才算落下。

  首先,看一下详细的错误信息,如下所示:

  Your display is too small to runMenuconfig!
  It must be at least 19 lines by 80 columns.

  其次,看一下解决方案:先把你终端的窗体最大化再执行相同的命令,是不是感觉很奇妙?


********************************************************************************************

问题8、

android 4.0.1源码编译成功后运行emulator提示No command 'emulator' found

1、编辑/etc/environment增加emulator所在目录(增加蓝色字体内容):

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-1.6.0_27/bin:/home/test1/WORKING_DIRECTORY/out/host/linux-x86/bin"
CLASSPATH="/usr/lib/jvm/java-1.6.0_27/lib"
JAVA_HOME="/usr/lib/jvm/java-1.6.0_27"
ANDROID_PRODUCT_OUT="/home/test1/WORKING_DIRECTORY/out/target/product/generic"

注意:修改这个后为使之生效需要logout一下。

另外,android模拟器第一次启动时间超长,需要耐心等待

********************************************************************************************
第9-   是编译android4.0出现错误(android4.0 在我的115里面,下载,修改 .mp3 为.tar.zg,解压并编译编译环境:linux mint13  64位):


问题9、

<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


********************************************************************************************

问题10、

<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 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


********************************************************************************************

问题11、

<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]

<built-in>:0:0: note: this is the location of the previous definition cc1plus: all warnings being treated as errors

make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1


解决方法:这是由于11.10gcc版本过高造成的,可参考这篇文章修改:http://hi.baidu.com/designhouse/blog/item/fec5cdbf8d6a231618d81fc1.html

或者修改build/core/combo/HOST_linux-x86.mk 61行

将 HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0

修改成 HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0


********************************************************************************************

问题12、

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

解决方法:

apt-get install g++-4.4-multilib


********************************************************************************************

问题13、


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 exit status
make: 
*** [out/host/linux-x86/obj/lib/libGLES_CM_translator.so] Error 1


解决方法: sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so 


********************************************************************************************

问题14、

  CC [M]  drivers/gpio/wm8350-gpiolib.o
  CC [M]  drivers/gpio/wm8994-gpio.o
drivers/gpio/wm8994-gpio.c:84: warning: 'wm8994_gpio_to_irq' defined but not used
  CC [M]  drivers/gpio/sch_gpio.o
  CC [M]  drivers/gpio/rdc321x-gpio.o
  CC [M]  drivers/gpio/janz-ttl.o
drivers/gpio/janz-ttl.c: In function 'ttl_set_value':
drivers/gpio/janz-ttl.c:107: error: implicit declaration of function 'iowrite16be'
make[2]: *** [drivers/gpio/janz-ttl.o] Error 1
make[1]: *** [drivers/gpio] Error 2
make: *** [drivers] Error 2
leo common # make menuconfig

由于升级或者其他原因会出现 implicit declaration of function错误,前面也提过一些原因。但对于我们没有用到模块可以直接删掉。

解决方法:

drivers/gpio/中的makefile和kconfig中屏蔽wm8994-gpio.o

或者使用make menuconfig 菜单 删除。

********************************************************************************************


问题15、

编译内核出现

In file included from fs/coda/psdev.c:45:
include/linux/coda.h:248: error: expected specifier-qualifier-list before 'u_quad_t'错误。

解决方法:

在内核配置中有如下

File Systems ->
    -> Network File Systems ->
           ->  <M> Coda file system support (advanced network fs)

选项,取消选择Coda file system support,重新编译。


根据老罗的博客编译好了android环境,可以运气模拟器了,

以下是再模拟器下的错误:


16、

执行 emulator 提示 emulator: WARNING: system partition size adjusted to match image file (166 MB > 66 MB)
解决方法:

emulator -partition-size 1024 -kernel ./kernel/common/arch/arm/boot/zImage &

抱歉!评论已关闭.