Fuchsia build is fqiling on Mac (Big Sur)

136 views
Skip to first unread message

Vimal Kansal

unread,
Dec 15, 2020, 11:11:49 PM12/15/20
to discuss
Hi,
I am trying to build on Mac Big Sur, and getting following error :

fx build                                                                                                        

WARNING: Please opt in or out of fx metrics collection.

You will receive this warning until an option is selected.

To check what data we collect, run `fx metrics`

To opt in or out, run `fx metrics <enable|disable>


ninja: Entering directory `/Users/vimalkansal/fuchsia/out/default.zircon'

[2/11358] ACTION //kernel/lib/version:version-string.bin(//public/gn/toolchain:stub)

FAILED: kernel-version-string.bin 

/usr/bin/env ../../zircon/kernel/lib/version/git-version-string.sh kernel-version-string.bin ../.. true

[13/11358] CC host-x64-mac-clang/obj/ABS_PATH/Users/vimalkansal/fuchsia/third_party/boringssl/src/crypto/fipsmodule/aes/libboringssl.aes_nohw.c.o

ninja: build stopped: subcommand failed.

Hint: run `fx build` with the option `--log LOGFILE` to generate a debug log if you are reporting a bug.

Can somebody please help ?

Shai Barack

unread,
Dec 16, 2020, 4:48:51 AM12/16/20
to Vimal Kansal, Roland McGrath, discuss
Oh uh! I suspect that a recent change to how we generate the kernel version string broke you. +Roland McGrath FYI
Could you help us troubleshoot your issue? It didn't fail any of our commit queue checks, including ones that run on Macs.

From the root of your Fuchsia checkout, please run the following command:
bash --verbose zircon/kernel/lib/version/git-version-string.sh kernel-version-string.bin . true

Please report back with the output. Thanks!

--
All posts must follow the Fuchsia Code of Conduct https://fuchsia.dev/fuchsia-src/CODE_OF_CONDUCT or may be removed.
---
You received this message because you are subscribed to the Google Groups "discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@fuchsia.dev.
To view this discussion on the web visit https://groups.google.com/a/fuchsia.dev/d/msgid/discuss/25ac1469-2c1f-4214-8ec5-70430ad3c0a9n%40fuchsia.dev.

Gabriel Kerneis

unread,
Dec 16, 2020, 4:48:51 AM12/16/20
to Vimal Kansal, discuss


Hi,

Le mer. 16 déc. 2020 à 05:11, Vimal Kansal <vimal.k...@gmail.com> a écrit :

Hint: run `fx build` with the option `--log LOGFILE` to generate a debug log if you are reporting a bug.


Can you follow this hint to provide a more detailed log of errors please? The summary you posted doesn't contain the actual failure I think. Also consider reporting the bug on https://bugs.fuchsia.dev/p/fuchsia/issues/entry.

Thanks!
Gabriel

Roland McGrath

unread,
Dec 16, 2020, 4:13:38 PM12/16/20
to Shai Barack, Vimal Kansal, discuss
It may be relevant to run the script more precisely how the build runs it, which is from the build directory rather than the source directory.
I'd recommend:

$ cd out/default.zircon
$ bash -x ../../zircon/kernel/lib/version/git-version-string.sh kernel-version-string.bin ../.. true

The full output from that will probably give me an idea what went wrong or at least what troubleshooting steps to recommend next.

Thanks,
Roland

Shai Barack

unread,
Dec 16, 2020, 11:34:13 PM12/16/20
to Vimal Kansal, discuss, Roland McGrath
That last line that consists of just <"$OUTFILE" looks funny. Are you sure it's not a copy-paste error?
Anyway, I don't see the problem based on either output that you provided (the --verbose version or the -x version). I don't understand why the action is failing, but maybe I'm missing something and someone smarter than me on this thread could figure it out.

On Wed, Dec 16, 2020 at 6:43 PM Vimal Kansal <vimal.k...@gmail.com> wrote:
I get this :

