Skip to content

Problems building release-6.1.1 on osx 13.3.1 (22E261) / Xcode 14.3 (14E222b) #18278

@adam-singer

Description

@adam-singer

Description of the bug:

Seems to be a few different failures when trying to build bazel for osx locally using OSX 13.3.1 (22E261) / Xcode 14.3 (14E222b).

The following seems to have resolved the build issue for me, but it just highlights what I removed to get things working, does not resolve the potential issue of version/breaking situations with latest Xcode and bazel osx build setup:

release-6.1.1...adam-singer:bazel:adam-singer/release-6.1.1-arc-removed-min-os-13.3

Main things added / removed

  • Adding unistd.h for osx in third_party/zlib headers.
  • Bumped macos_minimum_os to 13.3
  • Removed -fobjc-arc flag.

zlib failure message

[bazel (release-6.1.1)]$ bazel build //src:bazel-dev
Starting local Bazel server and connecting to it...
(10:05:33) INFO: Current date is 2023-05-01
(10:05:36) DEBUG: /private/var/tmp/_bazel_adams/e3e571441a21119b807d452c0b95bb9b/external/build_bazel_rules_nodejs/index.bzl:122:10: WARNING: check_rules_nodejs_version has been removed. This is a no-op, please remove the call.
(10:06:13) INFO: Analyzed target //src:bazel-dev (380 packages loaded, 10178 targets configured).
(10:06:13) INFO: Found 1 target...
(10:06:16) ERROR: /Users/adams/workspace/bazel/third_party/zlib/BUILD:39:19: Compiling third_party/zlib/gzwrite.c failed: (Exit 1): wrapped_clang failed: error executing command (from target //third_party/zlib:zlib_checked_in) 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=.' ... (remaining 32 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
third_party/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);
                   ^
third_party/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);
         ^
third_party/zlib/gzwrite.c:119: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);
                       ^
third_party/zlib/gzwrite.c:673: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
(10:06:16) ERROR: /Users/adams/workspace/bazel/third_party/zlib/BUILD:39:19: Compiling third_party/zlib/gzlib.c failed: (Exit 1): wrapped_clang failed: error executing command (from target //third_party/zlib:zlib_checked_in) 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=.' ... (remaining 32 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
third_party/zlib/gzlib.c:254:9: error: call to undeclared function 'lseek'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        LSEEK(state->fd, 0, SEEK_END);  /* so gzoffset() is correct */
        ^
third_party/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
third_party/zlib/gzlib.c:254:9: note: did you mean 'fseek'?
third_party/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:162:6: note: 'fseek' declared here
int      fseek(FILE *, long, int);
         ^
third_party/zlib/gzlib.c:260:24: error: call to undeclared function 'lseek'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        state->start = LSEEK(state->fd, 0, SEEK_CUR);
                       ^
third_party/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
third_party/zlib/gzlib.c:361:9: error: call to undeclared function 'lseek'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
        ^
third_party/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
third_party/zlib/gzlib.c:402:15: error: call to undeclared function 'lseek'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR);
              ^
third_party/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
third_party/zlib/gzlib.c:498:14: error: call to undeclared function 'lseek'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    offset = LSEEK(state->fd, 0, SEEK_CUR);
             ^
third_party/zlib/gzlib.c:14:17: note: expanded from macro 'LSEEK'
#  define LSEEK lseek
                ^
5 errors generated.
Error in child process '/usr/bin/xcrun'. 1
Target //src:bazel-dev failed to build
Use --verbose_failures to see the command lines of failed build steps.
(10:06:16) INFO: Elapsed time: 46.388s, Critical Path: 0.88s
(10:06:16) INFO: 32 processes: 28 internal, 4 darwin-sandbox.
(10:06:16) FAILED: Build did NOT complete successfully

ARC failure messages

