uClibc库的交叉编译

在项目中使用外部SDK集成的uClibc库中的system函数时遇到了问题,想要调试一下,所以从uClibc官网下载了uClibc的最新版本0.9.33.2。交叉编译基于该版本进行,工具链是arm-hisiv100nptl-linux-。

第一步,选择系统平台

第二步,指定目标架构的特性和选项,进去选择和设定

这里最重要的是设置KERNEL_HEADERS的值:它不是linux内核中的include路径,而是交叉工具链中的include路径。

第三步,设置工具链和调试选项

进去设置交叉工具链:

这是交叉编译最关键的三步,设置好后就可以编译得到uClibc的库了。至于特性裁剪,需要因地制宜,这里就不讨论了。

问题说明

第二步中KERNEL_HEADERS选项的设置很重要,如果设置成linux源码树中的include路径,将编译出错,找不到头文件:


lzh@ubuntu:/mnt/uclibc/uClibc-0.9.33.2$ make
  GEN include/bits/uClibc_config.h
  CC libpthread/nptl/sysdeps/unix/sysv/linux/gen_lowlevelbarrier.s
  GEN libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.h
  CC libpthread/nptl/sysdeps/unix/sysv/linux/gen_lowlevelcond.s
  GEN libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelcond.h
  CC libpthread/nptl/sysdeps/unix/sysv/linux/gen_lowlevelrobustlock.s
In file included from ./include/errno.h:36,
                 from ./include/bits/syscalls.h:31,
                 from ./include/sys/syscall.h:34,
                 from ./libpthread/nptl/pthreadP.h:26,
                 from libpthread/nptl/sysdeps/unix/sysv/linux/gen_lowlevelrobustlock.c:2:
./include/bits/errno.h:25: fatal error: linux/errno.h: No such file or directory
compilation terminated.
make: *** [libpthread/nptl/sysdeps/unix/sysv/linux/gen_lowlevelrobustlock.s] Error 1

lzh@ubuntu:/mnt/uclibc/uClibc-0.9.33.2$ make
  MKDIR include/bits
  GEN include/bits/uClibc_config.h
  LN include/semaphore.h
  LN include/pthread.h
  LN include/bits/libc-lock.h
  LN include/bits/stdio-lock.h
  LN include/bits/pthreadtypes.h
  LN include/bits/semaphore.h
  LN include/thread_db.h
  LN include/fpu_control.h

  
  <stdin>:1: error: no include path in which to search for asm/unistd.h
<stdin>:1: error: no include path in which to search for asm/unistd.h
ERROR: Could not generate syscalls.
Make sure that you have proper kernel headers.
Your .config in KERNEL_HEADERS="" was set to:
/mnt/opt/hisi-linux-nptl/arm-hisiv100-linux/target/usr/include/
make: *** [include/bits/sysnum.h] Error 1
当出现此类错误时,请check一下该选项的设置是否正确。


转载于:https://my.oschina.net/shelllife/blog/227504

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值