hardkernel / u-boot

u-boot for odroid
179 stars 176 forks source link

Build error when libfdt.h is installed in the system #73

Open happysmash27 opened 3 years ago

happysmash27 commented 3 years ago

When trying to build u-boot, Odroid XU4 branch, I get the following log/error output:

*** Your GCC is older than 6.0 and will not be supported starting in v2018.01.
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CC      lib/asm-offsets.s
  CHK     include/generated/generic-asm-offsets.h
  CC      arch/arm/lib/asm-offsets.s
  CHK     include/generated/asm-offsets.h
  HOSTCC  tools/lib/crc8.o
  HOSTLD  tools/gen_ethaddr_crc
  HOSTCC  tools/mkenvimage.o
  HOSTCC  tools/lib/crc32.o
  HOSTLD  tools/mkenvimage
  HOSTCC  tools/aisimage.o
In file included from tools/../include/libfdt.h:54,
                 from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
/usr/include/libfdt_env.h:27:30: error: conflicting types for ‘fdt64_t’
   27 | typedef uint64_t FDT_BITWISE fdt64_t;
      |                              ^~~~~~~
In file included from <command-line>:
././include/libfdt_env.h:19:16: note: previous declaration of ‘fdt64_t’ was here
   19 | typedef __be64 fdt64_t;
      |                ^~~~~~~
In file included from ././include/libfdt_env.h:12,
                 from <command-line>:
/usr/include/libfdt_env.h:47:24: error: expected ‘)’ before ‘x’
   47 | static inline uint32_t fdt32_to_cpu(fdt32_t x)
      |                        ^~~~~~~~~~~~
././include/compiler.h:71:9: error: expected ‘)’ before ‘&’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |         ^
././include/compiler.h:71:23: error: expected ‘)’ before ‘>>’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                       ^~
././include/compiler.h:71:30: error: expected ‘)’ before ‘|’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                              ^
/usr/include/libfdt_env.h:51:23: error: expected ‘)’ before ‘x’
   51 | static inline fdt32_t cpu_to_fdt32(uint32_t x)
      |                       ^~~~~~~~~~~~
././include/compiler.h:71:9: error: expected ‘)’ before ‘&’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |         ^
././include/compiler.h:71:23: error: expected ‘)’ before ‘>>’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                       ^~
././include/compiler.h:71:30: error: expected ‘)’ before ‘|’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                              ^
/usr/include/libfdt_env.h:56:24: error: expected ‘)’ before ‘x’
   56 | static inline uint64_t fdt64_to_cpu(fdt64_t x)
      |                        ^~~~~~~~~~~~
././include/compiler.h:76:9: error: expected ‘)’ before ‘&’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |         ^
././include/compiler.h:76:36: error: expected ‘)’ before ‘>>’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                    ^~
././include/compiler.h:76:43: error: expected ‘)’ before ‘|’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                           ^
/usr/include/libfdt_env.h:60:23: error: expected ‘)’ before ‘x’
   60 | static inline fdt64_t cpu_to_fdt64(uint64_t x)
      |                       ^~~~~~~~~~~~
././include/compiler.h:76:9: error: expected ‘)’ before ‘&’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |         ^
././include/compiler.h:76:36: error: expected ‘)’ before ‘>>’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                    ^~
././include/compiler.h:76:43: error: expected ‘)’ before ‘|’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                           ^
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:113:21: error: redefinition of ‘fdt_offset_ptr_w’
  113 | static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
      |                     ^~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:152:21: note: previous definition of ‘fdt_offset_ptr_w’ was here
  152 | static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
      |                     ^~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:253:1: error: redefinition of ‘fdt_set_magic’
  253 | fdt_set_hdr_(magic);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_magic’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:238:1: note: in expansion of macro ‘__fdt_set_hdr’
  238 | __fdt_set_hdr(magic);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:254:1: error: redefinition of ‘fdt_set_totalsize’
  254 | fdt_set_hdr_(totalsize);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_totalsize’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:239:1: note: in expansion of macro ‘__fdt_set_hdr’
  239 | __fdt_set_hdr(totalsize);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:255:1: error: redefinition of ‘fdt_set_off_dt_struct’
  255 | fdt_set_hdr_(off_dt_struct);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_off_dt_struct’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:240:1: note: in expansion of macro ‘__fdt_set_hdr’
  240 | __fdt_set_hdr(off_dt_struct);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:256:1: error: redefinition of ‘fdt_set_off_dt_strings’
  256 | fdt_set_hdr_(off_dt_strings);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_off_dt_strings’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:241:1: note: in expansion of macro ‘__fdt_set_hdr’
  241 | __fdt_set_hdr(off_dt_strings);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:257:1: error: redefinition of ‘fdt_set_off_mem_rsvmap’
  257 | fdt_set_hdr_(off_mem_rsvmap);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_off_mem_rsvmap’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:242:1: note: in expansion of macro ‘__fdt_set_hdr’
  242 | __fdt_set_hdr(off_mem_rsvmap);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/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:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_version’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:243:1: note: in expansion of macro ‘__fdt_set_hdr’
  243 | __fdt_set_hdr(version);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 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);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_last_comp_version’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:244:1: note: in expansion of macro ‘__fdt_set_hdr’
  244 | __fdt_set_hdr(last_comp_version);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:260:1: error: redefinition of ‘fdt_set_boot_cpuid_phys’
  260 | fdt_set_hdr_(boot_cpuid_phys);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_boot_cpuid_phys’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:245:1: note: in expansion of macro ‘__fdt_set_hdr’
  245 | __fdt_set_hdr(boot_cpuid_phys);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:261:1: error: redefinition of ‘fdt_set_size_dt_strings’
  261 | fdt_set_hdr_(size_dt_strings);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_size_dt_strings’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:246:1: note: in expansion of macro ‘__fdt_set_hdr’
  246 | __fdt_set_hdr(size_dt_strings);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:262:1: error: redefinition of ‘fdt_set_size_dt_struct’
  262 | fdt_set_hdr_(size_dt_struct);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_size_dt_struct’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:247:1: note: in expansion of macro ‘__fdt_set_hdr’
  247 | __fdt_set_hdr(size_dt_struct);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:381:24: error: static declaration of ‘fdt_get_max_phandle’ follows non-static declaration
  381 | static inline uint32_t fdt_get_max_phandle(const void *fdt)
      |                        ^~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:318:10: note: previous declaration of ‘fdt_get_max_phandle’ was here
  318 | uint32_t fdt_get_max_phandle(const void *fdt);
      |          ^~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:690:36: error: redefinition of ‘fdt_get_property_w’
  690 | static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
      |                                    ^~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:593:36: note: previous definition of ‘fdt_get_property_w’ was here
  593 | static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
      |                                    ^~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:748:21: error: redefinition of ‘fdt_getprop_namelen_w’
  748 | static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
      |                     ^~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:648:21: note: previous definition of ‘fdt_getprop_namelen_w’ was here
  648 | static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
      |                     ^~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:787:21: error: redefinition of ‘fdt_getprop_w’
  787 | static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
      |                     ^~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:686:21: note: previous definition of ‘fdt_getprop_w’ was here
  686 | static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
      |                     ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1285:19: error: redefinition of ‘fdt_setprop_inplace_u32’
 1285 | static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1178:19: note: previous definition of ‘fdt_setprop_inplace_u32’ was here
 1178 | static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1320:19: error: redefinition of ‘fdt_setprop_inplace_u64’
 1320 | static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1213:19: note: previous definition of ‘fdt_setprop_inplace_u64’ was here
 1213 | static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1332:19: error: redefinition of ‘fdt_setprop_inplace_cell’
 1332 | static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1225:19: note: previous definition of ‘fdt_setprop_inplace_cell’ was here
 1225 | static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1436:19: error: redefinition of ‘fdt_property_u32’
 1436 | static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
      |                   ^~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1291:19: note: previous definition of ‘fdt_property_u32’ was here
 1291 | static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
      |                   ^~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1441:19: error: redefinition of ‘fdt_property_u64’
 1441 | static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
      |                   ^~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1296:19: note: previous definition of ‘fdt_property_u64’ was here
 1296 | static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
      |                   ^~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1448:19: error: redefinition of ‘fdt_property_cell’
 1448 | static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
      |                   ^~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1301:19: note: previous definition of ‘fdt_property_cell’ was here
 1301 | static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
      |                   ^~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1646:19: error: redefinition of ‘fdt_setprop_u32’
 1646 | static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1467:19: note: previous definition of ‘fdt_setprop_u32’ was here
 1467 | static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1681:19: error: redefinition of ‘fdt_setprop_u64’
 1681 | static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1502:19: note: previous definition of ‘fdt_setprop_u64’ was here
 1502 | static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1693:19: error: redefinition of ‘fdt_setprop_cell’
 1693 | static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1514:19: note: previous definition of ‘fdt_setprop_cell’ was here
 1514 | static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1818:19: error: redefinition of ‘fdt_appendprop_u32’
 1818 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1609:19: note: previous definition of ‘fdt_appendprop_u32’ was here
 1609 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1853:19: error: redefinition of ‘fdt_appendprop_u64’
 1853 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1644:19: note: previous definition of ‘fdt_appendprop_u64’ was here
 1644 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1865:19: error: redefinition of ‘fdt_appendprop_cell’
 1865 | static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1656:19: note: previous definition of ‘fdt_appendprop_cell’ was here
 1656 | static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~