[bazel (release-6.1.1)]$ bazel build //src:bazel-dev
(10:19:14) INFO: Current date is 2023-05-01
(10:19:15) INFO: Analyzed target //src:bazel-dev (1 packages loaded, 43 targets configured).
(10:19:15) INFO: Found 1 target...
(10:19:19) INFO: From Compiling src/google/protobuf/stubs/strutil.cc [for tool]:
external/com_google_protobuf/src/google/protobuf/stubs/strutil.cc:506:11: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
          sprintf(dest + used, (use_hex ? "\\x%02x" : "\\%03o"),
          ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 warning generated.
(10:20:05) INFO: From Generating proto_library //src/main/protobuf:execution_statistics_proto:
[libprotobuf WARNING external/com_google_protobuf/src/google/protobuf/compiler/java/java_file.cc:244] The optimize_for = LITE_RUNTIME option is no longer supported by protobuf Java code generator and is ignored--protoc will always generate full runtime code for Java. To use Java Lite runtime, users should use the Java Lite plugin instead. See:
  https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md
(10:20:06) INFO: From Generating proto_library @googleapis//:google_bytestream_bytestream_proto:
google/bytestream/bytestream.proto:19:1: warning: Import google/api/annotations.proto is unused.
(10:20:06) INFO: From Action external/googleapis/google_bytestream_bytestream_java_grpc_srcs.jar:
google/bytestream/bytestream.proto:19:1: warning: Import google/api/annotations.proto is unused.
(10:20:06) INFO: From Generating proto_library @googleapis//:google_api_auth_proto:
google/api/auth.proto:19:1: warning: Import google/api/annotations.proto is unused.
(10:20:10) ERROR: /Users/adams/workspace/bazel/src/main/java/net/starlark/java/eval/BUILD:96:10: Linking src/main/java/net/starlark/java/eval/libcpu_profiler.so failed: (Exit 1): cc_wrapper.sh failed: error executing command (from target //src/main/java/net/starlark/java/eval:libcpu_profiler.so) external/local_config_cc/cc_wrapper.sh @bazel-out/darwin-fastbuild/bin/src/main/java/net/starlark/java/eval/libcpu_profiler.so-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in child process '/usr/bin/xcrun'. 1
Target //src:bazel-dev failed to build
Use --verbose_failures to see the command lines of failed build steps.
(10:20:10) INFO: Elapsed time: 56.681s, Critical Path: 25.19s
(10:20:10) INFO: 448 processes: 48 internal, 389 darwin-sandbox, 11 worker.
(10:20:10) FAILED: Build did NOT complete successfully
[tw-mbp-adams-4 bazel (adams/test)]$ ls -al /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/
total 245784
drwxr-xr-x  18 root  wheel        576 Mar 24 04:19 .
drwxr-xr-x   8 root  wheel        256 Mar 24 04:09 ..
drwxr-xr-x   6 root  wheel        192 Apr  3 09:57 SwiftSourceKitClientPlugin.framework
drwxr-xr-x   6 root  wheel        192 Apr  3 09:57 SwiftSourceKitPlugin.framework
drwxr-xr-x   3 root  wheel         96 Mar 11 15:19 clang
-rwxr-xr-x   1 root  wheel     702704 Mar 24 04:19 libIndexStore.dylib
-rwxr-xr-x   1 root  wheel  121630112 Mar 24 04:18 libLTO.dylib
-rwxr-xr-x   1 root  wheel   22838240 Mar 24 04:19 libSwiftDriver.dylib
-rwxr-xr-x   1 root  wheel  226265216 Mar 24 04:19 libclang.dylib
-rwxr-xr-x   1 root  wheel     171856 Mar 24 04:18 libcodedirectory.dylib
-rwxr-xr-x   1 root  wheel    1132768 Mar 24 04:19 libswiftDemangle.dylib
-rwxr-xr-x   1 root  wheel     523280 Mar 24 04:18 libtapi.dylib
drwxr-xr-x   6 root  wheel        192 Apr  3 09:57 sourcekitd.framework
drwxr-xr-x   6 root  wheel        192 Apr  3 09:57 sourcekitdInProc.framework
drwxr-xr-x  17 root  wheel        544 Apr  3 09:57 swift
drwxr-xr-x   9 root  wheel        288 Dec  4 08:14 swift-5.0
drwxr-xr-x   9 root  wheel        288 Dec  4 08:14 swift-5.5
drwxr-xr-x   3 root  wheel         96 Feb 25 01:18 tapi

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Using OSX 13.3.1 (22E261) / Xcode 14.3 (14E222b) on release-6.1.1

bazel build //src:bazel-dev

Which operating system are you running Bazel on?

OSX 13.3.1 (22E261)

What is the output of bazel info release?

release 6.1.2

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

https://github.com/bazelbuild/bazel.git
6b3bae26c10bf1a72d1dcfdae64c6cf83eddd513
e7fd4cf42e3e320dfac0400464a604c0d8b71a1d

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)team-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions