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

Build failed not all outputs were created or valid on darwin/amd64 #60179

Closed
zyxkad opened this issue Mar 30, 2023 · 16 comments
Closed

Build failed not all outputs were created or valid on darwin/amd64 #60179

zyxkad opened this issue Mar 30, 2023 · 16 comments
Assignees
Labels
subtype:macOS macOS Build/Installation issues type:build/install Build and install issues

Comments

@zyxkad
Copy link

zyxkad commented Mar 30, 2023

Issue Type

Build/Install

Have you reproduced the bug with TF nightly?

No

Source

source

Tensorflow Version

faf4a8e

Custom Code

No

OS Platform and Distribution

MacOS 13.3 (22E252) Apple M1 Pro

Mobile device

N/A

Python version

3.11

Bazel version

bazel 5.3.0

GCC/Compiler version

Apple clang version 14.0.0 (clang-1400.0.29.202)

CUDA/cuDNN version

N/A

GPU model and memory

16GB RAM, no NVIDIA GPU

Current Behaviour?

Build logs
$ bazel build --verbose_failures //tensorflow/tools/pip_package:build_pip_package
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=156
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/opt/homebrew/opt/python@3.11/bin/python3.11 --action_env PYTHON_LIB_PATH=/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages --python_path=/opt/homebrew/opt/python@3.11/bin/python3.11
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:macos in file /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc: --apple_platform_type=macos --copt=-DGRPC_BAZEL_BUILD --copt=-w --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/6330447c2509c3669d64ae753c8030be1a38dc72.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found                                                                                 
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (606 packages loaded, 44253 targets configured).                                     
INFO: Found 1 target...                                                                                                                                     
ERROR: /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/tensorflow/BUILD:1128:21: declared output 'tensorflow/libtensorflow_framework.2.dylib' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely)                                                         
ERROR: /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/tensorflow/BUILD:1128:21: Executing genrule //tensorflow:libtensorflow_framework.2.dylib_sym failed: not all outputs were created or valid                                                                                                                  
realpath: illegal option -- -                                                                                                                               
usage: realpath [-q] [path ...]                                                                                                                             
Target //tensorflow/tools/pip_package:build_pip_package failed to build                                                                                     
INFO: Elapsed time: 589.942s, Critical Path: 78.69s                                                                                                         
INFO: 4653 processes: 875 internal, 3778 local.                                                                                                             
FAILED: Build did NOT complete successfully

Expect no error

Standalone code to reproduce the issue

  1. Prepare a computer with Mac M1 chip
  2. Do git clone https://github.com/tensorflow/tensorflow
  3. Install dependencies such as clang and bazel
  4. Do bazel build --verbose_failures //tensorflow/tools/pip_package:build_pip_package

Relevant log output

See above

@freedomtan
Copy link
Contributor

A recent commit (51a8992) used non-standard GNU realpath --relative. Quick workaround is to use GNU realpath (in coreutils). On my mac, I used macport to install realpath to /opt/local/libexec/gnubin, then add /opt/local/libexec/gnubin before /usr/bin when running bazel.

@zyxkad
Copy link
Author

zyxkad commented Mar 31, 2023

A recent commit (51a8992) used non-standard GNU realpath --relative. Quick workaround is to use GNU realpath (in coreutils). On my mac, I used macport to install realpath to /opt/local/libexec/gnubin, then add /opt/local/libexec/gnubin before /usr/bin when running bazel.

Can you give a more specific command to explain how to do it? I don't know how to install GNU realpath. Thanks very much.

@tilakrayal tilakrayal added the subtype:macOS macOS Build/Installation issues label Mar 31, 2023
@freedomtan
Copy link
Contributor

A recent commit (51a8992) used non-standard GNU realpath --relative. Quick workaround is to use GNU realpath (in coreutils). On my mac, I used macport to install realpath to /opt/local/libexec/gnubin, then add /opt/local/libexec/gnubin before /usr/bin when running bazel.

Can you give a more specific command to explain how to do it? I don't know how to install GNU realpath. Thanks very much.