make[1]: *** [scripts/Makefile.host:116: tools/aisimage.o] Error 1
make: *** [Makefile:1234: tools] Error 2

Other people seem to have a similar issue in other repositories.

Looking at https://github.com/openbmc/openbmc/issues/3274, it looks like it is an issue with libfdt.h being installed system-wide and being pulled in when it should not.

Looking at https://github.com/buildroot/buildroot/commit/bf733342324b414a1142b57781504111f81c97ea, it looks like someone has created a patch for it. I will try installing the patch.

happysmash27 commented 3 years ago

Trying to make my own equivilent to https://source.denx.de/u-boot/u-boot/commit/e0d20dc1521e74b82dbd69be53a048847798a90a, replacing line 249 of tools/Makefile with -I$(srctree)/include/libfdt \ does not seem to fix the issue, strangely enough.

happysmash27 commented 3 years ago

Replacing it with -I$(srctree)/include \ also does not seem to help.

happysmash27 commented 3 years ago

It was taking too long to try to find out whatever automatic thing is causing this, so as a workaround, I tried replacing:

#include <libfdt_env.h>
#include <fdt.h>

with

#include "libfdt_env.h"
#include "fdt.h"

Which then results in a, finally, DIFFERENT error:

scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config.h
  CFG     u-boot.cfg
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
*** Your GCC is older than 6.0 and will not be supported starting in v2018.01.
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CC      lib/asm-offsets.s
  CHK     include/generated/generic-asm-offsets.h
  CC      arch/arm/lib/asm-offsets.s
  CHK     include/generated/asm-offsets.h
  HOSTCC  tools/mkenvimage.o
  HOSTLD  tools/mkenvimage
  HOSTCC  tools/aisimage.o
In file included from /usr/include/libfdt.h:9,
                 from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt_env.h:27:30: error: conflicting types for ‘fdt64_t’
   27 | typedef uint64_t FDT_BITWISE fdt64_t;
      |                              ^~~~~~~
In file included from <command-line>:
././include/libfdt_env.h:19:16: note: previous declaration of ‘fdt64_t’ was here
   19 | typedef __be64 fdt64_t;
      |                ^~~~~~~
In file included from ././include/libfdt_env.h:12,
                 from <command-line>:
/usr/include/libfdt_env.h:47:24: error: expected ‘)’ before ‘x’
   47 | static inline uint32_t fdt32_to_cpu(fdt32_t x)
      |                        ^~~~~~~~~~~~
././include/compiler.h:71:9: error: expected ‘)’ before ‘&’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |         ^
././include/compiler.h:71:23: error: expected ‘)’ before ‘>>’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                       ^~
././include/compiler.h:71:30: error: expected ‘)’ before ‘|’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                              ^
/usr/include/libfdt_env.h:51:23: error: expected ‘)’ before ‘x’
   51 | static inline fdt32_t cpu_to_fdt32(uint32_t x)
      |                       ^~~~~~~~~~~~
././include/compiler.h:71:9: error: expected ‘)’ before ‘&’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |         ^
././include/compiler.h:71:23: error: expected ‘)’ before ‘>>’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                       ^~
././include/compiler.h:71:30: error: expected ‘)’ before ‘|’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                              ^
/usr/include/libfdt_env.h:56:24: error: expected ‘)’ before ‘x’
   56 | static inline uint64_t fdt64_to_cpu(fdt64_t x)
      |                        ^~~~~~~~~~~~
././include/compiler.h:76:9: error: expected ‘)’ before ‘&’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |         ^
././include/compiler.h:76:36: error: expected ‘)’ before ‘>>’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                    ^~
././include/compiler.h:76:43: error: expected ‘)’ before ‘|’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                           ^
/usr/include/libfdt_env.h:60:23: error: expected ‘)’ before ‘x’
   60 | static inline fdt64_t cpu_to_fdt64(uint64_t x)
      |                       ^~~~~~~~~~~~
././include/compiler.h:76:9: error: expected ‘)’ before ‘&’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |         ^
././include/compiler.h:76:36: error: expected ‘)’ before ‘>>’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                    ^~
././include/compiler.h:76:43: error: expected ‘)’ before ‘|’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                           ^
In file included from /usr/include/libfdt.h:10,
                 from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/fdt.h:12:8: error: redefinition of ‘struct fdt_header’
   12 | struct fdt_header {
      |        ^~~~~~~~~~
In file included from tools/../include/libfdt.h:55,
                 from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/fdt.h:57:8: note: originally defined here
   57 | struct fdt_header {
      |        ^~~~~~~~~~
In file included from /usr/include/libfdt.h:10,
                 from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/fdt.h:31:8: error: redefinition of ‘struct fdt_reserve_entry’
   31 | struct fdt_reserve_entry {
      |        ^~~~~~~~~~~~~~~~~
In file included from tools/../include/libfdt.h:55,
                 from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/fdt.h:76:8: note: originally defined here
   76 | struct fdt_reserve_entry {
      |        ^~~~~~~~~~~~~~~~~
In file included from /usr/include/libfdt.h:10,
                 from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/fdt.h:36:8: error: redefinition of ‘struct fdt_node_header’
   36 | struct fdt_node_header {
      |        ^~~~~~~~~~~~~~~
In file included from tools/../include/libfdt.h:55,
                 from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/fdt.h:81:8: note: originally defined here
   81 | struct fdt_node_header {
      |        ^~~~~~~~~~~~~~~
In file included from /usr/include/libfdt.h:10,
                 from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/fdt.h:41:8: error: redefinition of ‘struct fdt_property’
   41 | struct fdt_property {
      |        ^~~~~~~~~~~~
In file included from tools/../include/libfdt.h:55,
                 from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/fdt.h:86:8: note: originally defined here
   86 | struct fdt_property {
      |        ^~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:113:21: error: redefinition of ‘fdt_offset_ptr_w’
  113 | static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
      |                     ^~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:152:21: note: previous definition of ‘fdt_offset_ptr_w’ was here
  152 | static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
      |                     ^~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:253:1: error: redefinition of ‘fdt_set_magic’
  253 | fdt_set_hdr_(magic);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_magic’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:238:1: note: in expansion of macro ‘__fdt_set_hdr’
  238 | __fdt_set_hdr(magic);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:254:1: error: redefinition of ‘fdt_set_totalsize’
  254 | fdt_set_hdr_(totalsize);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_totalsize’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:239:1: note: in expansion of macro ‘__fdt_set_hdr’
  239 | __fdt_set_hdr(totalsize);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:255:1: error: redefinition of ‘fdt_set_off_dt_struct’
  255 | fdt_set_hdr_(off_dt_struct);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_off_dt_struct’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:240:1: note: in expansion of macro ‘__fdt_set_hdr’
  240 | __fdt_set_hdr(off_dt_struct);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:256:1: error: redefinition of ‘fdt_set_off_dt_strings’
  256 | fdt_set_hdr_(off_dt_strings);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_off_dt_strings’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:241:1: note: in expansion of macro ‘__fdt_set_hdr’
  241 | __fdt_set_hdr(off_dt_strings);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:257:1: error: redefinition of ‘fdt_set_off_mem_rsvmap’
  257 | fdt_set_hdr_(off_mem_rsvmap);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_off_mem_rsvmap’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:242:1: note: in expansion of macro ‘__fdt_set_hdr’
  242 | __fdt_set_hdr(off_mem_rsvmap);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/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:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_version’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:243:1: note: in expansion of macro ‘__fdt_set_hdr’
  243 | __fdt_set_hdr(version);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 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);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_last_comp_version’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:244:1: note: in expansion of macro ‘__fdt_set_hdr’
  244 | __fdt_set_hdr(last_comp_version);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:260:1: error: redefinition of ‘fdt_set_boot_cpuid_phys’
  260 | fdt_set_hdr_(boot_cpuid_phys);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_boot_cpuid_phys’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:245:1: note: in expansion of macro ‘__fdt_set_hdr’
  245 | __fdt_set_hdr(boot_cpuid_phys);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:261:1: error: redefinition of ‘fdt_set_size_dt_strings’
  261 | fdt_set_hdr_(size_dt_strings);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_size_dt_strings’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:246:1: note: in expansion of macro ‘__fdt_set_hdr’
  246 | __fdt_set_hdr(size_dt_strings);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:262:1: error: redefinition of ‘fdt_set_size_dt_struct’
  262 | fdt_set_hdr_(size_dt_struct);
      | ^~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:233:21: note: previous definition of ‘fdt_set_size_dt_struct’ was here
  233 |  static inline void fdt_set_##name(void *fdt, uint32_t val) \
      |                     ^~~~~~~~
tools/../include/libfdt.h:247:1: note: in expansion of macro ‘__fdt_set_hdr’
  247 | __fdt_set_hdr(size_dt_struct);
      | ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:381:24: error: static declaration of ‘fdt_get_max_phandle’ follows non-static declaration
  381 | static inline uint32_t fdt_get_max_phandle(const void *fdt)
      |                        ^~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:318:10: note: previous declaration of ‘fdt_get_max_phandle’ was here
  318 | uint32_t fdt_get_max_phandle(const void *fdt);
      |          ^~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:638:28: error: conflicting types for ‘fdt_get_property_by_offset’
  638 | const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:543:28: note: previous declaration of ‘fdt_get_property_by_offset’ was here
  543 | const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:654:28: error: conflicting types for ‘fdt_get_property_namelen’
  654 | const struct fdt_property *fdt_get_property_namelen(const void *fdt,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:558:28: note: previous declaration of ‘fdt_get_property_namelen’ was here
  558 | const struct fdt_property *fdt_get_property_namelen(const void *fdt,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:688:28: error: conflicting types for ‘fdt_get_property’
  688 | const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
      |                            ^~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:591:28: note: previous declaration of ‘fdt_get_property’ was here
  591 | const struct fdt_property *fdt_get_property(const void *fdt, int nodeoffset,
      |                            ^~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:690:36: error: conflicting types for ‘fdt_get_property_w’
  690 | static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
      |                                    ^~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:593:36: note: previous definition of ‘fdt_get_property_w’ was here
  593 | static inline struct fdt_property *fdt_get_property_w(void *fdt, int nodeoffset,
      |                                    ^~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:748:21: error: redefinition of ‘fdt_getprop_namelen_w’
  748 | static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
      |                     ^~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:648:21: note: previous definition of ‘fdt_getprop_namelen_w’ was here
  648 | static inline void *fdt_getprop_namelen_w(void *fdt, int nodeoffset,
      |                     ^~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:787:21: error: redefinition of ‘fdt_getprop_w’
  787 | static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
      |                     ^~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:686:21: note: previous definition of ‘fdt_getprop_w’ was here
  686 | static inline void *fdt_getprop_w(void *fdt, int nodeoffset,
      |                     ^~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1285:19: error: redefinition of ‘fdt_setprop_inplace_u32’
 1285 | static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1178:19: note: previous definition of ‘fdt_setprop_inplace_u32’ was here
 1178 | static inline int fdt_setprop_inplace_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1320:19: error: redefinition of ‘fdt_setprop_inplace_u64’
 1320 | static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1213:19: note: previous definition of ‘fdt_setprop_inplace_u64’ was here
 1213 | static inline int fdt_setprop_inplace_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1332:19: error: redefinition of ‘fdt_setprop_inplace_cell’
 1332 | static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1225:19: note: previous definition of ‘fdt_setprop_inplace_cell’ was here
 1225 | static inline int fdt_setprop_inplace_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1436:19: error: redefinition of ‘fdt_property_u32’
 1436 | static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
      |                   ^~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1291:19: note: previous definition of ‘fdt_property_u32’ was here
 1291 | static inline int fdt_property_u32(void *fdt, const char *name, uint32_t val)
      |                   ^~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1441:19: error: redefinition of ‘fdt_property_u64’
 1441 | static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
      |                   ^~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1296:19: note: previous definition of ‘fdt_property_u64’ was here
 1296 | static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
      |                   ^~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1448:19: error: redefinition of ‘fdt_property_cell’
 1448 | static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
      |                   ^~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1301:19: note: previous definition of ‘fdt_property_cell’ was here
 1301 | static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
      |                   ^~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1646:19: error: redefinition of ‘fdt_setprop_u32’
 1646 | static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1467:19: note: previous definition of ‘fdt_setprop_u32’ was here
 1467 | static inline int fdt_setprop_u32(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1681:19: error: redefinition of ‘fdt_setprop_u64’
 1681 | static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1502:19: note: previous definition of ‘fdt_setprop_u64’ was here
 1502 | static inline int fdt_setprop_u64(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1693:19: error: redefinition of ‘fdt_setprop_cell’
 1693 | static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1514:19: note: previous definition of ‘fdt_setprop_cell’ was here
 1514 | static inline int fdt_setprop_cell(void *fdt, int nodeoffset, const char *name,
      |                   ^~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1818:19: error: redefinition of ‘fdt_appendprop_u32’
 1818 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1609:19: note: previous definition of ‘fdt_appendprop_u32’ was here
 1609 | static inline int fdt_appendprop_u32(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1853:19: error: redefinition of ‘fdt_appendprop_u64’
 1853 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1644:19: note: previous definition of ‘fdt_appendprop_u64’ was here
 1644 | static inline int fdt_appendprop_u64(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~
In file included from include/image.h:53,
                 from tools/aisimage.c:10:
/usr/include/libfdt.h:1865:19: error: redefinition of ‘fdt_appendprop_cell’
 1865 | static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~
In file included from tools/fdt_host.h:11,
                 from tools/imagetool.h:24,
                 from tools/aisimage.c:8:
tools/../include/libfdt.h:1656:19: note: previous definition of ‘fdt_appendprop_cell’ was here
 1656 | static inline int fdt_appendprop_cell(void *fdt, int nodeoffset,
      |                   ^~~~~~~~~~~~~~~~~~~
make[1]: *** [scripts/Makefile.host:116: tools/aisimage.o] Error 1
make: *** [Makefile:1234: tools] Error 2

So I was going to replace that one too, until...

 % grep -e "#include <libfdt.h>" -r
Duuma dosiero .git/objects/pack/pack-0bf96b2086b9af9f4bf9fb8e271daf25e195a3ed.pack kongruas
arch/arm/cpu/armv7/ls102xa/fdt.c:#include <libfdt.h>
arch/arm/cpu/armv7/mx6/litesom.c:#include <libfdt.h>
arch/arm/cpu/armv7/mx6/opos6ul.c:#include <libfdt.h>
arch/arm/cpu/armv7/virt-dt.c:#include <libfdt.h>
arch/arm/cpu/armv8/fsl-layerscape/fdt.c:#include <libfdt.h>
arch/arm/cpu/armv8/spin_table.c:#include <libfdt.h>
arch/arm/lib/bootm.c:#include <libfdt.h>
arch/arm/lib/psci-dt.c:#include <libfdt.h>
arch/arm/mach-meson/board.c:#include <libfdt.h>
arch/arm/mach-mvebu/arm64-common.c:#include <libfdt.h>
arch/arm/mach-mvebu/armada3700/cpu.c:#include <libfdt.h>
arch/arm/mach-mvebu/armada8k/cpu.c:#include <libfdt.h>
arch/arm/mach-omap2/omap5/fdt.c:#include <libfdt.h>
arch/arm/mach-socfpga/misc.c:#include <libfdt.h>
arch/arm/mach-uniphier/board_init.c:#include <libfdt.h>
arch/arm/mach-uniphier/board_late_init.c:#include <libfdt.h>
arch/arm/mach-uniphier/boards.c:#include <libfdt.h>
arch/powerpc/cpu/mpc512x/pci.c:#include <libfdt.h>
arch/powerpc/cpu/mpc5xxx/cpu.c:#include <libfdt.h>
arch/powerpc/cpu/mpc8260/cpu.c:#include <libfdt.h>
arch/powerpc/cpu/mpc8260/pci.c:#include <libfdt.h>
arch/powerpc/cpu/mpc83xx/cpu.c:#include <libfdt.h>
arch/powerpc/cpu/mpc83xx/fdt.c:#include <libfdt.h>
arch/powerpc/cpu/mpc83xx/pci.c:#include <libfdt.h>
arch/powerpc/cpu/mpc85xx/fdt.c:#include <libfdt.h>
arch/powerpc/cpu/mpc85xx/liodn.c:#include <libfdt.h>
arch/powerpc/cpu/mpc85xx/portals.c:#include <libfdt.h>
arch/powerpc/cpu/mpc86xx/fdt.c:#include <libfdt.h>
arch/powerpc/cpu/mpc8xx/cpu.c:#include <libfdt.h>
arch/powerpc/cpu/mpc8xx/fdt.c:#include <libfdt.h>
arch/powerpc/cpu/mpc8xxx/fdt.c:#include <libfdt.h>
arch/powerpc/cpu/ppc4xx/fdt.c:#include <libfdt.h>
arch/powerpc/lib/bootm.c:#include <libfdt.h>
arch/sandbox/cpu/cpu.c:#include <libfdt.h>
arch/x86/cpu/intel_common/microcode.c:#include <libfdt.h>
board/Arcturus/ucp1020/ucp1020.c:#include <libfdt.h>
board/a4m072/a4m072.c:#include <libfdt.h>
board/amcc/canyonlands/canyonlands.c:#include <libfdt.h>
board/amcc/katmai/katmai.c:#include <libfdt.h>
board/amcc/kilauea/kilauea.c:#include <libfdt.h>
board/amcc/makalu/makalu.c:#include <libfdt.h>
board/amcc/sequoia/sequoia.c:#include <libfdt.h>
board/amcc/yosemite/yosemite.c:#include <libfdt.h>
board/armltd/vexpress/vexpress_tc2.c:#include <libfdt.h>
board/cm5200/cm5200.c:#include <libfdt.h>
board/congatec/cgtqmx6eval/cgtqmx6eval.c:#include <libfdt.h>
board/el/el6x/el6x.c:#include <libfdt.h>
board/engicam/geam6ul/geam6ul.c:#include <libfdt.h>
board/engicam/icorem6/icorem6.c:#include <libfdt.h>
board/engicam/icorem6_rqs/icorem6_rqs.c:#include <libfdt.h>
board/engicam/isiotmx6ul/isiotmx6ul.c:#include <libfdt.h>
board/esd/cpci405/cpci405.c:#include <libfdt.h>
board/esd/pmc405de/pmc405de.c:#include <libfdt.h>
board/esd/pmc440/pmc440.c:#include <libfdt.h>
board/esd/vme8349/vme8349.c:#include <libfdt.h>
board/freescale/b4860qds/pci.c:#include <libfdt.h>
board/freescale/bsc9131rdb/bsc9131rdb.c:#include <libfdt.h>
board/freescale/bsc9132qds/bsc9132qds.c:#include <libfdt.h>
board/freescale/c29xpcie/c29xpcie.c:#include <libfdt.h>
board/freescale/common/cds_pci_ft.c:#include <libfdt.h>
board/freescale/common/fman.c:#include <libfdt.h>
board/freescale/common/p_corenet/pci.c:#include <libfdt.h>
board/freescale/common/sgmii_riser.c:#include <libfdt.h>
board/freescale/ls1043aqds/eth.c:#include <libfdt.h>
board/freescale/ls2080a/ls2080a.c:#include <libfdt.h>
board/freescale/ls2080aqds/ls2080aqds.c:#include <libfdt.h>
board/freescale/ls2080ardb/ls2080ardb.c:#include <libfdt.h>
board/freescale/mpc8308rdb/mpc8308rdb.c:#include <libfdt.h>
board/freescale/mpc8313erdb/mpc8313erdb.c:#include <libfdt.h>
board/freescale/mpc8315erdb/mpc8315erdb.c:#include <libfdt.h>
board/freescale/mpc8323erdb/mpc8323erdb.c:#include <libfdt.h>
board/freescale/mpc832xemds/mpc832xemds.c:#include <libfdt.h>
board/freescale/mpc8349emds/mpc8349emds.c:#include <libfdt.h>
board/freescale/mpc8349itx/mpc8349itx.c:#include <libfdt.h>
board/freescale/mpc837xemds/mpc837xemds.c:#include <libfdt.h>
board/freescale/mpc8536ds/mpc8536ds.c:#include <libfdt.h>
board/freescale/mpc8540ads/mpc8540ads.c:#include <libfdt.h>
board/freescale/mpc8541cds/mpc8541cds.c:#include <libfdt.h>
board/freescale/mpc8544ds/mpc8544ds.c:#include <libfdt.h>
board/freescale/mpc8548cds/mpc8548cds.c:#include <libfdt.h>
board/freescale/mpc8555cds/mpc8555cds.c:#include <libfdt.h>
board/freescale/mpc8560ads/mpc8560ads.c:#include <libfdt.h>
board/freescale/mpc8568mds/mpc8568mds.c:#include <libfdt.h>
board/freescale/mpc8569mds/mpc8569mds.c:#include <libfdt.h>
board/freescale/mpc8572ds/mpc8572ds.c:#include <libfdt.h>
board/freescale/mpc8610hpcd/mpc8610hpcd.c:#include <libfdt.h>
board/freescale/mpc8641hpcn/mpc8641hpcn.c:#include <libfdt.h>
board/freescale/mx6sabresd/mx6sabresd.c:#include <libfdt.h>
board/freescale/mx6slevk/mx6slevk.c:#include <libfdt.h>
board/freescale/mx6sxsabresd/mx6sxsabresd.c:#include <libfdt.h>
board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c:#include <libfdt.h>
board/freescale/p1010rdb/p1010rdb.c:#include <libfdt.h>
board/freescale/p1022ds/p1022ds.c:#include <libfdt.h>
board/freescale/p1023rdb/p1023rdb.c:#include <libfdt.h>
board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c:#include <libfdt.h>
board/freescale/p1_twr/p1_twr.c:#include <libfdt.h>
board/freescale/qemu-ppce500/qemu-ppce500.c:#include <libfdt.h>
board/freescale/t102xqds/pci.c:#include <libfdt.h>
board/freescale/t102xrdb/pci.c:#include <libfdt.h>
board/freescale/t1040qds/pci.c:#include <libfdt.h>
board/freescale/t104xrdb/pci.c:#include <libfdt.h>
board/freescale/t208xqds/pci.c:#include <libfdt.h>
board/freescale/t208xrdb/pci.c:#include <libfdt.h>
board/freescale/t4qds/pci.c:#include <libfdt.h>
board/freescale/t4rdb/pci.c:#include <libfdt.h>
board/gdsys/405ex/io64.c:#include <libfdt.h>
board/gdsys/intip/intip.c:#include <libfdt.h>
board/gdsys/mpc8308/hrcon.c:#include <libfdt.h>
board/gdsys/mpc8308/strider.c:#include <libfdt.h>
board/gdsys/p1022/controlcenterd.c:#include <libfdt.h>
board/ids/ids8313/ids8313.c:#include <libfdt.h>
board/ifm/o2dnt2/o2dnt2.c:#include <libfdt.h>
board/intercontrol/digsy_mtc/digsy_mtc.c:#include <libfdt.h>
board/ipek01/ipek01.c:#include <libfdt.h>
board/jupiter/jupiter.c:#include <libfdt.h>
board/keymile/km82xx/km82xx.c:#include <libfdt.h>
board/keymile/km83xx/km83xx.c:#include <libfdt.h>
board/keymile/kmp204x/pci.c:#include <libfdt.h>
board/mosaixtech/icon/icon.c:#include <libfdt.h>
board/motionpro/motionpro.c:#include <libfdt.h>
board/mpc8308_p1m/mpc8308_p1m.c:#include <libfdt.h>
board/phytec/pcm058/pcm058.c:#include <libfdt.h>
board/sbc8349/sbc8349.c:#include <libfdt.h>
board/sbc8548/sbc8548.c:#include <libfdt.h>
board/sbc8641d/sbc8641d.c:#include <libfdt.h>
board/socrates/socrates.c:#include <libfdt.h>
board/sunxi/board.c:#include <libfdt.h>
board/t3corp/t3corp.c:#include <libfdt.h>
board/toradex/apalis_imx6/apalis_imx6.c:#include <libfdt.h>
board/toradex/colibri_imx6/colibri_imx6.c:#include <libfdt.h>
board/toradex/common/tdx-common.c:#include <libfdt.h>
board/tqc/tqm5200/tqm5200.c:#include <libfdt.h>
board/tqc/tqm8xx/tqm8xx.c:#include <libfdt.h>
board/tqc/tqma6/tqma6.c:#include <libfdt.h>
board/tqc/tqma6/tqma6_mba6.c:#include <libfdt.h>
board/tqc/tqma6/tqma6_wru4.c:#include <libfdt.h>
board/udoo/neo/neo.c:#include <libfdt.h>
board/varisys/cyrus/pci.c:#include <libfdt.h>
board/ve8313/ve8313.c:#include <libfdt.h>
board/vscom/baltos/board.c:#include <libfdt.h>
board/xes/common/fsl_8xxx_pci.c:#include <libfdt.h>
board/xes/xpedite520x/xpedite520x.c:#include <libfdt.h>
board/xes/xpedite537x/xpedite537x.c:#include <libfdt.h>
board/xes/xpedite550x/xpedite550x.c:#include <libfdt.h>
cmd/bootefi.c:#include <libfdt.h>
cmd/fdt.c:#include <libfdt.h>
common/board_info.c:#include <libfdt.h>
common/bootm_os.c:#include <libfdt.h>
common/bootstage.c:#include <libfdt.h>
common/fdt_support.c:#include <libfdt.h>
common/image-fdt.c:#include <libfdt.h>
common/image.c:#include <libfdt.h>
common/lcd_simplefb.c:#include <libfdt.h>
common/spl/spl_fat.c:#include <libfdt.h>
common/spl/spl_fit.c:#include <libfdt.h>
common/spl/spl_net.c:#include <libfdt.h>
common/spl/spl_ram.c:#include <libfdt.h>
common/spl/spl_ymodem.c:#include <libfdt.h>
drivers/core/regmap.c:#include <libfdt.h>
drivers/core/root.c:#include <libfdt.h>
drivers/core/util.c:#include <libfdt.h>
drivers/crypto/fsl/sec.c:#include <libfdt.h>
drivers/firmware/psci.c:#include <libfdt.h>
drivers/mmc/exynos_dw_mmc.c:#include <libfdt.h>
drivers/mmc/rockchip_sdhci.c:#include <libfdt.h>
drivers/mmc/s5p_sdhci.c:#include <libfdt.h>
drivers/mmc/socfpga_dw_mmc.c:#include <libfdt.h>
drivers/mmc/xenon_sdhci.c:#include <libfdt.h>
drivers/mmc/zynq_sdhci.c:#include <libfdt.h>
drivers/net/fsl-mc/mc.c:#include <libfdt.h>
drivers/pci/fsl_pci_init.c:#include <libfdt.h>
drivers/pci/pci-emul-uclass.c:#include <libfdt.h>
drivers/pci/pcie_layerscape_fixup.c:#include <libfdt.h>
drivers/pci/tsi108_pci.c:#include <libfdt.h>
drivers/pinctrl/pinctrl-single.c:#include <libfdt.h>
drivers/pinctrl/pinctrl-uclass.c:#include <libfdt.h>
drivers/power/pmic/act8846.c:#include <libfdt.h>
drivers/power/pmic/rk808.c:#include <libfdt.h>
drivers/power/pmic/rn5t567.c:#include <libfdt.h>
drivers/power/regulator/pwm_regulator.c:#include <libfdt.h>
drivers/qe/fdt.c:#include <libfdt.h>
drivers/sound/sound-i2s.c:#include <libfdt.h>
drivers/usb/common/common.c:#include <libfdt.h>
drivers/usb/host/ehci-exynos.c:#include <libfdt.h>
drivers/usb/host/ehci-msm.c:#include <libfdt.h>
drivers/usb/host/ehci-tegra.c:#include <libfdt.h>
drivers/usb/host/ehci-vf.c:#include <libfdt.h>
drivers/usb/host/xhci-exynos5.c:#include <libfdt.h>
drivers/usb/host/xhci-rockchip.c:#include <libfdt.h>
drivers/usb/phy/rockchip_usb2_phy.c:#include <libfdt.h>
drivers/video/exynos/exynos_dp.c:#include <libfdt.h>
drivers/video/exynos/exynos_dp_lowlevel.c:#include <libfdt.h>
drivers/video/exynos/exynos_fb.c:#include <libfdt.h>
drivers/video/exynos/exynos_mipi_dsi.c:#include <libfdt.h>
include/fdt_support.h:#include <libfdt.h>
include/fdtdec.h:#include <libfdt.h>
include/image.h:#include <libfdt.h>
lib/fdtdec.c:#include <libfdt.h>
lib/fdtdec_common.c:#include <libfdt.h>
lib/fdtdec_test.c:#include <libfdt.h>
lib/libfdt/fdt.c:#include <libfdt.h>
lib/libfdt/fdt_addresses.c:#include <libfdt.h>
lib/libfdt/fdt_empty_tree.c:#include <libfdt.h>
lib/libfdt/fdt_overlay.c:#include <libfdt.h>
lib/libfdt/fdt_region.c:#include <libfdt.h>
lib/libfdt/fdt_ro.c:#include <libfdt.h>
lib/libfdt/fdt_rw.c:#include <libfdt.h>
lib/libfdt/fdt_strerror.c:#include <libfdt.h>
lib/libfdt/fdt_sw.c:#include <libfdt.h>
lib/libfdt/fdt_wip.c:#include <libfdt.h>
tools/dtoc/dtoc.py:        self.Out('#include <libfdt.h>\n')
tools/ifdtool.c:#include <libfdt.h>

Hmm, yeah, I wasn't going for elegant, but this would just be a bit too unelegant to replace every single one of these. So, I will try to push on in finding an automatic solution.

happysmash27 commented 3 years ago

I have tried moving the -I option from line 249 to 248, to put it as early as possible. It did not seem to help.

happysmash27 commented 3 years ago

I have now reversed this change.

happysmash27 commented 3 years ago

I have now changed the section to be:

HOST_EXTRACFLAGS += -I$(srctree)/include \
        -include $(srctree)/include/libfdt_env.h \
        -include $(srctree)/include/libfdt.h \
        $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
        -I$(srctree)/tools \
        -DUSE_HOSTCC \
        -D__KERNEL_STRICT_NAMES \
        -D_GNU_SOURCE
$(info $$HOST_EXTRACFLAGS is [${HOST_EXTRACFLAGS}])

For better debugging.

Interestingly enough, this changes the error output to be in colour when it was not before!

The error output (without colour, since GitHub doesn't support it) is now:

 % make
*** Your GCC is older than 6.0 and will not be supported starting in v2018.01.
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CC      lib/asm-offsets.s
  CHK     include/generated/generic-asm-offsets.h
  CC      arch/arm/lib/asm-offsets.s
  CHK     include/generated/asm-offsets.h
$HOST_EXTRACFLAGS is [-I./include -include ./include/libfdt_env.h -include ./include/libfdt.h -idirafterinclude -idirafter./arch/arm/include -I./tools -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE]
  HOSTCC  tools/gen_eth_addr
In file included from ././include/libfdt.h:54,
                 from <command-line>:
/usr/include/libfdt_env.h:27:30: error: conflicting types for ‘fdt64_t’
   27 | typedef uint64_t FDT_BITWISE fdt64_t;
      |                              ^~~~~~~
In file included from <command-line>:
././include/libfdt_env.h:19:16: note: previous declaration of ‘fdt64_t’ was here
   19 | typedef __be64 fdt64_t;
      |                ^~~~~~~
In file included from ././include/libfdt_env.h:12,
                 from <command-line>:
/usr/include/libfdt_env.h:47:24: error: expected ‘)’ before ‘x’
   47 | static inline uint32_t fdt32_to_cpu(fdt32_t x)
      |                        ^~~~~~~~~~~~
././include/compiler.h:71:9: error: expected ‘)’ before ‘&’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |         ^
././include/compiler.h:71:23: error: expected ‘)’ before ‘>>’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                       ^~
././include/compiler.h:71:30: error: expected ‘)’ before ‘|’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                              ^
/usr/include/libfdt_env.h:51:23: error: expected ‘)’ before ‘x’
   51 | static inline fdt32_t cpu_to_fdt32(uint32_t x)
      |                       ^~~~~~~~~~~~
././include/compiler.h:71:9: error: expected ‘)’ before ‘&’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |         ^
././include/compiler.h:71:23: error: expected ‘)’ before ‘>>’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                       ^~
././include/compiler.h:71:30: error: expected ‘)’ before ‘|’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                              ^
/usr/include/libfdt_env.h:56:24: error: expected ‘)’ before ‘x’
   56 | static inline uint64_t fdt64_to_cpu(fdt64_t x)
      |                        ^~~~~~~~~~~~
././include/compiler.h:76:9: error: expected ‘)’ before ‘&’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |         ^
././include/compiler.h:76:36: error: expected ‘)’ before ‘>>’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                    ^~
././include/compiler.h:76:43: error: expected ‘)’ before ‘|’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                           ^
/usr/include/libfdt_env.h:60:23: error: expected ‘)’ before ‘x’
   60 | static inline fdt64_t cpu_to_fdt64(uint64_t x)
      |                       ^~~~~~~~~~~~
././include/compiler.h:76:9: error: expected ‘)’ before ‘&’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |         ^
././include/compiler.h:76:36: error: expected ‘)’ before ‘>>’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                    ^~
././include/compiler.h:76:43: error: expected ‘)’ before ‘|’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                           ^
In file included from <command-line>:
././include/libfdt.h:238:21: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  238 | __fdt_set_hdr(magic);
      |                     ^
././include/libfdt.h:239:25: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  239 | __fdt_set_hdr(totalsize);
      |                         ^
././include/libfdt.h:240:29: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  240 | __fdt_set_hdr(off_dt_struct);
      |                             ^
././include/libfdt.h:241:30: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  241 | __fdt_set_hdr(off_dt_strings);
      |                              ^
././include/libfdt.h:242:30: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  242 | __fdt_set_hdr(off_mem_rsvmap);
      |                              ^
././include/libfdt.h:243:23: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  243 | __fdt_set_hdr(version);
      |                       ^
././include/libfdt.h:244:33: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  244 | __fdt_set_hdr(last_comp_version);
      |                                 ^
././include/libfdt.h:245:31: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  245 | __fdt_set_hdr(boot_cpuid_phys);
      |                               ^
././include/libfdt.h:246:31: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  246 | __fdt_set_hdr(size_dt_strings);
      |                               ^
././include/libfdt.h:247:30: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  247 | __fdt_set_hdr(size_dt_struct);
      |                              ^
make[1]: *** [scripts/Makefile.host:99: tools/gen_eth_addr] Error 1
make: *** [Makefile:1234: tools] Error 2

I am going to try adding debug lines to see where exactly this error occurs so that I can see if the line is not being included, or if it is.

happysmash27 commented 3 years ago

I have now added $(info $$hostc_flags is [${hostc_flags}]) under line 87 in scripts/Makefile.host (which I found by using grep to track down all instances variables which use HOST_EXTRACFLAGS, all variables which use that variable, etc). This results in the following output:

 % make
*** Your GCC is older than 6.0 and will not be supported starting in v2018.01.
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
$hostc_flags is [-Wp,-MD,..d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer     ]
  CC      lib/asm-offsets.s
  CHK     include/generated/generic-asm-offsets.h
  CC      arch/arm/lib/asm-offsets.s
  CHK     include/generated/asm-offsets.h
$hostc_flags is [-Wp,-MD,..d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer     ]
$HOST_EXTRACFLAGS is [-I./include -include ./include/libfdt_env.h -include ./include/libfdt.h -idirafterinclude -idirafter./arch/arm/include -I./tools -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE]
$hostc_flags is [-Wp,-MD,..d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer    -I./include -include ./include/libfdt_env.h -include ./include/libfdt.h -idirafterinclude -idirafter./arch/arm/include -I./tools -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -D_GNU_SOURCE ]
  HOSTCC  tools/gen_eth_addr
In file included from ././include/libfdt.h:54,
                 from <command-line>:
/usr/include/libfdt_env.h:27:30: error: conflicting types for ‘fdt64_t’
   27 | typedef uint64_t FDT_BITWISE fdt64_t;
      |                              ^~~~~~~
In file included from <command-line>:
././include/libfdt_env.h:19:16: note: previous declaration of ‘fdt64_t’ was here
   19 | typedef __be64 fdt64_t;
      |                ^~~~~~~
In file included from ././include/libfdt_env.h:12,
                 from <command-line>:
/usr/include/libfdt_env.h:47:24: error: expected ‘)’ before ‘x’
   47 | static inline uint32_t fdt32_to_cpu(fdt32_t x)
      |                        ^~~~~~~~~~~~
././include/compiler.h:71:9: error: expected ‘)’ before ‘&’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |         ^
././include/compiler.h:71:23: error: expected ‘)’ before ‘>>’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                       ^~
././include/compiler.h:71:30: error: expected ‘)’ before ‘|’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                              ^
/usr/include/libfdt_env.h:51:23: error: expected ‘)’ before ‘x’
   51 | static inline fdt32_t cpu_to_fdt32(uint32_t x)
      |                       ^~~~~~~~~~~~
