RFR: 8286582: Build fails on macos aarch64 when using --with-zlib=bundled

Magnus Ihse Bursie ihse at openjdk.java.net
Wed May 11 11:59:43 UTC 2022


On Wed, 11 May 2022 11:38:31 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this change which fixes build failures on macos when using `--with-zlib=bundled`?
> 
> With this change the build now passes (tested both with bundled and system zlib variants).
> 
> tier1, tier2 and tier3 testing has been done and no related failures have been noticed.

Changes requested by ihse (Reviewer).

make/autoconf/lib-bundled.m4 line 224:

> 222:   LIBZ_LIBS=""
> 223:   if test "x$USE_EXTERNAL_LIBZ" = "xfalse"; then
> 224:     LIBZ_CFLAGS="$LIBZ_CFLAGS $APPLE_LIBZ_CFLAGS -I$TOPDIR/src/java.base/share/native/libzip/zlib"

Declaring APPLE_LIBZ_CFLAGS far away (and only conditionally) and then using it once here just makes for hard-to-read code. 

Suggestion:

    LIBZ_CFLAGS="$LIBZ_CFLAGS -I$TOPDIR/src/java.base/share/native/libzip/zlib"
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
      LIBZ_CFLAGS="$LIBZ_CFLAGS -DHAVE_UNISTD_H"
    fi

... and remove the assignment above.

src/java.base/share/native/libzip/zlib/gzwrite.c line 452:

> 450:     len = strlen(next);
> 451: #  else
> 452: #   ifdef __APPLE__ // ignore format-nonliteral warning on macOS

Instead of patching 3rd party code to fix a compilation warning, you should disable that warning instead.

In `make/modules/java.base/lib/CoreLibraries.gmk`, add 

DISABLED_WARNINGS_clang := format-nonliteral, \

as line 138.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8651



More information about the build-dev mailing list