Skip to content

Failure to compile //examples:beginner_cc on Apple Silicone MacOS #205

@ariellubonja

Description

@ariellubonja

Hi Team!

Using the latest main changes, with bazel build --config=macos --cxxopt=-std=c++17 "//examples:beginner_cc"

I get error: expected identifier or '('. Adding or removing --cxxopt=-std=c++17 does not affect the result. Am I doing something wrong?

ariellubonja@Ariels-MacBook-Pro yggdrasil-decision-forests % bazel build --config=macos --cxxopt=-std=c++17 "//examples:beginner_cc"
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=113
INFO: Reading rc options for 'build' from /Users/ariellubonja/Downloads/yggdrasil-decision-forests/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /Users/ariellubonja/Downloads/yggdrasil-decision-forests/.bazelrc:
  'build' options: -c opt --announce_rc --noincompatible_strict_action_env --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --define=grpc_no_ares=true --color=yes --define=use_ydf_tensorflow_proto=1
INFO: Found applicable config definition build:macos in file /Users/ariellubonja/Downloads/yggdrasil-decision-forests/.bazelrc: --copt=-w --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
INFO: Build option --cxxopt has changed, discarding analysis cache.
INFO: Analyzed target //examples:beginner_cc (0 packages loaded, 3510 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_ariellubonja/bef8ec440421b7a140a494db8165fdbc/external/zlib/BUILD.bazel:37:11: Compiling zutil.c failed: (Exit 1): cc_wrapper.sh failed: error executing 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 32 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/zlib/zutil.c:10:
In file included from external/zlib/gzguts.h:21:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.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:140:33: note: expanded from macro 'fdopen'
  140 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
/opt/homebrew/Cellar/llvm/19.1.7_1/lib/clang/19/include/__stddef_null.h:26:16: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |                ^
In file included from external/zlib/zutil.c:10:
In file included from external/zlib/gzguts.h:21:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdio.h:318:7: error: expected ')'
external/zlib/zutil.h:140:33: note: expanded from macro 'fdopen'
  140 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
/opt/homebrew/Cellar/llvm/19.1.7_1/lib/clang/19/include/__stddef_null.h:26:16: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdio.h:318:7: note: to match this '('
external/zlib/zutil.h:140:33: note: expanded from macro 'fdopen'
  140 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
/opt/homebrew/Cellar/llvm/19.1.7_1/lib/clang/19/include/__stddef_null.h:26:15: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |               ^
In file included from external/zlib/zutil.c:10:
In file included from external/zlib/gzguts.h:21:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdio.h:318:7: error: expected ')'
  318 | FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
      |          ^
external/zlib/zutil.h:140:33: note: expanded from macro 'fdopen'
  140 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
/opt/homebrew/Cellar/llvm/19.1.7_1/lib/clang/19/include/__stddef_null.h:26:22: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |                      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdio.h:318:7: note: to match this '('
external/zlib/zutil.h:140:33: note: expanded from macro 'fdopen'
  140 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
/opt/homebrew/Cellar/llvm/19.1.7_1/lib/clang/19/include/__stddef_null.h:26:14: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |              ^
3 errors generated.
Target //examples:beginner_cc failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 43.040s, Critical Path: 13.28s
INFO: 395 processes: 73 internal, 322 darwin-sandbox.
FAILED: Build did NOT complete successfully

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions