busybox-1.29.3缺少头文件的问题
注意:这2个问题是矛盾的,一定要手工备份文件,先做问题1。
问题1
/usr/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-32.h: 没有那个文件或目录
# include <gnu/stubs-32.h>
^~~~~~~~~~~~~~~~
解决方法
# cd /usr/include
# cp -p x86_64-linux-gnu x86_64-linux-gnu.bak
# apt-get install libc6-dev-i386
root@xydpc:/usr/include/x86_64-linux-gnu/gnu# cp -p stubs-32.h stubs-32.h.bakorg
特别注意:安装后会引发问题2,请提前备份。
备用脚本
root@xydpc:/usr/include# rm x86_64-linux-gnu/sys/*
root@xydpc:/usr/include# cp x86_64-linux-gnu.bak/sys/* x86_64-linux-gnu/sys
同时注意:不能把stubs.h软链接到stubs-32.h,可以看看里面的内容就知道了。需要按照前面的方法来安装
/usr/include/gnu/stubs-32.h:7:27: error: #include nested too deeply
# include <gnu/stubs-32.h>
^
In file included from include/libbb.h:32:0,
from include/busybox.h:8,
from applets/applets.c:9:
/usr/include/stdlib.h:152:8: error: ‘_Float128’ is not supported on this target
extern _Float128 strtof128 (const char *__restrict __nptr,
^~~~~~~~~
问题2
root@xydpc:/usr/include# apt-get install libc6-dev-i386/sys里面的文件全部是链接文件
lrwxrwxrwx 1 root root 31 4月 17 2018 times.h -> …/x86_64-linux-gnu/sys/times.h
循环链接,在/usr/include也没有sys目录。
解决方法
64位的库文件找回,重新安装linux-libc-dev。
先删除apt-get remove linux-libc-dev,
再安装apt-get install linux-libc-dev,
补安装多删除的 apt-get install gnome-common hardinfo libc6-dev libncurses5-dev libtool linux-libc-dev mate-common mint-meta-mate zlib1g-dev。
解决。
创建几个链接文件
root@xydpc:/usr/include# ll | grep -v .h |grep lr
lrwxrwxrwx 1 root root 20 5月 30 10:54 asm -> x86_64-linux-gnu/asm/
lrwxrwxrwx 1 root root 21 5月 30 11:27 bits -> x86_64-linux-gnu/bits/
lrwxrwxrwx 1 root root 20 5月 30 11:28 gnu -> x86_64-linux-gnu/gnu/
lrwxrwxrwx 1 root root 20 5月 30 11:28 sys -> x86_64-linux-gnu/sys/
问题3
/usr/include/stdlib.h:152:8: error: ‘_Float128’ is not supported on this target
extern _Float128 strtof128 (const char *__restrict __nptr,
^~~~~~~~~
/usr/include/stdlib.h:164:8: error: ‘_Float64x’ is not supported on this target
extern _Float64x strtof64x (const char *__restrict __nptr,
^~~~~~~~~
解决方法:busybox采用的arm-gcc编译,先备份库文件后注释掉对应的行
用井号不行的
/*#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
extern _Float128 strtof128 (const char *__restrict __nptr,
char **__restrict __endptr)
__THROW __nonnull ((1));
#endif */
archival/lzop.c: In function ‘do_lzo_decompress’:
archival/lzop.c:963:14: error: invalid 'asm': invalid operand for code 'w'
h_version = htons(h->version_be16);
^
archival/lzop.c:966:32: error: invalid 'asm': invalid operand for code 'w'
h_version_needed_to_extract = htons(h->version_needed_to_extract_be16);
^
scripts/Makefile.build:197: recipe for target 'archival/lzop.o' failed
make[1]: *** [archival/lzop.o] Error 1
Makefile:743: recipe for target 'archival' failed
make: *** [archival] Error 2
处理:
xy@xydpc:/usr/src/busybox-1.29.3$ vi archival/lzop.c
963 /* h_version = htons(h->version_be16);
964 if (h_version < 0x0940)
965 return 3;
966 h_version_needed_to_extract = htons(h->version_needed_to_extract_be16); */
重新安装交叉工具解决方法
apt卸载不能自动删除,后来通过apt search arm-linux,根据已安装的部件提示,逐一删除 apt remove.
然后在https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabi/下载了最新版本。
解压到/opt目录下。
xy@xydpc:/usr/src/busybox-1.29.3$ export PATH=$PATH:.:/opt/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi/bin/
xy@xydpc:/usr/src/busybox-1.29.3$ export ARCH=arm
xy@xydpc:/usr/src/busybox-1.29.3$ export CROSS_COMPILE=arm-linux-gnueabi-
xy@xydpc:/usr/src/busybox-1.29.3$ make defconfig (实际未重新操作)
xy@xydpc:/usr/src/busybox-1.29.3$ make
...
AR util-linux/volume_id/lib.a
LINK busybox_unstripped
Trying libraries: crypt m resolv
Library crypt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Final link with: m resolv
DOC busybox.pod
DOC BusyBox.txt
DOC busybox.1
DOC BusyBox.html
xy@xydpc:/usr/src/busybox-1.29.3$ ll bu*
-rwxrwxr-x 1 xy xy 715948 6月 3 18:38 busybox*
-rwxrwxr-x 1 xy xy 997524 6月 3 18:38 busybox_unstripped*
-rw-rw-r-- 1 xy xy 977981 6月 3 18:38 busybox_unstripped.map
-rw-rw-r-- 1 xy xy 39498 6月 3 18:38 busybox_unstripped.out
xy@xydpc:/usr/src/busybox-1.29.3$ file busybox
busybox: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-, for GNU/Linux 3.2.0, BuildID[sha1]=2fd982564a1a96709dc98611ee7472e8383d3781, stripped
总结
apt-get安装的工具有问题,具体安装的命令(软件名称)没有记录下来。