Ubuntu14.04编译Allwinner lichee 两个出错解决方法

本文详细介绍了如何解决在使用host-m4-1.4.15、host-autoconf-2.65及host-makedevs进行编译时遇到的三个不同错误。对于host-m4-1.4.15中的'sgets'未声明错误,提供了修改stdio.h文件的方法;对于host-autoconf-2.65中的使用宏顺序错误,给出了解决方案并附上了补丁文件;对于host-makedevs中的未使用的变量警告,简单地修改了代码实现解决问题。本文旨在帮助开发者快速定位并解决这些问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://blog.youkuaiyun.com/laohuang1122/article/details/44098291

注:已验证通过


1.host-m4-1.4.15

In file includedfrom clean-temp.h:22:0,

from clean-temp.c:23:

./stdio.h:456:1:error: 'gets' undeclared here (not in a function)

_GL_WARN_ON_USE(gets, "gets is a security hole - use fgets instead");

解决方法:

参考链接:

http://www.civilnet.cn/talk/browse.php?topicno=78555,2楼.

找到:host-m4-1.4.15/lib/stdio.h,然后对stdio.h文件做出如下改动,必要时连同stdio.in.h一起修改:


 
 
[plain] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. <span style="font-family:Arial;font-size:12px;"># Begin patch  
  2. === modified file 'grub-core/gnulib/stdio.in.h'  
  3. --- grub-core/gnulib/stdio.in.h 2010-09-20 10:35:33 +0000  
  4. +++ grub-core/gnulib/stdio.in.h 2012-07-04 15:18:15 +0000  
  5. @@ -140,8 +140,10 @@  
  6.  /* It is very rare that the developer ever has full control of stdin,  
  7.     so any use of gets warrants an unconditional warning.  Assume it is  
  8.     always declared, since it is required by C89.  */  
  9. +#if defined gets  
  10.  #undef gets  
  11.  _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");  
  12. +#endif  



2.host-autoconf-2.65

conftest.c:14625:must be after `@defmac' to use `@defmacx'

make[3]: ***[autoconf.info] Error 1

make[3]: Leavingdirectory`//opt/Android/a23androidSRC/lichee/out/linux/common/buildroot/build/host-autoconf-2.65/doc'

make[2]: ***[install-recursive] Error 1

make[2]: Leavingdirectory`/opt/Android/a23androidSRC/lichee/out/linux/common/buildroot/build/host-autoconf-2.65'

make[1]: ***[install] Error 2

make[1]: Leavingdirectory`/opt/Android/a23androidSRC/lichee/out/linux/common/buildroot/build/host-autoconf-2.65'

make: ***[/opt/Android/a23androidSRC/lichee/out/linux/common/buildroot/build/host-autoconf-2.65/.stamp_host_installed]Error 2

解决方法如下:

参考链接:

http://gnu-autoconf.7623.n7.nabble.com/compile-error-conftest-c-14625-must-be-after-defmac-to-use-defmacx-td18843.html

2楼有个补丁文件:

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. --- autoconf-2.65/doc/autoconf.texi 2009-11-05 10:42:15.000000000 +0800  
  2. +++ autoconf-2.65/doc/autoconf.texi.new 2013-05-28 05:41:09.243770263 +0800  
  3. @@ -15,7 +15,7 @@  
  4.  @c The ARG is an optional argument.  To be used for macro arguments in  
  5.  @c their documentation (@defmac).  
  6.  @macro ovar{varname}  
  7. -@r{[}@var{\varname\}@r{]}@c  
  8. +@r{[}@var{\varname\}@r{]}  
  9.  @end macro  
  10.    
  11.  @c @dvar(ARG, DEFAULT)  
  12. @@ -23,7 +23,7 @@  
  13.  @c The ARG is an optional argument, defaulting to DEFAULT.  To be used  
  14.  @c for macro arguments in their documentation (@defmac).  
  15.  @macro dvar{varname, default}  
  16. -@r{[}@var{\varname\} = @samp{\default\}@r{]}@c  
  17. +@r{[}@var{\varname\} = @samp{\default\}@r{]}  
  18.  @end macro  
  19.    
  20.  @c Handling the indexes with Texinfo yields several different problems.  

根据这个补丁文件修改即可,直接修改源代码包,下次编译就不会再提示这个错误了。

3.host-makedevs

/opt/Android/a23androidSRC/lichee/out/linux/common/buildroot/build/host-makedevs/makedevs.c:374:6: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]
  int ret = EXIT_SUCCESS;
      ^
cc1: all warnings being treated as errors

直接修改makedevs.c文件:

最后一行,return 0; 

修改为:return ret;

源代码位置:./buildroot/package/makedevs/makedevs.c


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值