(base) vimalkansal@Vimals-MBP fuchsia % bash --verbose zircon/kernel/lib/version/git-version-string.sh kernel-version-string.bin . true

#!/bin/bash


# Copyright 2016 The Fuchsia Authors

# Copyright (c) 2015 Travis Geiselbrecht

#

# Use of this source code is governed by a MIT-style

# license that can be found in the LICENSE file or at

# https://opensource.org/licenses/MIT


readonly OUTFILE="$1"

readonly CHECKOUT_DIR="$2"

readonly DIRTY_CHECK="$3"


set -e


GIT_REV="git-$(git -C "$CHECKOUT_DIR" rev-parse HEAD 2>/dev/null)"

git -C "$CHECKOUT_DIR" rev-parse HEAD 2>/dev/null


if $DIRTY_CHECK && [ -n "$(git -C "$CHECKOUT_DIR" status --porcelain --untracked-files=no 2>/dev/null)" ]; then

  GIT_REV+="-dirty"

fi

git -C "$CHECKOUT_DIR" status --porcelain --untracked-files=no 2>/dev/null


# Update the existing file only if it's changed.

if [ ! -r "$OUTFILE" ] || [ "$(<"$OUTFILE")" != "$GIT_REV" ]; then

  # Make sure not to include a trailing newline!

  printf '%s' "$GIT_REV" > "$OUTFILE"

fi

<"$OUTFILE"


Vimal Kansal

unread,
Dec 17, 2020, 1:43:03 AM12/17/20
to discuss, Roland McGrath, Vimal Kansal, discuss, Shai Barack
This is the output I get :

(base) vimalkansal@Vimals-MBP fuchsia % cd out/default.zircon

(base) vimalkansal@Vimals-MBP default.zircon % bash -x ../../zircon/kernel/lib/version/git-version-string.sh kernel-version-string.bin ../.. true

+ readonly OUTFILE=kernel-version-string.bin

+ OUTFILE=kernel-version-string.bin

+ readonly CHECKOUT_DIR=../..

+ CHECKOUT_DIR=../..

+ readonly DIRTY_CHECK=true

+ DIRTY_CHECK=true

+ set -e

++ git -C ../.. rev-parse HEAD

+ GIT_REV=git-d6410119ff75ff6867707223944b43187867fd03

+ true

++ git -C ../.. status --porcelain --untracked-files=no

+ '[' -n '' ']'

+ '[' '!' -r kernel-version-string.bin ']'

+ printf %s git-d6410119ff75ff6867707223944b43187867fd03


Thx


Vimal


Vimal Kansal

unread,
Dec 17, 2020, 1:43:03 AM12/17/20
to discuss, Shai Barack, discuss, Vimal Kansal, Roland McGrath

Vimal Kansal

unread,
Dec 17, 2020, 1:43:03 AM12/17/20
to discuss, Gabriel Kerneis, discuss, Vimal Kansal
Here is how my log file looks like :

Build initiated at 20201217_132630

------ GIT QUICK INFO ------
$ git status
HEAD detached at d5032116c29
nothing to commit, working tree clean

$ git rev-parse JIRI_HEAD
d5032116c291465e187dc71fed96974df2186ec6

------ CONTENTS OF args.gn ------
$ cat /Users/vimalkansal/fuchsia/out/default/args.gn

import("//boards/x64.gni")
import("//products/workstation.gni")
# See: fx args --list=base_package_labels
base_package_labels += []

# See: fx args --list=cache_package_labels
cache_package_labels += []

# See: fx args --list=universe_package_labels
universe_package_labels += []

# See: fx args --list=host_labels
host_labels += []


