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

Updated zlib BUILD file to support darwin-arm64 #1931

Merged
merged 2 commits into from
Apr 24, 2023

Conversation

UebelAndre
Copy link
Collaborator

@UebelAndre UebelAndre commented Apr 22, 2023

When building on a darwin-arm64 machine, zlib fails with the following error. The changes here fix this.

ERROR: /private/var/tmp/_bazel_user/76282c66b0dfe3c5cb9a230bdc913a52/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_user/76282c66b0dfe3c5cb9a230bdc913a52/sandbox/darwin-sandbox/463/execroot/rules_rust && \
  exec env - \
    APPLE_SDK_PLATFORM=MacOSX \
    APPLE_SDK_VERSION_OVERRIDE=13.3 \
    PATH=/Users/user/Library/Caches/bazelisk/downloads/bazelbuild/bazel-6.1.2-darwin-arm64/bin:/Users/user/.cargo/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.d '-DBAZEL_CURRENT_REPOSITORY="zlib"' '-frandom-seed=bazel-out/darwin_arm64-fastbuild/bin/external/zlib/_objs/zlib/gzwrite.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.o)
# Configuration: 270fb1de579b4e65909040bb7af4ac5f9e5f6796f4be0228f4bb2f3343369513
# 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)
        ^
3 errors generated.
Error in child process '/usr/bin/xcrun'. 1
Target @zlib//:zlib failed to build

@UebelAndre UebelAndre enabled auto-merge (squash) April 24, 2023 13:31
@UebelAndre UebelAndre merged commit fa304ae into bazelbuild:main Apr 24, 2023
@UebelAndre UebelAndre deleted the zlib branch April 24, 2023 13:53
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