New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 891103 link

Starred by 2 users

Issue metadata

Status: Fixed
Merged: issue 837018
Owner:
Closed: Oct 8
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug

Blocked on:
issue 890858



Sign in to add a comment

beaglebone-release fails: u-boot fails to build, with fdt header errors

Project Member Reported by briannorris@chromium.org, Oct 2

Issue description

It's failed for several days now:

https://cros-goldeneye.corp.google.com/chromeos/legoland/builderHistory?buildConfig=beaglebone-release&buildBranch=master

u-boot-2013.07-r10: In file included from ../include/libfdt.h:54:0,
u-boot-2013.07-r10:                  from fdt_host.h:24,
u-boot-2013.07-r10:                  from mkimage.h:35,
u-boot-2013.07-r10:                  from aisimage.c:27:
u-boot-2013.07-r10: /usr/include/libfdt_env.h:71:30: error: conflicting types for 'fdt64_t'
u-boot-2013.07-r10:  typedef uint64_t FDT_BITWISE fdt64_t;
u-boot-2013.07-r10:                               ^
u-boot-2013.07-r10: In file included from <command-line>:0:0:
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/libfdt_env.h:31:16: note: previous declaration of 'fdt64_t' was here
u-boot-2013.07-r10:  typedef __be64 fdt64_t;
u-boot-2013.07-r10:                 ^
u-boot-2013.07-r10: In file included from /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/libfdt_env.h:24:0,
u-boot-2013.07-r10:                  from <command-line>:0:
u-boot-2013.07-r10: /usr/include/libfdt_env.h:91:24: error: expected ')' before 'x'
u-boot-2013.07-r10:  static inline uint32_t fdt32_to_cpu(fdt32_t x)
u-boot-2013.07-r10:                         ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:61:9: error: expected ')' before '&' token
u-boot-2013.07-r10:   ((((x) & 0xff000000) >> 24) | \
u-boot-2013.07-r10:          ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:61:23: error: expected ')' before '>>' token
u-boot-2013.07-r10:   ((((x) & 0xff000000) >> 24) | \
u-boot-2013.07-r10:                        ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:61:30: error: expected ')' before '|' token
u-boot-2013.07-r10:   ((((x) & 0xff000000) >> 24) | \
u-boot-2013.07-r10:                               ^
u-boot-2013.07-r10: /usr/include/libfdt_env.h:95:23: error: expected ')' before 'x'
u-boot-2013.07-r10:  static inline fdt32_t cpu_to_fdt32(uint32_t x)
u-boot-2013.07-r10:                        ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:61:9: error: expected ')' before '&' token
u-boot-2013.07-r10:   ((((x) & 0xff000000) >> 24) | \
u-boot-2013.07-r10:          ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:61:23: error: expected ')' before '>>' token
u-boot-2013.07-r10:   ((((x) & 0xff000000) >> 24) | \
u-boot-2013.07-r10:                        ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:61:30: error: expected ')' before '|' token
u-boot-2013.07-r10:   ((((x) & 0xff000000) >> 24) | \
u-boot-2013.07-r10:                               ^
u-boot-2013.07-r10: /usr/include/libfdt_env.h:100:24: error: expected ')' before 'x'
u-boot-2013.07-r10:  static inline uint64_t fdt64_to_cpu(fdt64_t x)
u-boot-2013.07-r10:                         ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:66:9: error: expected ')' before '&' token
u-boot-2013.07-r10:   ((((x) & 0xff00000000000000##sfx) >> 56) | \
u-boot-2013.07-r10:          ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:66:36: error: expected ')' before '>>' token
u-boot-2013.07-r10:   ((((x) & 0xff00000000000000##sfx) >> 56) | \
u-boot-2013.07-r10:                                     ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:66:43: error: expected ')' before '|' token
u-boot-2013.07-r10:   ((((x) & 0xff00000000000000##sfx) >> 56) | \
u-boot-2013.07-r10:                                            ^
u-boot-2013.07-r10: /usr/include/libfdt_env.h:104:23: error: expected ')' before 'x'
u-boot-2013.07-r10:  static inline fdt64_t cpu_to_fdt64(uint64_t x)
u-boot-2013.07-r10:                        ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:66:9: error: expected ')' before '&' token
u-boot-2013.07-r10:   ((((x) & 0xff00000000000000##sfx) >> 56) | \
u-boot-2013.07-r10:          ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:66:36: error: expected ')' before '>>' token
u-boot-2013.07-r10:   ((((x) & 0xff00000000000000##sfx) >> 56) | \
u-boot-2013.07-r10:                                     ^
u-boot-2013.07-r10: /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/compiler.h:66:43: error: expected ')' before '|' token
u-boot-2013.07-r10:   ((((x) & 0xff00000000000000##sfx) >> 56) | \
u-boot-2013.07-r10:                                            ^
u-boot-2013.07-r10: x86_64-pc-linux-gnu-gcc -g -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -include /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/libfdt_env.h -idirafter /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include -idirafter /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include2 -idirafter /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include -I /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/lib/libfdt -I /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/tools -DCONFIG_SYS_TEXT_BASE=0x80800000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -c -o image.o /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/common/image.c
u-boot-2013.07-r10: In file included from /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/image.h:65:0,
u-boot-2013.07-r10:                  from aisimage.c:29:
u-boot-2013.07-r10: /usr/include/libfdt.h:150:21: error: redefinition of 'fdt_offset_ptr_w'
u-boot-2013.07-r10:  static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
u-boot-2013.07-r10:                      ^
u-boot-2013.07-r10: In file included from fdt_host.h:24:0,
u-boot-2013.07-r10:                  from mkimage.h:35,
u-boot-2013.07-r10:                  from aisimage.c:27:
u-boot-2013.07-r10: ../include/libfdt.h:126:21: note: previous definition of 'fdt_offset_ptr_w' was here
u-boot-2013.07-r10:  static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
u-boot-2013.07-r10:                      ^
u-boot-2013.07-r10: In file included from /build/beaglebone/tmp/portage/sys-boot/u-boot-2013.07-r10/work/u-boot-2013.07/include/image.h:65:0,
u-boot-2013.07-r10:                  from aisimage.c:29:
u-boot-2013.07-r10: /usr/include/libfdt.h:258:1: error: redefinition of 'fdt_set_magic'
u-boot-2013.07-r10:  fdt_set_hdr_(magic);
u-boot-2013.07-r10:  ^
[...]

and a host of other failures.
 
Owner: sjg@chromium.org
Status: Assigned (was: Untriaged)
This looks like around the right time, and I think dtc provides some of these headers:

https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/1240693

Simon, could you take a look?
Mergedinto: 837018
Status: Duplicate (was: Assigned)
Cc: yamaguchi@chromium.org briannorris@chromium.org apronin@chromium.org
Labels: -Pri-3 Pri-1
Status: Assigned (was: Duplicate)
OK I will take a look.

I wonder what the purpose of the CQ is then :-)
There are certain build problems that can differ for incremental vs. full builds. I believe paladins might do incremental builds, which can mask some problems? I'm not sure the specifics of this problem yet, but this has definitely caused discrepancies before.
And it is somehow gone for CQ experimental builders in the very last build.
Same builders that failed in comment #5 pass now: 
https://luci-milo.appspot.com/buildbot/chromeos/capri-zfpga-paladin/1975
https://luci-milo.appspot.com/buildbot/chromeos/cobblepot-paladin/4490
https://luci-milo.appspot.com/buildbot/chromeos/romer-paladin/2912

I don't see any related changes in the list of CLs picked for this first green build. Am I right that no changes were made, and it is just the result of incremental builders resetting enough stuff to start passing again?

No green builds for beaglebone-release and beaglebone_servo-release, though. So, the original issue from this bug descr remains.
Blockedon: 890858
Hi, just to set expectations, I have no free time on my calendar today and am going away tomorrow until Sunday.

Is there something we can revert to fix this?

I only got as far as building for beaglebone, and could not replicate this error.
I managed to find 20mins to look at this.

The problem appears to be that u-boot-tools has been upgraded to 2018.07 (a recent version) but we still have extremely old versions of U-Boot in the tree.

Those old versions have a different libfdt_env.h which is not compatible with the new one:

old:
typedef __be64 fdt64_t;

new:
typedef uint64_t FDT_BITWISE fdt64_t;

but the real problem is that the header guards are different.

It might be enough to patch the header guard to be LIBFDT_ENV_H instead of _LIBFDT_ENV_H to match the new version.
Here is a change that seems to fix it for beaglebone:

https://chromium-review.googlesource.com/c/chromiumos/overlays/board-overlays/+/1259403

Re the other cases, do we have lots of uses of very old U-Boots? Who looks after these projects, and how come the CQ doesn't find them?
Several of those are internal projects, and I think their paladins are not marked as 'important'. But I don't believe the paladins failed anyway.

Some of these sorts of problems are caused by the difference between builders using prebuilts vs. rebuilds. If some other change causes rebuild, then you might discover a new problem. Or if you don't cause a rebuild in the CQ, then the rebuild that happens in the release builder might find it.

Talk to your Infra>Build team :)

Anyway, you're probably looking for loonix-u-boot as a possible update candidate. You might just fork a new bug (on b/ ?)for those team(s), if it's still a problem.
Cc: sjg@chromium.org yunlian@chromium.org
 Issue 892069  has been merged into this issue.
IIUC, it's this commit that fixed upstream:

commit b08c8c4870831c9315dcae237772238e80035bd5
Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Date:   Mon Mar 5 01:20:11 2018 +0900

    libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>
    
    Thomas reported U-Boot failed to build host tools if libfdt-devel
    package is installed because tools include libfdt headers from
    /usr/include/ instead of using internal ones.
    
    This commit moves the header code:
      include/libfdt.h         -> include/linux/libfdt.h
      include/libfdt_env.h     -> include/linux/libfdt_env.h
    
    and replaces include directives:
      #include <libfdt.h>      -> #include <linux/libfdt.h>
      #include <libfdt_env.h>  -> #include <linux/libfdt_env.h>
    
    Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
    Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


Given that, Simon tested that up-to-date U-Boot doesn't have this problem and by inspection it looks to me like they did indeed fix it, I think that's good enough and I'll nudge Simon's fix to land. Backporting that fix will be fairly noisy.
Project Member

Comment 17 by bugdroid1@chromium.org, Oct 5

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/4dd3e9b0a266b7e96547ea53259453ede7503b29

commit 4dd3e9b0a266b7e96547ea53259453ede7503b29
Author: Simon Glass <sjg@chromium.org>
Date: Fri Oct 05 22:43:54 2018

beaglebone: Update header guards to fix build error

The header guards changed in 2018. Update them so the we don't conflict
with the new u-boot-tools packages.

BUG= chromium:891103 
TEST=emerge-beaglebone u-boot

Change-Id: Ibca116e0f133f73acce5c6fdcb3d7e1665cda929
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1259403
Commit-Ready: Brian Norris <briannorris@chromium.org>
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[rename] https://crrev.com/4dd3e9b0a266b7e96547ea53259453ede7503b29/overlay-beaglebone/sys-boot/u-boot/u-boot-2013.07-r11.ebuild
[add] https://crrev.com/4dd3e9b0a266b7e96547ea53259453ede7503b29/overlay-beaglebone/sys-boot/u-boot/files/0001-Update-header-guard-for-libfdt_env.h.patch

Cc: yueherngl@chromium.org tbroch@chromium.org saklein@chromium.org
Status: Fixed (was: Assigned)
+ this week's sheriffs

I think this is Fixed. Not 100% sure about the internal projects, but I don't see their builders failing either. They can either adopt this solution or upgrade their U-Boot build if they're still having problems, IIUC.

Sign in to add a comment