------ RUNNING ninja ------
env -i TERM=xterm-256color PATH=/Users/vimalkansal/fuchsia/prebuilt/third_party/python3/mac-x64/bin:/Users/vimalkansal/fuchsia/.jiri_root/bin:/Users/vimalkansal/opt/anaconda3/bin:/Users/vimalkansal/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/opt/X11/bin TMPDIR=/var/folders/65/l149ps750vd5j3j15qvbwb6h0000gn/T/ /Users/vimalkansal/fuchsia/prebuilt/third_party/ninja/mac-x64/ninja -j 12 -l 240 -C /Users/vimalkansal/fuchsia/out/default.zircon

ninja: Entering directory `/Users/vimalkansal/fuchsia/out/default.zircon'
[1/11346] ACTION //kernel/lib/version:version-string.bin(//public/gn/toolchain:stub)
FAILED: kernel-version-string.bin 
/usr/bin/env ../../zircon/kernel/lib/version/git-version-string.sh kernel-version-string.bin ../.. true
[2/11346] LINK host-x64-mac-clang/obj/kernel/lib/arch/gen-x86-msr-asm
[3/11346] LINK host-x64-mac-clang/obj/kernel/arch/x86/phys/phys32-header
[4/11346] LINK host-x64-mac-clang/obj/kernel/lib/arch/x86/gen-cpuid-asm
[5/11346] CC host-x64-mac-clang/obj/ABS_PATH/Users/vimalkansal/fuchsia/third_party/boringssl/src/crypto/fipsmodule/modes/libboringssl.polyval.c.o
[6/11346] CC host-x64-mac-clang/obj/ABS_PATH/Users/vimalkansal/fuchsia/third_party/boringssl/src/crypto/hkdf/libboringssl.hkdf.c.o
[7/11346] CC host-x64-mac-clang/obj/ABS_PATH/Users/vimalkansal/fuchsia/third_party/boringssl/src/crypto/fipsmodule/sha/libboringssl.sha256.c.o
[8/11346] CC host-x64-mac-clang/obj/ABS_PATH/Users/vimalkansal/fuchsia/third_party/boringssl/src/crypto/fipsmodule/modes/libboringssl.gcm_nohw.c.o
[9/11346] CC host-x64-mac-clang/obj/ABS_PATH/Users/vimalkansal/fuchsia/third_party/boringssl/src/crypto/fipsmodule/hmac/libboringssl.hmac.c.o
[10/11346] CC host-x64-mac-clang/obj/ABS_PATH/Users/vimalkansal/fuchsia/third_party/boringssl/src/crypto/fipsmodule/digest/libboringssl.digest.c.o
[11/11346] CC host-x64-mac-clang/obj/ABS_PATH/Users/vimalkansal/fuchsia/third_party/boringssl/src/crypto/fipsmodule/digest/libboringssl.digests.c.o
[12/11346] CC host-x64-mac-clang/obj/ABS_PATH/Users/vimalkansal/fuchsia/third_party/boringssl/src/crypto/fipsmodule/modes/libboringssl.gcm.c.o
ninja: build stopped: subcommand failed.
WARNING: Debug log saved to /Users/vimalkansal/failed_fuchsia_build.txt. Please attach this file when reporting a bug


Vimal Kansal

unread,
Dec 17, 2020, 1:58:25 AM12/17/20
to discuss, Shai Barack, discuss, Roland McGrath, Vimal Kansal
I double checked, that is not a copy paste error.

Shai Barack

unread,
Dec 17, 2020, 1:59:51 AM12/17/20
to Vimal Kansal, discuss, Roland McGrath
It looks like all the lines in the script succeeded. So unless I'm reading it wrong I don't understand why the action failed. :/

David Turner

unread,
Dec 17, 2020, 8:52:50 AM12/17/20
to Shai Barack, Vimal Kansal, discuss, Roland McGrath
Which default shell are you using exactly? Looking at the git-version-string.sh script, it uses "$(< file)" which is Bash-specific, and may not be supported by zsh. Can you replace the line in that script that reads:


if [ ! -r "$OUTFILE" ] || [ "$(<"$OUTFILE")" != "$GIT_REV" ]; then

with:

if [ ! -r "$OUTFILE" ] || [ "$(cat \"$OUTFILE\")" != "$GIT_REV" ]; then
And tell us if this changes anything for you?

Gabriel Kerneis

unread,
Dec 17, 2020, 11:59:43 AM12/17/20
to David Turner, Shai Barack, Vimal Kansal, discuss, Roland McGrath
On Thu, Dec 17, 2020 at 2:52 PM 'David Turner' via discuss <dis...@fuchsia.dev> wrote:
Which default shell are you using exactly? Looking at the git-version-string.sh script, it uses "$(< file)" which is Bash-specific, and may not be supported by zsh.

Shouldn't #!/bin/bash at the top of the script make the default shell moot? Or does OSX alias /bin/bash to zsh?

Gabriel 

David Turner

unread,
Dec 17, 2020, 12:52:18 PM12/17/20
to Gabriel Kerneis, Shai Barack, Vimal Kansal, discuss, Roland McGrath
It shouldn't be I prefer to be sure. Also OS X uses an old version of bash iirc, while Linux uses a much more recent one.

Gabriel 

Shai Barack

unread,
Dec 17, 2020, 1:06:41 PM12/17/20
to David Turner, Gabriel Kerneis, Vimal Kansal, discuss, Roland McGrath
Vimal, are you able to modify the script?

Try changing:
"$(<"$OUTFILE")" != "$GIT_REV"
To:
`cat "$OUTFILE"` != "$GIT_REV"

This would validate or invalidate the theory that the $(<file) is choking up your shell.

Vimal Kansal

unread,
Dec 17, 2020, 4:10:32 PM12/17/20
to discuss, Shai Barack, Gabriel Kerneis, Vimal Kansal, discuss, Roland McGrath, David Turner
Build fails again with log file now showing :

Build initiated at 20201218_080807

------ GIT QUICK INFO ------
$ git status
HEAD detached at 91a625d4aab
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

modified:   zircon/kernel/lib/version/git-version-string.sh

Untracked files:
  (use "git add <file>..." to include in what will be committed)

failing-again.txt
kernel-version-string.bin

no changes added to commit (use "git add" and/or "git commit -a")

$ git rev-parse JIRI_HEAD
91a625d4aab34185a9e7e08122220d0c033b2eef

------ CONTENTS OF args.gn ------
$ cat /Users/vimalkansal/fuchsia/out/default/args.gn

import("//boards/x64.gni")
import("//products/workstation.gni")
# See: fx args --list=base_package_labels
base_package_labels += []

# See: fx args --list=cache_package_labels
cache_package_labels += []

# See: fx args --list=universe_package_labels
universe_package_labels += []

# See: fx args --list=host_labels
host_labels += []


------ RUNNING ninja ------
env -i TERM=xterm-256color PATH=/Users/vimalkansal/fuchsia/prebuilt/third_party/python3/mac-x64/bin:/Users/vimalkansal/fuchsia/.jiri_root/bin:/Users/vimalkansal/opt/anaconda3/bin:/Users/vimalkansal/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/opt/X11/bin TMPDIR=/var/folders/65/l149ps750vd5j3j15qvbwb6h0000gn/T/ /Users/vimalkansal/fuchsia/prebuilt/third_party/ninja/mac-x64/ninja -j 12 -l 240 -C /Users/vimalkansal/fuchsia/out/default.zircon

ninja: Entering directory `/Users/vimalkansal/fuchsia/out/default.zircon'
[1/1172] STAMP host-x64-mac-clang/obj/system/ulib/fit/fit.headers.stamp
[2/1172] STAMP host-x64-mac-clang/obj/system/ulib/hwreg/hwreg.headers.stamp
[3/1172] AR host-x64-mac-clang/obj/system/ulib/cmdline/libcmdline.a
[4/1172] ACTION //kernel/lib/version:version-string.bin(//public/gn/toolchain:stub)
FAILED: kernel-version-string.bin 
/usr/bin/env ../../zircon/kernel/lib/version/git-version-string.sh kernel-version-string.bin ../.. true
[5/1172] AR host-x64-mac-clang/obj/system/ulib/fbl/libfbl.a
[6/1172] STAMP host-x64-mac-clang/obj/system/ulib/fit/headers.stamp
[7/1172] STAMP host-x64-mac-clang/obj/system/ulib/hwreg/headers.stamp
[8/1172] CXX host-x64-mac-clang/obj/system/ulib/zx-panic-libc/libzx-panic-libc.zx_panic_libc.cc.o
[9/1172] CXX host-x64-mac-clang/obj/system/ulib/hwreg/libhwreg.printers.cc.o
[10/1172] CXX host-x64-mac-clang/obj/system/ulib/fit/libfit.promise.cc.o
[11/1172] CXX host-x64-mac-clang/obj/system/ulib/fit/libfit.scope.cc.o
[12/1172] CXX host-x64-mac-clang/obj/system/ulib/fit/libfit.sequencer.cc.o
[13/1172] CXX host-x64-mac-clang/obj/system/ulib/hwreg/libhwreg.asm.cc.o
[14/1172] CXX host-x64-mac-clang/obj/system/ulib/fit/libfit.single_threaded_executor.cc.o
[15/1172] CXX host-x64-mac-clang/obj/system/ulib/fit/libfit.scheduler.cc.o
ninja: build stopped: subcommand failed.
WARNING: Debug log saved to failing-again.txt. Please attach this file when reporting a bug


