-
Notifications
You must be signed in to change notification settings - Fork 74k
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
TF 2.11.0/2.12 fails to build in MacOS 13 - XCode 14.1 - issue with ld linker #58368
Comments
@sushreebarsa ! |
Bug persists with TF 2.11-rc2 and stable release of XCode 14.1. |
FYR, mostly, this is a bug of Xcode 14.x (or more specifically ld? There were some new changes in ld. It failed to build gcc with some early Xcode 14 versions). I ran into this problem since early Xcode 14 betas. I could build TensorFlow with Xcode 13.x on macOS Monterey (12.x) without problems. When I tried to build it with Xcode 14 on macOS 12.x, it failed. |
Yes I don't know what was the rationale of this commit #58453 (comment) I think that this configuration is currently not tested by the CI jobs so that commit was not checked by the CI. |
Another approach may be to use one of the version of clang from MacPorts. I have several to choose from, but it is not clear how to enable such a version to compile TF in |
@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
and 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 |
Hi guys, Xcode 14.2 RC is out. Maybe it will help you? |
According to
|
Ah, thats unfortunate. Thank you for the insight!
Set |
Thank you. Sorry for the silly question, but where should I set that flag? Bash profile? bazelrc? |
Either way works, it is an environment variable for specifying the active developer directory for Xcode. If using a .bazelrc file, include |
@nitins17 |
@nitins17 FYR. Setting |
The issue still applies to TF 2.12-rc0. Same error.
|
I am checking XCode 14.3 beta and it appears that ld is still in version |
Hi @freedomtan - thank you for your insights! Asking because I tried to ONLY replace the ld file, but I got the following info by running ld -v
It looks like the ld version is correct, but LLVM and TAPI versions are still incorrect. Many thanks! |
As this is now affecting 2 releases (2.11 and the upcoming 2.12), the least that could be done is to put a warning on the release notes. |
replacing the ld is enough.
That should be fine. |
Would anyone have a workable version of ld to share? I can't install XCode 13.x once 14.x is in place with MacOS 13.x is installed.. |
Hi @feranick this is fixed in https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_14.3_beta_2/Xcode_14.3_beta_2.xip. |
I've tried with Xcode_14.3_Release_Candidate and now TF 2.12 compilation failed with ERROR: /private/var/tmp/_bazel_alex/dc1a9368c8e4ba5b96348c2850b37ab0/external/boringssl/BUILD:161:11: Compiling src/crypto/x509/t_x509.c [for host] failed: (Exit 1): cc_wrapper.sh failed: error executing command 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 44 arguments skipped)
external/boringssl/src/crypto/x509/t_x509.c:321:18: error: variable 'l' set but not used [-Werror,-Wunused-but-set-variable]
int ret = 0, l, i;
^
1 error generated.
Target //tensorflow/tools/pip_package:build_pip_package failed to build |
The same happens with the stable release XCode 14.3, but that is a completely separate issue. With regards of the original issue, |
I filed a separate issue report for this issue: #60191 |
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. |
For those interested, to solve the unrelated issue above, you can temporarily fix it by removing the unused variable, external/boringssl/src/crypto/x509/t_x509.c (see patch below). |
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?
Standalone code to reproduce the issue
Follow standard compilation from source as indicated here: https://www.tensorflow.org/install/source
Relevant log output
The text was updated successfully, but these errors were encountered: