Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 761322

Summary: stage1 fails to build tar on macOS 11 Big Sur: error: implicit declaration of function 'ioctl'
Product: Gentoo/Alt Reporter: Alexei Colin <ac>
Component: Prefix SupportAssignee: Gentoo Prefix <prefix>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: OS X   
URL: https://savannah.gnu.org/bugs/index.php?59755
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 755644    
Attachments: Patch to bump tar to 1.32 and apply patch to fix ioctl header inclusion.

Description Alexei Colin 2020-12-23 06:40:41 UTC
Created attachment 679290 [details, diff]
Patch to bump tar to 1.32 and apply patch to fix ioctl header inclusion.

On macOS 11 Big Sur, stage 1 needs to bootstrap tar but fails to build it:

    compare.c:550:3: error: implicit declaration of function 'ioctl' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      ioctl (archive, FDFLUSH);
  ^
    1 error generated.
    make[2]: *** [Makefile:1107: compare.o] Error 1
    make[1]: Leaving directory '/Volumes/devvol/gpref1/var/tmp/tar-1.26/tar-1.26'
    make: *** [Makefile:1036: all] Error 2

    I tried running
      bootstrap_stage1_log
    but that failed :(  I have no clue, really.  Please find friendly folks

Bumping tar from 1.26 to 1.32 does not help, same error. Tar needs a patch. Filed the patch in upstream bug report: https://savannah.gnu.org/bugs/index.php?59755

Until upstream patch is reviewed, I'm attaching a patch to bootstrap-prefix.sh that fetches and applies the tar patch from the upstream bug report (if patch file is added to a mirror, efetch should successfully pick it from there instead).

If there is a reason to not bump from 1.26 to 1.32, the same patch successfully applies to 1.26 too.

For reference, native macOS tar that triggers bootstrap of GNU tar:

    tar --version
    bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.6

Bug 755644 might want to depend on this bug.
Comment 1 Fabian Groffen gentoo-dev 2020-12-23 07:26:06 UTC
I'm a bit confused, is this 11.1 or something?  The bootstrap went fine on 11.0.
Comment 2 Alexei Colin 2020-12-23 07:45:25 UTC
Indeed, it is macOS Big Sur 11.1 (20C69).
Comment 3 Larry the Git Cow gentoo-dev 2020-12-23 07:50:54 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=1e030951dd8c4099e45395e513e3cf73b0c3d69a

commit 1e030951dd8c4099e45395e513e3cf73b0c3d69a
Author:     Alexei Colin <ac@alexeicolin.com>
AuthorDate: 2020-12-23 06:18:44 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2020-12-23 07:50:29 +0000

    bootstrap-prefix: bump tar to 1.32, apply ioctl patch
    
    On macOS 11 Big Sur, stage 1 needs to bootstrap tar but fails to build
    it (both 1.26 and 1.32) because sys/ioctl.h does not end up included:
    
        compare.c:550:3: error: implicit declaration of function 'ioctl' is
    invalid in C99 [-Werror,-Wimplicit-function-declaration]
          ioctl (archive, FDFLUSH);
    
    Upstream bug report: https://savannah.gnu.org/bugs/index.php?59755
    
    Closes: https://bugs.gentoo.org/761322
    Signed-off-by: Alexei Colin <ac@alexeicolin.com>
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 scripts/bootstrap-prefix.sh | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
Comment 4 Larry the Git Cow gentoo-dev 2020-12-23 08:12:17 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa9750b4c24e402475d4edaa1b2ef34f17d945c3

commit fa9750b4c24e402475d4edaa1b2ef34f17d945c3
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2020-12-23 08:11:21 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2020-12-23 08:12:14 +0000

    app-arch/tar: add patch for macOS Big Sur 11.1
    
    Bug: https://bugs.gentoo.org/761322
    Package-Manager: Portage-3.0.9, Repoman-3.0.2
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 ...tar-1.32-check-sys-ioctl-header-configure.patch | 53 ++++++++++++++++++++++
 app-arch/tar/tar-1.32.90.ebuild                    |  4 ++
 app-arch/tar/tar-1.32.ebuild                       |  3 ++
 3 files changed, 60 insertions(+)
Comment 5 Alexei Colin 2020-12-23 10:07:36 UTC
Thanks. Btw, app-arch/tar-1.32 does build within the Prefix, though. So, tar ebuild could remain unchanged. I haven't checked exactly why the same error does not arise within the prefix, but guessing that the tree of included headers ends up slightly different relative to what it is when building on the host; and sys/ioctl.h probably happens to get indirectly included via some other headers that are installed in the prefix.

Btw, just a clarification on:

> [buildsys] macOS Big Sur 11.1 doesn't have sys/ioctl.h

The issue is that sys/ioctl.h does have sys/ioctl.h but it doesn't get included. And, sys/ioctl.h does not get included because Big Sur does not have sys/mtio.h (and the include logic inside tar links the two headers to each other for some reason).
Comment 6 Alexei Colin 2020-12-23 10:09:03 UTC
Correction: The issue is that Big Sur does have sys/ioctl.h but it doesn't get included.
Comment 7 Larry the Git Cow gentoo-dev 2020-12-23 10:11:26 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a71cd47ebab295e3cf66b83e89b615f42befc1ab

commit a71cd47ebab295e3cf66b83e89b615f42befc1ab
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2020-12-23 10:09:59 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2020-12-23 10:09:59 +0000

    Revert "app-arch/tar: add patch for macOS Big Sur 11.1"
    
    This reverts commit fa9750b4c24e402475d4edaa1b2ef34f17d945c3.
    
    It appears I was mistaken, and we don't need this patch in the tree, for
    within Prefix itself, this issue doesn't occur.  See comment #5
    
    Bug: https://bugs.gentoo.org/761322
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 ...tar-1.32-check-sys-ioctl-header-configure.patch | 53 ----------------------
 app-arch/tar/tar-1.32.90.ebuild                    |  4 --
 app-arch/tar/tar-1.32.ebuild                       |  3 --
 3 files changed, 60 deletions(-)
Comment 8 Fabian Groffen gentoo-dev 2020-12-23 10:12:20 UTC
Reverted, thanks.  This is a very odd scenario, but let's hope it is now covered sufficiently.