I am a long time macports user, but I guess most people use homebrew, which I am not familiar. with For macports, I use ports install coreutils to install GNU realpath.

@zyxkad
Copy link
Author

zyxkad commented Mar 31, 2023

For macports, I use ports install coreutils to install GNU realpath.

For homebrew is the same command, just do brew install coreutils :)

@zyxkad
Copy link
Author

zyxkad commented Mar 31, 2023

After install that, I got new error:

$ bazel build --verbose_failures //tensorflow/tools/pip_package:build_pip_package                            
INFO: Options provided by the client:                                                                                                                       
  Inherited 'common' options: --isatty=1 --terminal_columns=156                                                                                             
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/opt/homebrew/opt/python@3.11/bin/python3.11 --action_env PYTHON_LIB_PATH=/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages --python_path=/opt/homebrew/opt/python@3.11/bin/python3.11
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:macos in file /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc: --apple_platform_type=macos --copt=-DGRPC_BAZEL_BUILD --copt=-w --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 0 targets configured).                                           
INFO: Found 1 target...                                                                                                                                     
ERROR: /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/tensorflow/python/BUILD:3740:24: Linking tensorflow/python/_pywrap_tensorflow_internal.so failed: (Aborted): cc_wrapper.sh failed: error executing command                                                                                                  
  (cd /private/var/tmp/_bazel_ckpn/f1a48392cd9981a14f58ae3ee34a93e9/execroot/org_tensorflow && \                                                            
  exec env - \                                                                                                                                              
    APPLE_SDK_PLATFORM=MacOSX \
    APPLE_SDK_VERSION_OVERRIDE=13.1 \
    PATH='/opt/homebrew/opt/coreutils/libexec/gnubin:/Applications/CMake.app/Contents/bin:/Users/ckpn/Mine/projects/golang/bin:/opt/java/jdk-18.0.1.1.jdk/Contents/Home/bin:/opt/homebrew/opt/go/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion Tech Preview.app/Contents/Public:/Library/Apple/usr/bin:/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:/Users/ckpn/.cargo/bin:/Applications/CMake.app/Contents/bin:/Users/ckpn/Mine/projects/golang/bin:/opt/java/jdk-18.0.1.1.jdk/Contents/Home/bin:/opt/homebrew/opt/go/bin:/opt/homebrew/bin:/opt/homebrew/sbin' \
    PYTHON_BIN_PATH=/opt/homebrew/opt/python@3.11/bin/python3.11 \
    PYTHON_LIB_PATH=/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages \
    TF2_BEHAVIOR=1 \
    XCODE_VERSION_OVERRIDE=14.2.0.14C18 \
    ZERO_AR_DATE=1 \
  external/local_config_cc/cc_wrapper.sh @bazel-out/darwin_arm64-opt/bin/tensorflow/python/_pywrap_tensorflow_internal.so-2.params)
# Configuration: 0d30b901d7e94aed4b42ed061313da68829eea8916fb0996d8f08d6e7e494092
# Execution platform: @local_execution_config_platform//:platform
ld: malformed trie, terminalSize extends beyond trie data file 'bazel-out/darwin_arm64-opt/bin/_solib_darwin_arm64/libtensorflow_Slibtensorflow_Ucc.2.13.0.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in child process '/usr/bin/xcrun'. 1
external/local_config_cc/cc_wrapper.sh: line 69: 73858 Abort trap: 6           "$(/usr/bin/dirname "$0")"/wrapped_clang "$@"
Target //tensorflow/tools/pip_package:build_pip_package failed to build                                                                                     
INFO: Elapsed time: 0.681s, Critical Path: 0.21s                                                                                                            
INFO: 12 processes: 12 internal.                                                                                                                            
FAILED: Build did NOT complete successfully

@freedomtan
Copy link
Contributor

Well, actually, it's an "old" linker error, see, #58368

After install that, I got new error:

