Comment 0 for bug 1829554

Revision history for this message
Bothersome Bloke (ahsee9ziegh2saithainaeciyache4ob-deactivatedaccount) wrote :

On OS X Mojave (10.14.4):
```
$ uname -a
Darwin my-mac.domain.local 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64
```

I followed the build instructions for the latest release:

```
$ wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-src.tar.bz2
$ tar xf gcc-arm-none-eabi-8-2018-q4-major-src.tar.bz2
$ cd gcc-arm-none-eabi-8-2018-q4-major
./install-sources.sh # Note: this step is patched with the fix in #1829552
# instead of "build prerequisites", I did
brew install gmp mpfr libmpc isl libelf
./build-toolchain.sh --skip-steps=manual
```

The build ran (for a few hours), but I hit this error, I think at packaging time:

```
+ echo Task '[III-11]' /x86_64-apple-darwin10/package_tbz2/
Task [III-11] /x86_64-apple-darwin10/package_tbz2/
+ cp /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/release.txt /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/install-native/share/doc/gcc-arm-none-eabi/
+ cp /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/readme.txt /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/install-native/share/doc/gcc-arm-none-eabi/
+ cp /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/license.txt /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/install-native/share/doc/gcc-arm-none-eabi/
+ copy_dir_clean /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/src/samples /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/install-native/share/gcc-arm-none-eabi/samples
+ set +u
+ mkdir -p /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/install-native/share/gcc-arm-none-eabi/samples
+ cd /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/src/samples
+ cd /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/install-native/share/gcc-arm-none-eabi/samples
+ tar xf -
+ tar cf - --exclude=CVS --exclude=.svn --exclude=.git --exclude=.pc '--exclude=*~' '--exclude=.#*' '--exclude=*.orig' '--exclude=*.rej' .
+ set -u
+ rm -f /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/pkg/gcc-arm-none-eabi-8-2019-q2-update-mac.tar.bz2
+ rm -f /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/build-native/gcc-arm-none-eabi-8-2019-q2-update
+ pushd /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/build-native
~/src/brew/gcc-arm-none-eabi-8-2018-q4-major/build-native ~/src/brew/gcc-arm-none-eabi-8-2018-q4-major/src
+ ln -s /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/install-native gcc-arm-none-eabi-8-2019-q2-update
+ tar cjf /Users/kousu/src/brew/gcc-arm-none-eabi-8-2018-q4-major/pkg/gcc-arm-none-eabi-8-2019-q2-update-mac.tar.bz2 --owner=0 --group=0 --exclude=host-x86_64-apple-darwin10 --exclude=host-i686-w64-mingw32 gcc-arm-none-eabi-8-2019-q2-update/arm-none-eabi gcc-arm-none-eabi-8-2019-q2-update/bin gcc-arm-none-eabi-8-2019-q2-update/lib gcc-arm-none-eabi-8-2019-q2-update/share
tar: Option --owner=0 is not supported
Usage:
  List: tar -tf <archive-filename>
  Extract: tar -xf <archive-filename>
  Create: tar -cf <archive-filename> [filenames...]
  Help: tar --help
```

This option is hardcoded at this part of `./build-toolchain.sh`, i.e. it's assuming GNU tar(1).

```
# Start making the package.
pushd $BUILDDIR_NATIVE
ln -s $INSTALLDIR_NATIVE $INSTALL_PACKAGE_NAME

# Make the package tarball.
${TAR} cjf $PACKAGEDIR/$PACKAGE_NAME_NATIVE.tar.bz2 \
    --owner=0 \
    --group=0 \
    --exclude=host-$HOST_NATIVE \
    --exclude=host-$HOST_MINGW \
    $INSTALL_PACKAGE_NAME/arm-none-eabi \
    $INSTALL_PACKAGE_NAME/bin \
    $INSTALL_PACKAGE_NAME/lib \
    $INSTALL_PACKAGE_NAME/share

# Remove stale links.
rm -f $INSTALL_PACKAGE_NAME
popd
```

This is the tar(1) that macOS packages:

```
$ which tar
/usr/bin/tar
$ tar --version
bsdtar 2.8.3 - libarchive 2.8.3
```

whise manpage says nothing about `--owner` but offers instead

```
     An input file in mtree(5) format can be used to create an output archive with arbitrary ownership, permissions, or names that differ from existing data on disk:

           $ cat input.mtree
           #mtree
           usr/bin uid=0 gid=0 mode=0755 type=dir
           usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls
           $ tar -cvf output.tar @input.mtree
```

How are the official macOS builds done? Do those machines have GNU tar installed? I found GNU tar in brew:

```
$ brew install gnu-tar
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from 5a63de022 to e098c37dc.
Updated 1 tap (homebrew/cask).

==> Downloading https://homebrew.bintray.com/bottles/gnu-tar-1.32.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/62/62ef2c92bf090b1ada1b8434034be21ac4534e9ab81388516191b7cecd6c095a?__gda__=exp=1558108291~hmac=2973c821ff783c60ae70d80b37c6898af84ad9700046772b850af53ab1a8
######################################################################## 100.0%
==> Pouring gnu-tar-1.32.mojave.bottle.tar.gz
==> Caveats
GNU "tar" has been installed as "gtar".
If you need to use it as "tar", you can add a "gnubin" directory
to your PATH from your bashrc like:

    PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"
==> Summary
🍺 /usr/local/Cellar/gnu-tar/1.32: 15 files, 1.7MB
```

Rerunning as

```
$ PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" ./build-toolchain.sh --skip_steps=manual
```

made it build, but that's not a good fix.

The official install instructions should explain that you need GNU tar installed, or (preferably) the build script should be patched to handle BSD tar.