linux内核编译问题——undefined reference to `error'

内核版本 2.6.33.9

make zImage时出现如下错误:


LD      arch/arm/boot/compressed/vmlinux
arch/arm/boot/compressed/decompress.o(.text+0x23c0): In function `do_decompress':
arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:67: undefined reference to `error'
arch/arm/boot/compressed/decompress.o(.text+0x23e0):arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:73: undefined reference to `error'
arch/arm/boot/compressed/decompress.o(.text+0x2404):arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:80: undefined reference to `error'
arch/arm/boot/compressed/decompress.o(.text+0x2468):arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:95: undefined reference to `error'
arch/arm/boot/compressed/decompress.o(.text+0x2548):arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:152: undefined reference to `error'
/usr/src/rtllinux-3.2-rc1/linux/arch/arm/boot/compressed/Makefile:111: recipe for target 'arch/arm/boot/compressed/vmlinux' failed
make[2]: *** [arch/arm/boot/compressed/vmlinux] Error 1
/usr/src/rtllinux-3.2-rc1/linux/arch/arm/boot/Makefile:54: recipe for target 'arch/arm/boot/compressed/vmlinux' failed
make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2
/usr/src/rtllinux-3.2-rc1/linux/arch/arm/Makefile:252: recipe for target 'zImage' failed
make: *** [zImage] Error 2

根据提示中目录 ./arch/arm/boot/compressed/decompress.o找到decompress.c文件,查看源码,发现do_decompress函数并无问题。

void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
{
        decompress(input, len, NULL, NULL, output, NULL, error); }

然后查看源码中所引用目录及文件,发现./lib/decompress_inflate.c 找到其所在目录,打开文件,发现末尾行对decompress 函数的定义为 #define decompress gunzip

再在当前文件下找到 gunzip 的定义,

STATIC int INIT gunzip(unsigned char *buf, int len,
                       int(*fill)(void*, unsigned int),
                       int(*flush)(void*, unsigned int),
                       unsigned char *out_buf,
                       int *pos,
                       void(*error_fn)(char *x))

发现所用为error_fn 而非 error,于是改回error后发现仍然出现错误,

参考http://blog.csdn.net/einsteinz/article/details/5757607 文章中所提,将decompress.c 中所有error 改为error_fn 发现可以继续编译。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值