Shai Barack

unread,
Dec 17, 2020, 4:11:56 PM12/17/20
to Vimal Kansal, discuss, Gabriel Kerneis, Roland McGrath, David Turner
Can we see your `git diff` just to verify?

Vimal Kansal

unread,
Dec 17, 2020, 5:50:40 PM12/17/20
to discuss, Shai Barack, discuss, Gabriel Kerneis, Roland McGrath, David Turner, Vimal Kansal
Here you go :

(base) vimalkansal@Vimals-MBP fuchsia % git diff

diff --git a/zircon/kernel/lib/version/git-version-string.sh b/zircon/kernel/lib/version/git-version-string.sh

index 6aba03b1bd9..708485fbc64 100755

--- a/zircon/kernel/lib/version/git-version-string.sh

+++ b/zircon/kernel/lib/version/git-version-string.sh

@@ -20,7 +20,7 @@ if $DIRTY_CHECK && [ -n "$(git -C "$CHECKOUT_DIR" status --porcelain --untracked

 fi

 

 # Update the existing file only if it's changed.

-if [ ! -r "$OUTFILE" ] || [ "$(<"$OUTFILE")" != "$GIT_REV" ]; then

+if [ ! -r "$OUTFILE" ] || [ "$(cat \"$OUTFILE\")" != "$GIT_REV" ]; then

   # Make sure not to include a trailing newline!

   printf '%s' "$GIT_REV" > "$OUTFILE"

 fi

(base) vimalkansal@Vimals-MBP fuchsia %


Shai Barack

unread,
Dec 17, 2020, 10:02:09 PM12/17/20
to Vimal Kansal, discuss, Gabriel Kerneis, Roland McGrath, David Turner
Thanks for sending the diff. There's a mistake in there. Sorry, my choice of email as the medium to convey what I was suggesting that you'd change perhaps wasn't the best idea.
I uploaded a change for you. Here's how you can get it:
git fetch https://fuchsia.googlesource.com/fuchsia refs/changes/34/464034/1 && git cherry-pick FETCH_HEAD

If this fixes your build issue then we know that your shell doesn't like the $(<file) syntax and we have a path to fixing the problem. If this doesn't, we need another idea 'cause I'm stumped.
Fingers crossed.

Shai Barack

unread,
Dec 23, 2020, 1:45:13 AM12/23/20
to Vimal Kansal, discuss, Gabriel Kerneis, Roland McGrath, David Turner
Hey Vimal, any updates?
Reply all
Reply to author
Forward
0 new messages