././include/compiler.h:71:9: error: expected ‘)’ before ‘&’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |         ^
././include/compiler.h:71:23: error: expected ‘)’ before ‘>>’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                       ^~
././include/compiler.h:71:30: error: expected ‘)’ before ‘|’ token
   71 |  ((((x) & 0xff000000) >> 24) | \
      |                              ^
/usr/include/libfdt_env.h:56:24: error: expected ‘)’ before ‘x’
   56 | static inline uint64_t fdt64_to_cpu(fdt64_t x)
      |                        ^~~~~~~~~~~~
././include/compiler.h:76:9: error: expected ‘)’ before ‘&’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |         ^
././include/compiler.h:76:36: error: expected ‘)’ before ‘>>’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                    ^~
././include/compiler.h:76:43: error: expected ‘)’ before ‘|’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                           ^
/usr/include/libfdt_env.h:60:23: error: expected ‘)’ before ‘x’
   60 | static inline fdt64_t cpu_to_fdt64(uint64_t x)
      |                       ^~~~~~~~~~~~
././include/compiler.h:76:9: error: expected ‘)’ before ‘&’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |         ^
././include/compiler.h:76:36: error: expected ‘)’ before ‘>>’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                    ^~
././include/compiler.h:76:43: error: expected ‘)’ before ‘|’ token
   76 |  ((((x) & 0xff00000000000000##sfx) >> 56) | \
      |                                           ^
In file included from <command-line>:
././include/libfdt.h:238:21: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  238 | __fdt_set_hdr(magic);
      |                     ^
././include/libfdt.h:239:25: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  239 | __fdt_set_hdr(totalsize);
      |                         ^
././include/libfdt.h:240:29: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  240 | __fdt_set_hdr(off_dt_struct);
      |                             ^
././include/libfdt.h:241:30: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  241 | __fdt_set_hdr(off_dt_strings);
      |                              ^
././include/libfdt.h:242:30: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  242 | __fdt_set_hdr(off_mem_rsvmap);
      |                              ^
././include/libfdt.h:243:23: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  243 | __fdt_set_hdr(version);
      |                       ^
././include/libfdt.h:244:33: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  244 | __fdt_set_hdr(last_comp_version);
      |                                 ^
././include/libfdt.h:245:31: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  245 | __fdt_set_hdr(boot_cpuid_phys);
      |                               ^
././include/libfdt.h:246:31: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  246 | __fdt_set_hdr(size_dt_strings);
      |                               ^
././include/libfdt.h:247:30: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic]
  247 | __fdt_set_hdr(size_dt_struct);
      |                              ^
make[1]: *** [scripts/Makefile.host:100: tools/gen_eth_addr] Error 1
make: *** [Makefile:1234: tools] Error 2
JunJianX commented 2 years ago

sudo apt-get purge -y --auto-remove libfdt-dev command will fix this issue. It is version related, you should not get these errors with the latest libfdt-dev package.

danwood76 commented 1 year ago

For anyone facing this issue but needing libfdt-dev or dtc installed in system (like I do).

Copying "fdt.h" "libfdt.h" and "libfdt_env.h" from include/ to lib/libfdt/ fixed the build errors as it was then using the local fdt headers rather than system versions.

Later versions of u-boot have all of these headers included in a single folder which is why this issue doesn't occur in the later versions.