Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bazel version, removing the need for zlib workaround #558

Closed
wants to merge 1 commit into from

Conversation

fhanau
Copy link
Collaborator

@fhanau fhanau commented Apr 21, 2023

bazelbuild/bazel#17956 was fixed in version 6.1.2, updating allows us to no longer depend on the workaround.

@fhanau fhanau requested a review from ohodson April 21, 2023 01:39
ohodson
ohodson previously approved these changes Apr 21, 2023
Copy link
Contributor

@ohodson ohodson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Felix

@ohodson ohodson self-requested a review April 21, 2023 08:16
@ohodson ohodson dismissed their stale review April 21, 2023 08:17

Still a problem when I test this CL locally.

@ohodson
Copy link
Contributor

ohodson commented Apr 21, 2023

Felix, applying this locally and the problem comes back.

AFAIK, the image we have for the Mac is not updated and this problem (no unreasonably) occurs with later XCode toolchains. With the patch applied:

% bazel --version
bazel 6.1.2
% bazel build //src/workerd/server:workerd
ERROR: /private/var/tmp/_bazel_orion/1c368265b95202481404db482db7f1a4/external/zlib/BUILD.bazel:3:11: Compiling gzwrite.c failed: (Exit 1): wrapped_clang failed: error executing command (from target @zlib//:zlib) 
  (cd /private/var/tmp/_bazel_orion/1c368265b95202481404db482db7f1a4/sandbox/darwin-sandbox/510/execroot/workerd && \
  exec env - \
    APPLE_SDK_PLATFORM=MacOSX \
    APPLE_SDK_VERSION_OVERRIDE=13.3 \
    BAZEL_COMPILER=clang \
    CC=clang \
    CXX=clang++ \
    PATH=/Users/orion/Library/Caches/bazelisk/downloads/bazelbuild/bazel-6.1.2-darwin-arm64/bin:/Users/orion/.nvm/versions/node/v19.6.1/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin \
    XCODE_VERSION_OVERRIDE=14.3.0.14E222b \
    ZERO_AR_DATE=1 \
  external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG 'DEBUG_PREFIX_MAP_PWD=.' -iquote external/zlib -iquote bazel-out/darwin_arm64-fastbuild/bin/external/zlib -isystem external/zlib -isystem bazel-out/darwin_arm64-fastbuild/bin/external/zlib -MD -MF bazel-out/darwin_arm64-fastbuild/bin/external/zlib/_objs/zlib/gzwrite.pic.d -fPIC '-DBAZEL_CURRENT_REPOSITORY="zlib"' '-frandom-seed=bazel-out/darwin_arm64-fastbuild/bin/external/zlib/_objs/zlib/gzwrite.pic.o' -isysroot __BAZEL_XCODE_SDKROOT__ -F__BAZEL_XCODE_SDKROOT__/System/Library/Frameworks -F__BAZEL_XCODE_DEVELOPER_DIR__/Platforms/MacOSX.platform/Developer/Library/Frameworks -no-canonical-prefixes -pthread -w '-Dverbose=-1' -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -target arm64-apple-macosx13.3 -c external/zlib/gzwrite.c -o bazel-out/darwin_arm64-fastbuild/bin/external/zlib/_objs/zlib/gzwrite.pic.o)
# Configuration: 49c81355f91a1ae76b24daec3b28329a1cffc14a28105379d807e8baadb61419
# Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/zlib/gzwrite.c:89:20: error: call to undeclared function 'write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
            writ = write(state->fd, strm->next_in, put);
                   ^
external/zlib/gzwrite.c:89:20: note: did you mean 'fwrite'?
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:165:9: note: 'fwrite' declared here
size_t   fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite);
         ^
external/zlib/gzwrite.c:110:24: error: call to undeclared function 'write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                writ = write(state->fd, state->x.next, put);
                       ^
external/zlib/gzwrite.c:661:9: error: call to undeclared function 'close'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    if (close(state->fd) == -1)

@ohodson
Copy link
Contributor

ohodson commented Apr 21, 2023

This post also suggests there are others see this as not fixed yet:
bazelbuild/bazel#17956 (comment)

@fhanau
Copy link
Collaborator Author

fhanau commented Apr 21, 2023

You're right, this doesn't fix the issue for workerd – bazel patched their internal zlib whereas we use an unpatched zlib release via capnproto. I'll consider using a different workaround within capnproto

@fhanau fhanau closed this Apr 21, 2023
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