Skip to content

Fix gitstatus build failure with Apple Clang 17 (Xcode 16+)#19

Open
alejandroqh wants to merge 1 commit intoquantumnic:masterfrom
alejandroqh:fix/darwin-clang17-zlib
Open

Fix gitstatus build failure with Apple Clang 17 (Xcode 16+)#19
alejandroqh wants to merge 1 commit intoquantumnic:masterfrom
alejandroqh:fix/darwin-clang17-zlib

Conversation

@alejandroqh
Copy link

Apple Clang 17 predefines TARGET_OS_MAC=1, which activates an ancient classic Mac OS code path in the bundled zlib. The fdopen macro replaces the system _stdio.h declaration of fdopen() with NULL, producing a parse error.

Error:

  _stdio.h:322:7: error: expected identifier or '('
    FILE *fdopen(int, const char *) ...

  zutil.h:140:33: note: expanded from macro 'fdopen'
    #define fdopen(fd,mode) NULL /* No fdopen() */

Fix: use system zlib instead of the bundled one.

  • Add -lz to gitstatus_ldlibs to link against system zlib
  • Add -DUSE_BUNDLED_ZLIB=OFF to libgit2 cmake flags

@NSHenry
Copy link

NSHenry commented Mar 13, 2026

I manually made this change, and I was able to build gitstatusd afterwards.

romkatv added a commit to romkatv/gitstatus that referenced this pull request Mar 14, 2026
From quantumnic/powerlevel10k#19 by @alejandroqh.

Apple Clang 17 predefines TARGET_OS_MAC=1, which activates an ancient classic
Mac OS code path in the bundled zlib. The fdopen macro replaces the system
_stdio.h declaration of fdopen() with NULL, producing a parse error.

Error:

    _stdio.h:322:7: error: expected identifier or '('
      FILE *fdopen(int, const char *) ...

    zutil.h:140:33: note: expanded from macro 'fdopen'
      #define fdopen(fd,mode) NULL /* No fdopen() */

Fix: use system zlib instead of the bundled one.

Add -lz to gitstatus_ldlibs to link against system zlib
Add -DUSE_BUNDLED_ZLIB=OFF to libgit2 cmake flags
@romkatv
Copy link

romkatv commented Mar 14, 2026

@alejandroqh Thanks for the PR. I've merged it upstream: romkatv/gitstatus@075baf6

@alejandroqh
Copy link
Author

@alejandroqh Thanks for the PR. I've merged it upstream: romkatv/gitstatus@075baf6

Thanks to you for merge it. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants