tensorflow: TF 2.11.0/2.12 fails to build in MacOS 13 - XCode 14.1 - issue with ld linker
Click to expand!
Issue Type
Build/Install
Source
source
Tensorflow Version
2.11.0-rc
Custom Code
No
OS Platform and Distribution
MacOS 13.0
Mobile device
No response
Python version
3.10.6
Bazel version
5.3.0
GCC/Compiler version
clang - XCode 14.1-rc2
CUDA/cuDNN version
No response
GPU model and memory
No response
Current Behaviour?
Compilation fails (log below) under MacOS 13.0 (XCode 14.1-rc2). Compilation works just fine under MacOS 13.x (XCode 14.0.x). Note that compilation fails also for TF 2.10.0 under MacOS 13.0, while it works for MacOS 12.x.
Standalone code to reproduce the issue
Follow standard compilation from source as indicated here:
https://www.tensorflow.org/install/source
Relevant log output
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/4ce3e4da2e21ae4dfcee9366415e55f408c884ec.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/d8415b02a519f222ecf71b069c96cc85ac635de3.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/081771d4a0e9d7d3aa0eed2ef389fa4700dfb23e.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/fdd47908468488cbbb386bb7fc723dc19321cb83.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/e8f74a9763aa36559980a0c2f37f587794995622.zip failed: class java.io.FileNotFoundException GET returned 404 Not Found
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (544 packages loaded, 39502 targets configured).
INFO: Found 1 target...
ERROR: /Users/feranick/Desktop/tensorflow/tensorflow/python/BUILD:358:27: Linking tensorflow/python/_pywrap_py_exception_registry.so [for host] failed: (Aborted): cc_wrapper.sh failed: error executing command
(cd /private/var/tmp/_bazel_feranick/50b852099a3bf3aaa184abce166f8e34/execroot/org_tensorflow && \
exec env - \
APPLE_SDK_PLATFORM=MacOSX \
APPLE_SDK_VERSION_OVERRIDE=13.0 \
PATH=/opt/usr/local/bin/:/Users/feranick/Documents/Work/c/android-sdk/platform-tools:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Library/Apple/usr/bin \
XCODE_VERSION_OVERRIDE=14.1.0.14B47b \
ZERO_AR_DATE=1 \
external/local_config_cc/cc_wrapper.sh @bazel-out/host/bin/tensorflow/python/_pywrap_py_exception_registry.so-2.params)
# Configuration: 41f578a38c65243e257ab9820de63672c4444f072d1cfdc2d17552cb31aa4b38
# Execution platform: @local_execution_config_platform//:platform
ld: malformed trie, node past end file 'bazel-out/host/bin/_solib_darwin_x86_64/libtensorflow_Spython_S_Upywrap_Utensorflow_Uinternal.so'
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: 8962 Abort trap: 6 "$(/usr/bin/dirname "$0")"/wrapped_clang "$@"
Target //tensorflow/tools/pip_package:build_pip_package failed to build
ERROR: /Users/feranick/Desktop/tensorflow/tensorflow/python/tools/BUILD:81:10 Middleman _middlemen/tensorflow_Spython_Stools_Sfreeze_Ugraph-runfiles failed: (Aborted): cc_wrapper.sh failed: error executing command
(cd /private/var/tmp/_bazel_feranick/50b852099a3bf3aaa184abce166f8e34/execroot/org_tensorflow && \
exec env - \
APPLE_SDK_PLATFORM=MacOSX \
APPLE_SDK_VERSION_OVERRIDE=13.0 \
PATH=/opt/usr/local/bin/:/Users/feranick/Documents/Work/c/android-sdk/platform-tools:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Library/Apple/usr/bin \
XCODE_VERSION_OVERRIDE=14.1.0.14B47b \
ZERO_AR_DATE=1 \
external/local_config_cc/cc_wrapper.sh @bazel-out/host/bin/tensorflow/python/_pywrap_py_exception_registry.so-2.params)
# Configuration: 41f578a38c65243e257ab9820de63672c4444f072d1cfdc2d17552cb31aa4b38
# Execution platform: @local_execution_config_platform//:platform
INFO: Elapsed time: 13754.646s, Critical Path: 743.77s
INFO: 30482 processes: 7386 internal, 23096 local.
FAILED: Build did NOT complete successfully
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 36 (28 by maintainers)
Commits related to this issue
- Disable macOS for TensorFlow (#1617) Due to https://github.com/tensorflow/tensorflow/issues/58368 Fixing: https://github.com/bazelbuild/continuous-integration/issues/1587 — committed to bazelbuild/continuous-integration by meteorcloudy a year ago
- Disable macOS for TensorFlow (#1617) Due to https://github.com/tensorflow/tensorflow/issues/58368 Fixing: https://github.com/bazelbuild/continuous-integration/issues/1587 — committed to fmeum/continuous-integration by meteorcloudy a year ago
@bhack, @feranick, and @sushreebarsa
It’s not a compiler issue, it’s a linker (ld) issue. As I said it seems Apple folks changed ld recently. I managed to build recent master branch with Xcode 14.1 by replacing the ld with the one from Xcode 13.x. My Xcode 14.1 is installed at /Application, I backed up the
ldinand replaced it with the one from 13.
The ld from Xcode 13.4.1 works for me
ld from 14.x, e.g, 14.1 doesn’t work
Unfortunately, it seems publicly available
ld64source code is 609,https://github.com/apple-oss-distributions/ld64/tree/ld64-609. I cannot find ld64 7xx and 8xx. So I don’t know what exactly the issue is.I can confirm that XCode 14.3 with `ld’ version 857 now works, and compilation is successful. I am going to close this as resolved.
I’ve tried with Xcode_14.3_Release_Candidate and now TF 2.12 compilation failed with
The issue still applies to TF 2.12-rc0. Same error.
Either way works, it is an environment variable for specifying the active developer directory for Xcode. If using a .bazelrc file, include
build --action_env DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developerin it.Ah, thats unfortunate. Thank you for the insight!
Set
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer(path to Xcode) and try running the build again.Not sure if this issue is related but we have seen
ld: malformed trieerrors when trying to build with Xcode command line tools. The issue goes away if built with the full Xcode. (see related comment)Hi guys, Xcode 14.2 RC is out. Maybe it will help you?