$ bazel build --verbose_failures //tensorflow/tools/pip_package:build_pip_package                            
INFO: Options provided by the client:                                                                                                                       
  Inherited 'common' options: --isatty=1 --terminal_columns=156                                                                                             
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/opt/homebrew/opt/python@3.11/bin/python3.11 --action_env PYTHON_LIB_PATH=/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages --python_path=/opt/homebrew/opt/python@3.11/bin/python3.11
INFO: Reading rc options for 'build' from /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc:
  'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:macos in file /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/.bazelrc: --apple_platform_type=macos --copt=-DGRPC_BAZEL_BUILD --copt=-w --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 0 targets configured).                                           
INFO: Found 1 target...                                                                                                                                     
ERROR: /Users/ckpn/Mine/projects/python/bert_tst/tensorflow/tensorflow/python/BUILD:3740:24: Linking tensorflow/python/_pywrap_tensorflow_internal.so failed: (Aborted): cc_wrapper.sh failed: error executing command                                                                                                  
  (cd /private/var/tmp/_bazel_ckpn/f1a48392cd9981a14f58ae3ee34a93e9/execroot/org_tensorflow && \                                                            
  exec env - \                                                                                                                                              
    APPLE_SDK_PLATFORM=MacOSX \
    APPLE_SDK_VERSION_OVERRIDE=13.1 \
    PATH='/opt/homebrew/opt/coreutils/libexec/gnubin:/Applications/CMake.app/Contents/bin:/Users/ckpn/Mine/projects/golang/bin:/opt/java/jdk-18.0.1.1.jdk/Contents/Home/bin:/opt/homebrew/opt/go/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion Tech Preview.app/Contents/Public:/Library/Apple/usr/bin:/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:/Users/ckpn/.cargo/bin:/Applications/CMake.app/Contents/bin:/Users/ckpn/Mine/projects/golang/bin:/opt/java/jdk-18.0.1.1.jdk/Contents/Home/bin:/opt/homebrew/opt/go/bin:/opt/homebrew/bin:/opt/homebrew/sbin' \
    PYTHON_BIN_PATH=/opt/homebrew/opt/python@3.11/bin/python3.11 \
    PYTHON_LIB_PATH=/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages \
    TF2_BEHAVIOR=1 \
    XCODE_VERSION_OVERRIDE=14.2.0.14C18 \
    ZERO_AR_DATE=1 \
  external/local_config_cc/cc_wrapper.sh @bazel-out/darwin_arm64-opt/bin/tensorflow/python/_pywrap_tensorflow_internal.so-2.params)
# Configuration: 0d30b901d7e94aed4b42ed061313da68829eea8916fb0996d8f08d6e7e494092
# Execution platform: @local_execution_config_platform//:platform
ld: malformed trie, terminalSize extends beyond trie data file 'bazel-out/darwin_arm64-opt/bin/_solib_darwin_arm64/libtensorflow_Slibtensorflow_Ucc.2.13.0.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in child process '/usr/bin/xcrun'. 1
external/local_config_cc/cc_wrapper.sh: line 69: 73858 Abort trap: 6           "$(/usr/bin/dirname "$0")"/wrapped_clang "$@"
Target //tensorflow/tools/pip_package:build_pip_package failed to build                                                                                     
INFO: Elapsed time: 0.681s, Critical Path: 0.21s                                                                                                            
INFO: 12 processes: 12 internal.                                                                                                                            
FAILED: Build did NOT complete successfully

@feranick
Copy link
Contributor

feranick commented Apr 1, 2023

Well, actually, it's an "old" linker error, see, #58368

The new version of XCode 14.3 include an updated version of the linker ld which fixes the original issue #58368. Unless there are other issues unrelated to the linker bug, this issue is resolved as well, and if so, this bug report should be closed.

@SuryanarayanaY
Copy link
Collaborator

Hi @zyxkad ,

I have replicated the reported error.

suryanarayanay-macbookpro:tensorflow suryanarayanay$ bazel build --verbose_failures //tensorflow/tools/pip_package:build_pip_package
Starting local Bazel server and connecting to it...
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=214
INFO: Reading rc options for 'build' from /Users/suryanarayanay/tensorflow/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /Users/suryanarayanay/tensorflow/.bazelrc:
  'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
