Skip to content

chore: upgrade zlib to 1.3.1#17029

Closed
HerrCai0907 wants to merge 1 commit intoprotocolbuffers:mainfrom
HerrCai0907:update/zlib
Closed

chore: upgrade zlib to 1.3.1#17029
HerrCai0907 wants to merge 1 commit intoprotocolbuffers:mainfrom
HerrCai0907:update/zlib

Conversation

@HerrCai0907
Copy link
Copy Markdown
Contributor

@HerrCai0907 HerrCai0907 commented Jun 5, 2024

zlib cannot be complied in macos (madler/zlib#895).
This PR wants to upgrade zlib to 1.3.1 to avoid this issue.

@HerrCai0907 HerrCai0907 requested a review from a team as a code owner June 5, 2024 06:00
@HerrCai0907 HerrCai0907 requested review from haberman and removed request for a team June 5, 2024 06:00
@google-cla
Copy link
Copy Markdown

google-cla bot commented Jun 5, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@HerrCai0907 HerrCai0907 changed the title chore: update zlib to 1.3.1 chore: upgrade zlib to 1.3.1 Jun 5, 2024
@acozzette
Copy link
Copy Markdown

@HerrCai0907 Thank you for the pull request, but we need to have you agree to the CLA before we can review it.

@acozzette
Copy link
Copy Markdown

Sorry, I missed that the CLA check is passing now.

@acozzette acozzette added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Jun 13, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Jun 13, 2024
@HerrCai0907
Copy link
Copy Markdown
Contributor Author

@acozzette I found upb failed due to

WARNING: Target pattern parsing failed.
ERROR: Skipping '//hpb_generator/...': no targets found beneath 'hpb_generator'

But it looks like unrelated with my change.

@acozzette
Copy link
Copy Markdown

@HerrCai0907 Sorry for the trouble. These tests are passing on main but I think were broken a few days ago. Would you mind rebasing your branch and pushing it again? That should fix the problem.

@acozzette acozzette added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Jun 17, 2024
@github-actions github-actions bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Jun 17, 2024
@HerrCai0907 HerrCai0907 deleted the update/zlib branch June 18, 2024 01:07
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Sep 15, 2025
protobuf v27.2 uses Zlib 1.2.11, which produces the error below when
building on macOS with Xcode 16.4 and Clang 17. See:

- madler/zlib#895
- llvm/llvm-project#74676

protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the issue.

```txt
$ bazel build //...

Starting local Bazel server and connecting to it...
INFO: Analyzed 2 targets (113 packages loaded, 2278 targets configured).

INFO: From Compiling adler32.c [for tool]:
In file included from external/zlib/adler32.c:8:
external/zlib/zutil.h:170:11: warning: 'OS_CODE' macro redefined [-Wmacro-redefined]
  170 | #  define OS_CODE 19
      |           ^
external/zlib/zutil.h:141:11: note: previous definition is here
  141 | #  define OS_CODE  7
      |           ^
1 warning generated.

[ ...snip OS_CODE warning from crc32.c:30... ]

ERROR: external/zlib/BUILD.bazel:37:11:
  Compiling zutil.c [for tool] failed: (Exit 1): cc_wrapper.sh failed:
  error executing CppCompile command (from target @@zlib//:zlib)
  external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE
    -fstack-protector -Wall -Wthread-safety -Wself-assign
    -Wunused-but-set-parameter -Wno-free-nonheap-object
    -fcolor-diagnostics ... (remaining 33 arguments skipped)

ERROR: external/zlib/BUILD.bazel:37:11:
Compiling zutil.c [for tool] failed: (Exit 1): wrapped_clang failed:
error executing command (from target @zlib//:zlib)
external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1'
-fstack-protector -fcolor-diagnostics -Wall -Wthread-safety
-Wself-assign -fno-omit-frame-pointer -g0 -O2 -DNDEBUG
'-DNS_BLOCK_ASSERTIONS=1' ... (remaining 35 arguments skipped)

[ ...snip OS_CODE warning from zutil.c:8... ]

In file included from external/zlib/zutil.c:10:
In file included from external/zlib/gzguts.h:21:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7:
error: expected identifier or '('
  318 | FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
      |          ^
external/zlib/zutil.h:147:33: note: expanded from macro 'fdopen'
  147 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/include/__stddef_null.h:26:16:
note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |                ^

[ ...snip two more error messages pointing into __stddef_null.h:26... ]

1 warning and 3 errors generated.

ERROR: external/com_frobozz_rules_magic/src/com/frobozz/magic/BUILD:3:12
  Building external/com_frobozz_rules_magic/src/com/frobozz/magic/EmitDigestsWorker.jar
  (1 source file) [for tool] failed: (Exit 1): cc_wrapper.sh failed:
  [ ...snip repeated CppCompile command error... ]
```
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Sep 17, 2025
protobuf v27.2 uses Zlib 1.2.11, which produces the error below when
building on macOS with Xcode 16.4 and Clang 17. See:

- madler/zlib#895
- llvm/llvm-project#74676

protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the issue.

```txt
$ bazel build //...

Starting local Bazel server and connecting to it...
INFO: Analyzed 2 targets (113 packages loaded, 2278 targets configured).

INFO: From Compiling adler32.c [for tool]:
In file included from external/zlib/adler32.c:8:
external/zlib/zutil.h:170:11: warning: 'OS_CODE' macro redefined [-Wmacro-redefined]
  170 | #  define OS_CODE 19
      |           ^
external/zlib/zutil.h:141:11: note: previous definition is here
  141 | #  define OS_CODE  7
      |           ^
1 warning generated.

[ ...snip OS_CODE warning from crc32.c:30... ]

ERROR: external/zlib/BUILD.bazel:37:11:
  Compiling zutil.c [for tool] failed: (Exit 1): cc_wrapper.sh failed:
  error executing CppCompile command (from target @@zlib//:zlib)
  external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE
    -fstack-protector -Wall -Wthread-safety -Wself-assign
    -Wunused-but-set-parameter -Wno-free-nonheap-object
    -fcolor-diagnostics ... (remaining 33 arguments skipped)

ERROR: external/zlib/BUILD.bazel:37:11:
Compiling zutil.c [for tool] failed: (Exit 1): wrapped_clang failed:
error executing command (from target @zlib//:zlib)
external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1'
-fstack-protector -fcolor-diagnostics -Wall -Wthread-safety
-Wself-assign -fno-omit-frame-pointer -g0 -O2 -DNDEBUG
'-DNS_BLOCK_ASSERTIONS=1' ... (remaining 35 arguments skipped)

[ ...snip OS_CODE warning from zutil.c:8... ]

In file included from external/zlib/zutil.c:10:
In file included from external/zlib/gzguts.h:21:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7:
error: expected identifier or '('
  318 | FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
      |          ^
external/zlib/zutil.h:147:33: note: expanded from macro 'fdopen'
  147 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/include/__stddef_null.h:26:16:
note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |                ^

[ ...snip two more error messages pointing into __stddef_null.h:26... ]

1 warning and 3 errors generated.

ERROR: external/com_frobozz_rules_magic/src/com/frobozz/magic/BUILD:3:12
  Building external/com_frobozz_rules_magic/src/com/frobozz/magic/EmitDigestsWorker.jar
  (1 source file) [for tool] failed: (Exit 1): cc_wrapper.sh failed:
  [ ...snip repeated CppCompile command error... ]
```
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Sep 19, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Sep 28, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Oct 1, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Oct 28, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.

Everything builds and all tests pass using both Bazel 6.5.0 and 7.6.2 in
legacy `WORKSPACE` mode.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Oct 31, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.

Everything builds and all tests pass using both Bazel 6.5.0 and 7.6.2 in
legacy `WORKSPACE` mode.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Nov 5, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Nov 5, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.

Everything builds and all tests pass using both Bazel 6.5.0 and 7.7.0 in
legacy `WORKSPACE` mode.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Nov 7, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.

Everything builds and all tests pass using both Bazel 6.5.0 and 7.7.0 in
legacy `WORKSPACE` mode.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Nov 7, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Nov 7, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.
mbland added a commit to EngFlow-Academy/bzlmod-bootcamp that referenced this pull request Nov 7, 2025
protobuf v28.0 uses Zlib 1.3.1 via protocolbuffers/protobuf#17029, which
resolves the macOS `OS_CODE` issue. See the "Bump to rules_proto 6.0.2,
protobuf v21.7" commit message for details.

Everything builds and all tests pass using both Bazel 6.5.0 and 7.7.0 in
legacy `WORKSPACE` mode.
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.

2 participants