[U-Boot] Tools build failure when libfdt-devel is installed

Hello,
I'm running a Fedora 27 system. When the libfdt-devel package is not installed in the distro, U-Boot builds fine. When libfdt-devel is installed, the build of U-Boot tools breaks badly, because it includes headers from /usr/include/ for libfdt, instead of using only its own internal headers.
See below the full build log. I've tried to fix it, but the way libfdt is integrated in U-Boot is not really easy to understand, with apparently multiple copies of it, referencing each other.
Any idea ?
Thomas
thomas@windsurf:~/projets/u-boot (master)$ make m28evk_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/zconf.lex.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # thomas@windsurf:~/projets/u-boot (master)$ make tools-only scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config.h UPD include/config.h CFG u-boot.cfg GEN include/autoconf.mk GEN include/autoconf.mk.dep CFG spl/u-boot.cfg GEN spl/include/autoconf.mk CHK include/config/uboot.release UPD include/config/uboot.release CHK include/generated/version_autogenerated.h UPD include/generated/version_autogenerated.h CHK include/generated/timestamp_autogenerated.h UPD include/generated/timestamp_autogenerated.h HOSTCC tools/bmp_logo HOSTCC tools/envcrc.o WRAP tools/lib/crc32.c HOSTCC tools/lib/crc32.o WRAP tools/env/embedded.c HOSTCC tools/env/embedded.o WRAP tools/lib/sha1.c HOSTCC tools/lib/sha1.o HOSTLD tools/envcrc HOSTCC tools/gen_eth_addr HOSTCC tools/gen_ethaddr_crc.o WRAP tools/lib/crc8.c HOSTCC tools/lib/crc8.o HOSTLD tools/gen_ethaddr_crc HOSTCC tools/img2srec HOSTCC tools/mkenvimage.o HOSTCC tools/os_support.o HOSTLD tools/mkenvimage HOSTCC tools/aisimage.o In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:81:24: error: redefinition of ‘fdt16_to_cpu’ static inline uint16_t fdt16_to_cpu(fdt16_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:81:24: note: previous definition of ‘fdt16_to_cpu’ was here static inline uint16_t fdt16_to_cpu(fdt16_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:85:23: error: redefinition of ‘cpu_to_fdt16’ static inline fdt16_t cpu_to_fdt16(uint16_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:85:23: note: previous definition of ‘cpu_to_fdt16’ was here static inline fdt16_t cpu_to_fdt16(uint16_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:90:24: error: redefinition of ‘fdt32_to_cpu’ static inline uint32_t fdt32_to_cpu(fdt32_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:90:24: note: previous definition of ‘fdt32_to_cpu’ was here static inline uint32_t fdt32_to_cpu(fdt32_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:94:23: error: redefinition of ‘cpu_to_fdt32’ static inline fdt32_t cpu_to_fdt32(uint32_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:94:23: note: previous definition of ‘cpu_to_fdt32’ was here static inline fdt32_t cpu_to_fdt32(uint32_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:99:24: error: redefinition of ‘fdt64_to_cpu’ static inline uint64_t fdt64_to_cpu(fdt64_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:99:24: note: previous definition of ‘fdt64_to_cpu’ was here static inline uint64_t fdt64_to_cpu(fdt64_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:103:23: error: redefinition of ‘cpu_to_fdt64’ static inline fdt64_t cpu_to_fdt64(uint64_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:103:23: note: previous definition of ‘cpu_to_fdt64’ was here static inline fdt64_t cpu_to_fdt64(uint64_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:55:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/fdt.h:57:8: error: redefinition of ‘struct fdt_header’ struct fdt_header { ^~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:55:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/fdt.h:57:8: note: originally defined here struct fdt_header { ^~~~~~~~~~ In file included from /usr/include/libfdt.h:55:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/fdt.h:76:8: error: redefinition of ‘struct fdt_reserve_entry’ struct fdt_reserve_entry { ^~~~~~~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:55:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/fdt.h:76:8: note: originally defined here struct fdt_reserve_entry { ^~~~~~~~~~~~~~~~~ In file included from /usr/include/libfdt.h:55:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/fdt.h:81:8: error: redefinition of ‘struct fdt_node_header’ struct fdt_node_header { ^~~~~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:55:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/fdt.h:81:8: note: originally defined here struct fdt_node_header { ^~~~~~~~~~~~~~~ In file included from /usr/include/libfdt.h:55:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/fdt.h:86:8: error: redefinition of ‘struct fdt_property’ struct fdt_property { ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:55:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/fdt.h:86:8: note: originally defined here struct fdt_property { ^~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:149:21: error: redefinition of ‘fdt_offset_ptr_w’ static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:149:21: note: previous definition of ‘fdt_offset_ptr_w’ was here static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:234:1: error: redefinition of ‘fdt_set_magic’ fdt_set_hdr_(magic); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_magic’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:234:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(magic); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:235:1: error: redefinition of ‘fdt_set_totalsize’ fdt_set_hdr_(totalsize); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_totalsize’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:235:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(totalsize); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:236:1: error: redefinition of ‘fdt_set_off_dt_struct’ fdt_set_hdr_(off_dt_struct); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_off_dt_struct’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:236:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(off_dt_struct); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:237:1: error: redefinition of ‘fdt_set_off_dt_strings’ fdt_set_hdr_(off_dt_strings); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_off_dt_strings’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:237:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(off_dt_strings); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:238:1: error: redefinition of ‘fdt_set_off_mem_rsvmap’ fdt_set_hdr_(off_mem_rsvmap); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_off_mem_rsvmap’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:238:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(off_mem_rsvmap); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:239:1: error: redefinition of ‘fdt_set_version’ fdt_set_hdr_(version); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_version’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:239:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(version); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:240:1: error: redefinition of ‘fdt_set_last_comp_version’ fdt_set_hdr_(last_comp_version); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_last_comp_version’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:240:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(last_comp_version); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:241:1: error: redefinition of ‘fdt_set_boot_cpuid_phys’ fdt_set_hdr_(boot_cpuid_phys); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_boot_cpuid_phys’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:241:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(boot_cpuid_phys); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:242:1: error: redefinition of ‘fdt_set_size_dt_strings’ fdt_set_hdr_(size_dt_strings); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_size_dt_strings’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:242:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(size_dt_strings); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:243:1: error: redefinition of ‘fdt_set_size_dt_struct’ fdt_set_hdr_(size_dt_struct); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_size_dt_struct’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:243:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(size_dt_struct); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:543:28: error: conflicting types for ‘fdt_get_property_by_offset’ const struct fdt_property *fdt_get_property_by_offset(const void *fdt, ^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:543:28: note: previous declaration of ‘fdt_get_property_by_offset’ was here const struct fdt_property *fdt_get_property_by_offset(const void *fdt, ^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:559:28: error: conflicting types for ‘fdt_get_property_namelen’ const struct fdt_property *fdt_get_property_namelen(const void *fdt, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:559:28: note: previous declaration of ‘fdt_get_property_namelen’ was here const struct fdt_property *fdt_get_property_namelen(const void *fdt, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:593:28: error: conflicting types for ‘fdt_get_property’ const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:593:28: note: previous declaration of ‘fdt_get_property’ was here const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:595:36: error: conflicting types for ‘fdt_get_property_w’ static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:595:36: note: previous definition of ‘fdt_get_property_w’ was here static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:653:21: error: redefinition of ‘fdt_getprop_namelen_w’ static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:653:21: note: previous definition of ‘fdt_getprop_namelen_w’ was here static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:692:21: error: redefinition of ‘fdt_getprop_w’ static inline void *fdt_getprop_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:692:21: note: previous definition of ‘fdt_getprop_w’ was here static inline void *fdt_getprop_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1190:19: error: redefinition of ‘fdt_setprop_inplace_u32’ static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1190:19: note: previous definition of ‘fdt_setprop_inplace_u32’ was here static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1225:19: error: redefinition of ‘fdt_setprop_inplace_u64’ static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1225:19: note: previous definition of ‘fdt_setprop_inplace_u64’ was here static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1237:19: error: redefinition of ‘fdt_setprop_inplace_cell’ static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1237:19: note: previous definition of ‘fdt_setprop_inplace_cell’ was here static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1303:19: error: redefinition of ‘fdt_property_u32’ static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1303:19: note: previous definition of ‘fdt_property_u32’ was here static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1308:19: error: redefinition of ‘fdt_property_u64’ static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1308:19: note: previous definition of ‘fdt_property_u64’ was here static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1313:19: error: redefinition of ‘fdt_property_cell’ static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) ^~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1313:19: note: previous definition of ‘fdt_property_cell’ was here static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) ^~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1510:19: error: redefinition of ‘fdt_setprop_u32’ static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1510:19: note: previous definition of ‘fdt_setprop_u32’ was here static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1545:19: error: redefinition of ‘fdt_setprop_u64’ static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1545:19: note: previous definition of ‘fdt_setprop_u64’ was here static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1557:19: error: redefinition of ‘fdt_setprop_cell’ static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1557:19: note: previous definition of ‘fdt_setprop_cell’ was here static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1682:19: error: redefinition of ‘fdt_appendprop_u32’ static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1682:19: note: previous definition of ‘fdt_appendprop_u32’ was here static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1717:19: error: redefinition of ‘fdt_appendprop_u64’ static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1717:19: note: previous definition of ‘fdt_appendprop_u64’ was here static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1729:19: error: redefinition of ‘fdt_appendprop_cell’ static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1729:19: note: previous definition of ‘fdt_appendprop_cell’ was here static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~ make[1]: *** [scripts/Makefile.host:116: tools/aisimage.o] Error 1 make: *** [Makefile:1506: tools-only] Error 2

2018-03-03 6:19 GMT+09:00 Thomas Petazzoni thomas.petazzoni@bootlin.com:
Hello,
I'm running a Fedora 27 system. When the libfdt-devel package is not installed in the distro, U-Boot builds fine. When libfdt-devel is installed, the build of U-Boot tools breaks badly, because it includes headers from /usr/include/ for libfdt, instead of using only its own internal headers.
See below the full build log. I've tried to fix it, but the way libfdt is integrated in U-Boot is not really easy to understand, with apparently multiple copies of it, referencing each other.
Any idea ?
I think U-Boot (both U-Boot binary and host-tools) should use
#include <linux/libfdt.h>
#include <linux/libfdt_env.h>
instead of
#include <libfdt.h>
#include <libfdt_env.h>
I was working on this way, and U-Boot already has <linux/libfdt.h> and <linux/libfdt_env.h> like Linux does.
If we agree, I can move forward it.
Also, further refactoring is needed. The include paths of tools are so cryptic.
Thomas
thomas@windsurf:~/projets/u-boot (master)$ make m28evk_defconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/zconf.lex.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # thomas@windsurf:~/projets/u-boot (master)$ make tools-only scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config.h UPD include/config.h CFG u-boot.cfg GEN include/autoconf.mk GEN include/autoconf.mk.dep CFG spl/u-boot.cfg GEN spl/include/autoconf.mk CHK include/config/uboot.release UPD include/config/uboot.release CHK include/generated/version_autogenerated.h UPD include/generated/version_autogenerated.h CHK include/generated/timestamp_autogenerated.h UPD include/generated/timestamp_autogenerated.h HOSTCC tools/bmp_logo HOSTCC tools/envcrc.o WRAP tools/lib/crc32.c HOSTCC tools/lib/crc32.o WRAP tools/env/embedded.c HOSTCC tools/env/embedded.o WRAP tools/lib/sha1.c HOSTCC tools/lib/sha1.o HOSTLD tools/envcrc HOSTCC tools/gen_eth_addr HOSTCC tools/gen_ethaddr_crc.o WRAP tools/lib/crc8.c HOSTCC tools/lib/crc8.o HOSTLD tools/gen_ethaddr_crc HOSTCC tools/img2srec HOSTCC tools/mkenvimage.o HOSTCC tools/os_support.o HOSTLD tools/mkenvimage HOSTCC tools/aisimage.o In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:81:24: error: redefinition of ‘fdt16_to_cpu’ static inline uint16_t fdt16_to_cpu(fdt16_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:81:24: note: previous definition of ‘fdt16_to_cpu’ was here static inline uint16_t fdt16_to_cpu(fdt16_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:85:23: error: redefinition of ‘cpu_to_fdt16’ static inline fdt16_t cpu_to_fdt16(uint16_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:85:23: note: previous definition of ‘cpu_to_fdt16’ was here static inline fdt16_t cpu_to_fdt16(uint16_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:90:24: error: redefinition of ‘fdt32_to_cpu’ static inline uint32_t fdt32_to_cpu(fdt32_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:90:24: note: previous definition of ‘fdt32_to_cpu’ was here static inline uint32_t fdt32_to_cpu(fdt32_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:94:23: error: redefinition of ‘cpu_to_fdt32’ static inline fdt32_t cpu_to_fdt32(uint32_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:94:23: note: previous definition of ‘cpu_to_fdt32’ was here static inline fdt32_t cpu_to_fdt32(uint32_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:99:24: error: redefinition of ‘fdt64_to_cpu’ static inline uint64_t fdt64_to_cpu(fdt64_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:99:24: note: previous definition of ‘fdt64_to_cpu’ was here static inline uint64_t fdt64_to_cpu(fdt64_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:54:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/libfdt_env.h:103:23: error: redefinition of ‘cpu_to_fdt64’ static inline fdt64_t cpu_to_fdt64(uint64_t x) ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:54:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt_env.h:103:23: note: previous definition of ‘cpu_to_fdt64’ was here static inline fdt64_t cpu_to_fdt64(uint64_t x) ^~~~~~~~~~~~ In file included from /usr/include/libfdt.h:55:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/fdt.h:57:8: error: redefinition of ‘struct fdt_header’ struct fdt_header { ^~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:55:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/fdt.h:57:8: note: originally defined here struct fdt_header { ^~~~~~~~~~ In file included from /usr/include/libfdt.h:55:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/fdt.h:76:8: error: redefinition of ‘struct fdt_reserve_entry’ struct fdt_reserve_entry { ^~~~~~~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:55:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/fdt.h:76:8: note: originally defined here struct fdt_reserve_entry { ^~~~~~~~~~~~~~~~~ In file included from /usr/include/libfdt.h:55:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/fdt.h:81:8: error: redefinition of ‘struct fdt_node_header’ struct fdt_node_header { ^~~~~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:55:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/fdt.h:81:8: note: originally defined here struct fdt_node_header { ^~~~~~~~~~~~~~~ In file included from /usr/include/libfdt.h:55:0, from include/image.h:56, from tools/aisimage.c:10: /usr/include/fdt.h:86:8: error: redefinition of ‘struct fdt_property’ struct fdt_property { ^~~~~~~~~~~~ In file included from tools/../include/../scripts/dtc/libfdt/libfdt.h:55:0, from tools/../include/libfdt.h:8, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/fdt.h:86:8: note: originally defined here struct fdt_property { ^~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:149:21: error: redefinition of ‘fdt_offset_ptr_w’ static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:149:21: note: previous definition of ‘fdt_offset_ptr_w’ was here static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen) ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:234:1: error: redefinition of ‘fdt_set_magic’ fdt_set_hdr_(magic); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_magic’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:234:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(magic); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:235:1: error: redefinition of ‘fdt_set_totalsize’ fdt_set_hdr_(totalsize); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_totalsize’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:235:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(totalsize); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:236:1: error: redefinition of ‘fdt_set_off_dt_struct’ fdt_set_hdr_(off_dt_struct); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_off_dt_struct’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:236:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(off_dt_struct); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:237:1: error: redefinition of ‘fdt_set_off_dt_strings’ fdt_set_hdr_(off_dt_strings); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_off_dt_strings’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:237:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(off_dt_strings); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:238:1: error: redefinition of ‘fdt_set_off_mem_rsvmap’ fdt_set_hdr_(off_mem_rsvmap); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_off_mem_rsvmap’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:238:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(off_mem_rsvmap); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:239:1: error: redefinition of ‘fdt_set_version’ fdt_set_hdr_(version); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_version’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:239:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(version); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:240:1: error: redefinition of ‘fdt_set_last_comp_version’ fdt_set_hdr_(last_comp_version); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_last_comp_version’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:240:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(last_comp_version); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:241:1: error: redefinition of ‘fdt_set_boot_cpuid_phys’ fdt_set_hdr_(boot_cpuid_phys); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_boot_cpuid_phys’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:241:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(boot_cpuid_phys); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:242:1: error: redefinition of ‘fdt_set_size_dt_strings’ fdt_set_hdr_(size_dt_strings); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_size_dt_strings’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:242:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(size_dt_strings); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:243:1: error: redefinition of ‘fdt_set_size_dt_struct’ fdt_set_hdr_(size_dt_struct); ^ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:229:21: note: previous definition of ‘fdt_set_size_dt_struct’ was here static inline void fdt_set_##name(void *fdt, uint32_t val) \ ^ tools/../include/../scripts/dtc/libfdt/libfdt.h:243:1: note: in expansion of macro ‘__fdt_set_hdr’ __fdt_set_hdr(size_dt_struct); ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:543:28: error: conflicting types for ‘fdt_get_property_by_offset’ const struct fdt_property *fdt_get_property_by_offset(const void *fdt, ^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:543:28: note: previous declaration of ‘fdt_get_property_by_offset’ was here const struct fdt_property *fdt_get_property_by_offset(const void *fdt, ^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:559:28: error: conflicting types for ‘fdt_get_property_namelen’ const struct fdt_property *fdt_get_property_namelen(const void *fdt, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:559:28: note: previous declaration of ‘fdt_get_property_namelen’ was here const struct fdt_property *fdt_get_property_namelen(const void *fdt, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:593:28: error: conflicting types for ‘fdt_get_property’ const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:593:28: note: previous declaration of ‘fdt_get_property’ was here const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:595:36: error: conflicting types for ‘fdt_get_property_w’ static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:595:36: note: previous definition of ‘fdt_get_property_w’ was here static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:653:21: error: redefinition of ‘fdt_getprop_namelen_w’ static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:653:21: note: previous definition of ‘fdt_getprop_namelen_w’ was here static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:692:21: error: redefinition of ‘fdt_getprop_w’ static inline void *fdt_getprop_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:692:21: note: previous definition of ‘fdt_getprop_w’ was here static inline void *fdt_getprop_w(void *fdt, int nodeoffset, ^~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1190:19: error: redefinition of ‘fdt_setprop_inplace_u32’ static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1190:19: note: previous definition of ‘fdt_setprop_inplace_u32’ was here static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1225:19: error: redefinition of ‘fdt_setprop_inplace_u64’ static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1225:19: note: previous definition of ‘fdt_setprop_inplace_u64’ was here static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1237:19: error: redefinition of ‘fdt_setprop_inplace_cell’ static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1237:19: note: previous definition of ‘fdt_setprop_inplace_cell’ was here static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1303:19: error: redefinition of ‘fdt_property_u32’ static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1303:19: note: previous definition of ‘fdt_property_u32’ was here static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val) ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1308:19: error: redefinition of ‘fdt_property_u64’ static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1308:19: note: previous definition of ‘fdt_property_u64’ was here static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val) ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1313:19: error: redefinition of ‘fdt_property_cell’ static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) ^~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1313:19: note: previous definition of ‘fdt_property_cell’ was here static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val) ^~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1510:19: error: redefinition of ‘fdt_setprop_u32’ static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1510:19: note: previous definition of ‘fdt_setprop_u32’ was here static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1545:19: error: redefinition of ‘fdt_setprop_u64’ static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1545:19: note: previous definition of ‘fdt_setprop_u64’ was here static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1557:19: error: redefinition of ‘fdt_setprop_cell’ static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1557:19: note: previous definition of ‘fdt_setprop_cell’ was here static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name, ^~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1682:19: error: redefinition of ‘fdt_appendprop_u32’ static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1682:19: note: previous definition of ‘fdt_appendprop_u32’ was here static inline int fdt_appendprop_u32(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1717:19: error: redefinition of ‘fdt_appendprop_u64’ static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1717:19: note: previous definition of ‘fdt_appendprop_u64’ was here static inline int fdt_appendprop_u64(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~ In file included from include/image.h:56:0, from tools/aisimage.c:10: /usr/include/libfdt.h:1729:19: error: redefinition of ‘fdt_appendprop_cell’ static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~ In file included from tools/../include/libfdt.h:8:0, from tools/fdt_host.h:11, from tools/imagetool.h:25, from tools/aisimage.c:8: tools/../include/../scripts/dtc/libfdt/libfdt.h:1729:19: note: previous definition of ‘fdt_appendprop_cell’ was here static inline int fdt_appendprop_cell(void *fdt, int nodeoffset, ^~~~~~~~~~~~~~~~~~~ make[1]: *** [scripts/Makefile.host:116: tools/aisimage.o] Error 1 make: *** [Makefile:1506: tools-only] Error 2
-- Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hello,
Thanks for your feedback!
On Sun, 4 Mar 2018 15:32:20 +0900, Masahiro Yamada wrote:
I think U-Boot (both U-Boot binary and host-tools) should use
#include <linux/libfdt.h>
#include <linux/libfdt_env.h>
instead of
#include <libfdt.h>
#include <libfdt_env.h>
Perhaps, I'm not sure what the best solution is though.
I was working on this way, and U-Boot already has <linux/libfdt.h> and <linux/libfdt_env.h> like Linux does.
If we agree, I can move forward it.
If you have a preliminary patch, I'd be happy to test it.
Also, further refactoring is needed. The include paths of tools are so cryptic.
Oh yes it is cryptic!
Thomas
participants (2)
-
Masahiro Yamada
-
Thomas Petazzoni