INFO: Found applicable config definition build:short_logs in file /Users/suryanarayanay/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
INFO: Found applicable config definition build:v2 in file /Users/suryanarayanay/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:macos in file /Users/suryanarayanay/tensorflow/.bazelrc: --apple_platform_type=macos --copt=-DGRPC_BAZEL_BUILD --copt=-w --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/0aaa6e679847a4eeb407136e7b0bcef93ec652e6.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/6330447c2509c3669d64ae753c8030be1a38dc72.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/benchmark/archive/f7547e29ccaed7b64ef4f7495ecfff1c9f6f3d03.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/flatbuffers/archive/v23.1.20.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/glennrp/libpng/archive/v1.6.39.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/boringssl/archive/c00d7ca810e93780bd0c8ee4eea28f4f2ea4bcdc.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/openxla/stablehlo/archive/458bdd95771e9861e6488868e315a1b0340058ba.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/XNNPACK/archive/7adae8e6ded8fff33d92212ca1028d2419cd34d4.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/pybind/pybind11_abseil/archive/2c4932ed6f6204f1656e245838f4f5eae69d2e29.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (605 packages loaded, 43895 targets configured).
INFO: Found 1 target...
INFO: SystemSuspensionEvent: Computer put to sleep
INFO: SystemSuspensionEvent: Computer woken up
ERROR: /Users/suryanarayanay/tensorflow/tensorflow/BUILD:1128:21: declared output 'tensorflow/libtensorflow_framework.2.dylib' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely)
ERROR: /Users/suryanarayanay/tensorflow/tensorflow/BUILD:1128:21: Executing genrule //tensorflow:libtensorflow_framework.2.dylib_sym [for host] failed: not all outputs were created or valid
realpath: illegal option -- -
usage: realpath [-q] [path ...]
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 1936.248s, Critical Path: 31.46s
INFO: 6866 processes: 2275 internal, 4591 local.
FAILED: Build did NOT complete successfully
suryanarayanay-macbookpro:tensorflow suryanarayanay$ 

@SuryanarayanaY
Copy link
Collaborator

The build fails with clang 14.0.0.

suryanarayanay-macbookpro:tensorflow suryanarayanay$ xcrun  ld -v
@(#)PROGRAM:ld  PROJECT:ld64-820.1
BUILD 20:07:05 Nov  7 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 14.0.0, (clang-1400.0.29.202) (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)
suryanarayanay-macbookpro:tensorflow suryanarayanay$ clang --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

@zyxkad, Could you please try with XCode 14.3 version as mentioned in comment-1492839793 and confirm if still a problem with it.

@zyxkad
Copy link
Author

zyxkad commented Apr 2, 2023

The new version of XCode 14.3 include an updated version of the linker ld which fixes the original issue #58368. Unless there are other issues unrelated to the linker bug, this issue is resolved as well, and if so, this bug report should be closed.

No, my issue is if I don't install realpath, then the build will falid. I'm not sure is that solved?

@zyxkad
Copy link
Author

zyxkad commented Apr 2, 2023

I have a event later for an hour, so I will test after that

@zyxkad
Copy link
Author

zyxkad commented Apr 5, 2023

Build successed! :)

@zyxkad zyxkad closed this as completed Apr 5, 2023
@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@SuryanarayanaY
Copy link
Collaborator

@zyxkad ,

Thanks for the update and we are glad that your issue resolved. Please confirm whether upgrading XCode version worked for you or any other hacks so that it will help the larger community who visit this ticket. Thanks!

@zyxkad
Copy link
Author

zyxkad commented Apr 5, 2023

Solved environment:

Commit: 55939be

XCode: 14.3
clang

Apple clang version 14.0.3 (clang-1403.0.22.14.1)

bazel 5.3.0

@sun1638650145
Copy link

@zyxkad Hello, building TensorFlow 2.13 on my Apple M1 also encountered the same issue. Could you confirm if you were able to build it successfully with just the command brew install coreutils, without any other modifications?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subtype:macOS macOS Build/Installation issues type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

6 participants