我在 riscv-rootfs 目录的时候遇到这个问题运行 make rootfsimg
问题如下
In file included from /home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/include-fixed/syslimits.h:7,
from /home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/include-fixed/limits.h:34,
from include/platform.h:153,
from include/libbb.h:13,
from include/busybox.h:8,
from applets/applets.c:9:
/home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/include-fixed/limits.h:203:15: fatal error: limits.h: No such file or directory
203 | #include_next / recurse down to the real one /
| ^~~~~~
compilation terminated.
make[3]: [scripts/Makefile.build:198: applets/applets.o] Error 1
make[2]: [Makefile:372: applets_dir] Error 2
解决方法如下,在另一位同学的协同下,发现riscv-rootfs/apps/busybox/config文件有个环境变量-“RISCV"没有被提及导致这个问题出现
部分原文如下# Build Options
#
解决方法把RISCV设置为自己编译的工具链的目录。
我的为~/riscv64-linux .(加上sysroot之后是 ~/riscv64-linux/sysroot)
到此问题解决。
下一个问题如下,好像是工具链的版本不兼容,不知道能否提供以下可用的版本号呢?
/home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: coreutils/lib.a(mktemp.o): in function .L5': mktemp.c:(.text.mktemp_main+0x88): warning: the use ofmktemp' is dangerous, better use mkstemp' ormkdtemp'
/home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: util-linux/lib.a(rdate.o): in function .L6': rdate.c:(.text.rdate_main+0xd0): undefined reference tostime'
/home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: coreutils/lib.a(date.o): in function .L12': date.c:(.text.date_main+0x1a0): undefined reference tostime'
collect2: error: ld returned 1 exit status
Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS.
Example: CONFIG_EXTRA_LDLIBS="pthread dl tirpc audit pam"
make[2]: [Makefile:718: busybox_unstripped] Error 1
make[1]: [Makefile:12: /home/mark/xs/linux_kernel/riscv-rootfs/apps/busybox/build/busybox] Error 2
make: [Makefile:11: apps/busybox] Error 2 (ignored)
make -s -C apps/redis install
我在 riscv-rootfs 目录的时候遇到这个问题运行 / recurse down to the real one /
| ^
make rootfsimg
问题如下 In file included from /home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/include-fixed/syslimits.h:7, from /home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/include-fixed/limits.h:34, from include/platform.h:153, from include/libbb.h:13, from include/busybox.h:8, from applets/applets.c:9: /home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/include-fixed/limits.h:203:15: fatal error: limits.h: No such file or directory 203 | #include_next~~~~~ compilation terminated. make[3]: [scripts/Makefile.build:198: applets/applets.o] Error 1 make[2]: [Makefile:372: applets_dir] Error 2 解决方法如下,在另一位同学的协同下,发现riscv-rootfs/apps/busybox/config文件有个环境变量-“RISCV"没有被提及导致这个问题出现 部分原文如下# Build Options #CONFIG_STATIC is not set
CONFIG_PIE is not set
CONFIG_NOMMU is not set
CONFIG_BUILD_LIBBUSYBOX is not set
CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
CONFIG_FEATURE_INDIVIDUAL is not set
CONFIG_FEATURE_SHARED_BUSYBOX is not set
CONFIG_CROSS_COMPILER_PREFIX="riscv64-unknown-linux-gnu-" CONFIG_SYSROOT="${RISCV}/sysroot"
CONFIG_EXTRA_CFLAGS="" CONFIG_EXTRA_LDFLAGS="" CONFIG_EXTRA_LDLIBS=""
CONFIG_USE_PORTABLE_CODE is not set
CONFIG_STACK_OPTIMIZATION_386=y
解决方法把RISCV设置为自己编译的工具链的目录。 我的为~/riscv64-linux .(加上sysroot之后是 ~/riscv64-linux/sysroot) 到此问题解决。 下一个问题如下,好像是工具链的版本不兼容,不知道能否提供以下可用的版本号呢? /home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: coreutils/lib.a(mktemp.o): in function
.L5': mktemp.c:(.text.mktemp_main+0x88): warning: the use of
mktemp' is dangerous, better usemkstemp' or
mkdtemp' /home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: util-linux/lib.a(rdate.o): in function.L6': rdate.c:(.text.rdate_main+0xd0): undefined reference to
stime' /home/mark/riscv64-linux_2/lib/gcc/riscv64-unknown-linux-gnu/11.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: coreutils/lib.a(date.o): in function.L12': date.c:(.text.date_main+0x1a0): undefined reference to
stime' collect2: error: ld returned 1 exit status Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS. Example: CONFIG_EXTRA_LDLIBS="pthread dl tirpc audit pam" make[2]: [Makefile:718: busybox_unstripped] Error 1 make[1]: [Makefile:12: /home/mark/xs/linux_kernel/riscv-rootfs/apps/busybox/build/busybox] Error 2 make: [Makefile:11: apps/busybox] Error 2 (ignored) make -s -C apps/redis install