一、编译uboot遇到问题
/usr/include/libfdt.h:258:1: error: redefinition of 'fdt_set_version'
258 | fdt_set_hdr_(version);
| ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
from tools/imagetool.h:22,
from tools/aisimage.c:8:
tools/../include/libfdt.h:209:21: note: previous definition of 'fdt_set_version' was here
209 | static inline void fdt_set_##name(void *fdt, uint32_t val) \
| ^~~~~~~~
tools/../include/libfdt.h:219:1: note: in expansion of macro '__fdt_set_hdr'
219 | __fdt_set_hdr(version);
| ^~~~~~~~~~~~~
In file included from include/image.h:49,
from tools/aisimage.c:10:
/usr/include/libfdt.h:259:1: error: redefinition of 'fdt_set_last_comp_version'
259 | fdt_set_hdr_(last_comp_version);
| ^~~~~~~~~~~~
问题分析及解决:
出现这个问题是因为你的系统版本太新了, 然后系统中的 libfdt 是比较新的,u-boot 版本比较老,而 libfdt 库改动过,u-boot 调用该库时出现兼容问题,实际上 u-boot 内置有libfdt,你把系统新的 libfdt-dev 删除,u-boot 就会调用源代码自带的旧的 libfdt, 所以只需下面命令然后重新编译:
sudo apt-get remove libfdt-dev
后面想重新安装只需:
sudo apt-get install libfdt-dev
二、编译bulidroot遇到问题
freadahead.c: In function 'freadahead':
freadahead.c:91:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
91 | #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
| ^~~~~
fseeko.c: In function 'rpl_fseeko':
fseeko.c:109:4: error: #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
109 | #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
| ^~~~~
问题分析及解决
cd output/build/host-m4-1.4.17/
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
三、编译buildroot报错
gdbusmessage.c:2698:30: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
2698 | tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
问题分析及解决
找到报错的位置,加入如下代码:
if(line != NULL)
......
if(signature_str!= NULL)
四、编译buildroot出现问题
/usr/bin/ld: ../lib/libext2fs.a(ismounted.o): in function `check_mntent_file':
ismounted.c:(.text+0x23d): undefined reference to `major'
/usr/bin/ld: ../lib/libblkid.a(devname.o): in function `probe_all':
devname.c:(.text+0x888): undefined reference to `makedev'
/usr/bin/ld: devname.c:(.text+0xb7e): undefined reference to `makedev'
/usr/bin/ld: devname.c:(.text+0xc5b): undefined reference to `makedev'
collect2: error: ld returned 1 exit status
问题分析及解决
找到devname.c文件,添加
#include <sys/types.h>
#include <sys/sysmacros.h>
五、编译buildroot遇到问题
lib/fseterr.c: In function 'fseterr':
lib/fseterr.c:77:3: error: #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
77 | #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
| ^~~~~
解决方案
cd output/build/host-bison-3.0.4/
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
六、编译buildroot遇到问题
strerror-sym.c:47:9: error: 'errnos_msgstr' undeclared (first use in this function)
return errnos_msgstr + errnos_msgidx[idx];
^
strerror-sym.c:47:9: note: each undeclared identifier is reported only once for each function it appears in
strerror-sym.c:47:25: error: 'errnos_msgidx' undeclared (first use in this function)
return errnos_msgstr + errnos_msgidx[idx];
解决方案
七、buildroot编译报错
/home/zw/rk3399/x3399_linux_new/buildroot/output/rockchip_x3399/build/host-qemu-2.10.2/linux-user/syscall.c:259:16: error: static declaration of 'gettid' follows non-static declaration
259 | _syscall0(int, gettid)
| ^~~~~~
/home/zw/rk3399/x3399_linux_new/buildroot/output/rockchip_x3399/build/host-qemu-2.10.2/linux-user/syscall.c:189:13: note: in definition of macro '_syscall0'
189 | static type name (void) \
| ^~~~
In file included from /usr/include/unistd.h:1170,
from /home/zw/rk3399/x3399_linux_new/buildroot/output/rockchip_x3399/build/host-qemu-2.10.2/include/qemu/osdep.h:75,
from /home/zw/rk3399/x3399_linux_new/buildroot/output/rockchip_x3399/build/host-qemu-2.10.2/linux-user/syscall.c:20:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: previous declaration of 'gettid' was here
34 | extern __pid_t gettid (void) __THROW;
| ^~~~~~
CC aarch64-linux-user/target/arm/crypto_helper.o
GEN trace/generated-helpers.c
CC aarch64-linux-user/trace/control-target.o
CC aarch64-linux-user/gdbstub-xml.o
CC aarch64-linux-user/trace/generated-helpers.o
/home/zw/rk3399/x3399_linux_new/buildroot/output/rockchip_x3399/build/host-qemu-2.10.2/linux-user/ioctls.h:173:9: error: 'SIOCGSTAMP' undeclared here (not in a function); did you mean 'SIOCSRARP'?
173 | IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
| ^~~~~~~~~~
/home/zw/rk3399/x3399_linux_new/buildroot/output/rockchip_x3399/build/host-qemu-2.10.2/linux-user/syscall.c:5595:23: note: in definition of macro 'IOCTL'
5595 | { TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
| ^~~
/home/zw/rk3399/x3399_linux_new/buildroot/output/rockchip_x3399/build/host-qemu-2.10.2/linux-user/ioctls.h:174:9: error: 'SIOCGSTAMPNS' undeclared here (not in a function); did you mean 'SIOCGSTAMP_OLD'?
174 | IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
解决方案
将报错地方注释掉