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

TF 2.11.0/2.12 fails to build in MacOS 13 - XCode 14.1 - issue with ld linker #58368

Closed
feranick opened this issue Oct 29, 2022 · 36 comments
Closed
Assignees
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype:bazel Bazel related Build_Installation issues subtype:macOS macOS Build/Installation issues TF 2.10 type:build/install Build and install issues

Comments

@feranick
Copy link
Contributor

feranick commented Oct 29, 2022

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
@google-ml-butler google-ml-butler bot added the type:build/install Build and install issues label Oct 29, 2022
@mohantym mohantym added subtype:macOS macOS Build/Installation issues subtype:bazel Bazel related Build_Installation issues TF 2.10 labels Oct 30, 2022
@mohantym
Copy link
Contributor

@sushreebarsa !
Could you look at this issue.
Thank you!

@mohantym mohantym assigned sushreebarsa and unassigned mohantym Oct 31, 2022
@feranick
Copy link
Contributor Author

feranick commented Nov 3, 2022

Bug persists with TF 2.11-rc2 and stable release of XCode 14.1.

@freedomtan
Copy link
Contributor

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.

@sushreebarsa sushreebarsa added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Nov 4, 2022
@feranick
Copy link
Contributor Author

feranick commented Nov 4, 2022

Technically, bazel allows for downloading a "fresh version" of clang upon configuring TF previous to compilation. But that option is broken.

See related issues:
#46976
#58453

@bhack
Copy link
Contributor

bhack commented Nov 10, 2022

Technically, bazel allows for downloading a "fresh version" of clang upon configuring TF previous to compilation. But that option is broken.

See related issues:
#46976
#58453

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.

@feranick
Copy link
Contributor Author

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 .bazelrc. That could at least be a way to test versions that do work. Suggestions are welcome.

@freedomtan
Copy link
Contributor

freedomtan commented Nov 21, 2022

@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 ld in

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/

and replaced it with the one from 13.

The ld from Xcode 13.4.1 works for me

$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-764
BUILD 11:29:01 May 17 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 13.1.6, (clang-1316.0.21.2.5) (static support for 28, runtime is 28)
TAPI support using: Apple TAPI version 13.1.6 (tapi-1316.0.7.3)

ld from 14.x, e.g, 14.1 doesn't work

@(#)PROGRAM:ld  PROJECT:ld64-820.1
BUILD 18:42:42 Sep 11 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)

Unfortunately, it seems publicly available ld64 source 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.

@feranick feranick changed the title TF 2.11.0-rc fails to build in MacOS 13 (Ventura) - XCode 14.1 TF 2.11.0 fails to build in MacOS 13 - XCode 14.1 - issue with ld linker Nov 25, 2022
@sushreebarsa sushreebarsa removed the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Dec 8, 2022
@flashlabs
Copy link

Hi guys, Xcode 14.2 RC is out. Maybe it will help you?

@feranick
Copy link
Contributor Author

feranick commented Dec 12, 2022

Hi guys, Xcode 14.2 RC is out. Maybe it will help you?

Thanks. Just tried (with both TF 2.11.0 and TF2.10) and it is still broken. Log attached (it's similar to the previous).
log.txt

@freedomtan
Copy link
Contributor

freedomtan commented Dec 12, 2022

According to xcrun ld -v, the ld comes with Xcode 14.2 RC is still ld64-820.1. The BUILD time changed, though.

@(#)PROGRAM:ld  PROJECT:ld64-820.1
BUILD 18:42:34 Sep 11 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)

@sachinprasadhs sachinprasadhs added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Dec 13, 2022
@learning-to-play learning-to-play removed their assignment Dec 14, 2022
@nitins17
Copy link
Member

nitins17 commented Dec 22, 2022

Not sure if this issue is related but we have seen ld: malformed trie errors when trying to build with Xcode command line tools. The issue goes away if built with the full Xcode. (see related comment)

It seems that XCode 14.x just ships a problematic linker, indeed, as downgrading to commandline tools 13.x (@(#)PROGRAM:ld PROJECT:ld64-764) resolves the issue, even if the deployment target/platform version is still 12.0 🤷

Ah, thats unfortunate. Thank you for the insight!

Can you please point to a howto guide on using the full XCode for compilation (rather than using the command tools? I'd be happy to try if this works.

Set DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer (path to Xcode) and try running the build again.

@feranick
Copy link
Contributor Author

Set DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer (path to Xcode) and try running the build again.

Thank you. Sorry for the silly question, but where should I set that flag? Bash profile? bazelrc?

@nitins17
Copy link
Member

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/Developer in it.

@freedomtan
Copy link
Contributor

Not sure if this issue is related but we have seen ld: malformed trie errors when trying to build with Xcode command line tools. The issue goes away if built with the full Xcode. (see related comment)

It seems that XCode 14.x just ships a problematic linker, indeed, as downgrading to commandline tools 13.x (@(#)PROGRAM:ld PROJECT:ld64-764) resolves the issue, even if the deployment target/platform version is still 12.0 shrug

Ah, thats unfortunate. Thank you for the insight!

Can you please point to a howto guide on using the full XCode for compilation (rather than using the command tools? I'd be happy to try if this works.

Set DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer (path to Xcode) and try running the build again.

@nitins17
I don't think that will work. My xcode-select -p was /Applications/Xcode.app/Contents/Developer (and xcrun -f ld reports right ld) and I ran into such problem. If I replace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld with ld from Xcode 13.x, then it goes. If setting DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer, then something is wrong (e.g., ld other than the one in /Applications/Xcode.app is used). I'll try it anyway.

@freedomtan
Copy link
Contributor

@nitins17 FYR. Setting DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer doesn't work for me on macOS 13.1 + Xcode 14.2 (either M1 or x86_64).

@feranick
Copy link
Contributor Author

feranick commented Feb 17, 2023

The issue still applies to TF 2.12-rc0. Same error.

  (cd /private/var/tmp/_bazel_feranick/50b852099a3bf3aaa184abce166f8e34/execroot/org_tensorflow && \
  exec env - \
    APPLE_SDK_PLATFORM=MacOSX \
    APPLE_SDK_VERSION_OVERRIDE=13.1 \
    PATH=/opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin:/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.2.0.14C18 \
    ZERO_AR_DATE=1 \
  external/local_config_cc/cc_wrapper.sh @bazel-out/host/bin/tensorflow/python/_pywrap_tensorflow_internal.so-2.params)
# Configuration: 2d4c6c40372f31a14f2a66c81d2ffdcff66f4f42f7d84d50ade0310423a8d138
# Execution platform: @local_execution_config_platform//:platform
ld: malformed trie, terminalSize extends beyond trie data file 'bazel-out/host/bin/_solib_darwin_x86_64/_U_S_Stensorflow_Spython_C_Upywrap_Utensorflow_Uinternal.so_Ucclib___Utensorflow/libtensorflow_cc.2.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: 25937 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/tools/pip_package/BUILD:73:10 Middleman _middlemen/tensorflow_Stools_Spip_Upackage_Ssimple_Uconsole-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.1 \
    PATH=/opt/local/Library/Frameworks/Python.framework/Versions/3.10/bin:/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.2.0.14C18 \
    ZERO_AR_DATE=1 \
  external/local_config_cc/cc_wrapper.sh @bazel-out/host/bin/tensorflow/python/_pywrap_tensorflow_internal.so-2.params)
# Configuration: 2d4c6c40372f31a14f2a66c81d2ffdcff66f4f42f7d84d50ade0310423a8d138
# Execution platform: @local_execution_config_platform//:platform
INFO: Elapsed time: 7766.822s, Critical Path: 1024.08s
INFO: 16824 processes: 4348 internal, 12476 local.```

@feranick feranick changed the title TF 2.11.0 fails to build in MacOS 13 - XCode 14.1 - issue with ld linker TF 2.11.0/2.12 fails to build in MacOS 13 - XCode 14.1 - issue with ld linker Feb 17, 2023
@feranick
Copy link
Contributor Author

feranick commented Feb 17, 2023

I am checking XCode 14.3 beta and it appears that ld is still in version 820.1, so there should be no difference in behavior compared to previous XCode 14.x.

@yanghired
Copy link

@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 ld in

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/

and replaced it with the one from 13.

The ld from Xcode 13.4.1 works for me

$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-764
BUILD 11:29:01 May 17 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 13.1.6, (clang-1316.0.21.2.5) (static support for 28, runtime is 28)
TAPI support using: Apple TAPI version 13.1.6 (tapi-1316.0.7.3)

ld from 14.x, e.g, 14.1 doesn't work

@(#)PROGRAM:ld  PROJECT:ld64-820.1
BUILD 18:42:42 Sep 11 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)

Unfortunately, it seems publicly available ld64 source 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.

Hi @freedomtan - thank you for your insights!
Could you please let me know how did you do - "replace the ld file in Xcode 14.x by an old version from Xcode 13.x"? Did you replace other files other than ld, or just the ld file?

Asking because I tried to ONLY replace the ld file, but I got the following info by running ld -v

@(#)PROGRAM:ld  PROJECT:ld64-764
BUILD 11:29:07 May 17 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 28, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)

It looks like the ld version is correct, but LLVM and TAPI versions are still incorrect.

Many thanks!

@feranick
Copy link
Contributor Author

feranick commented Mar 9, 2023

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.

@freedomtan
Copy link
Contributor

Hi @freedomtan - thank you for your insights! Could you please let me know how did you do - "replace the ld file in Xcode 14.x by an old version from Xcode 13.x"? Did you replace other files other than ld, or just the ld file?

replacing the ld is enough.

Asking because I tried to ONLY replace the ld file, but I got the following info by running ld -v

@(#)PROGRAM:ld  PROJECT:ld64-764
BUILD 11:29:07 May 17 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 28, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)

It looks like the ld version is correct, but LLVM and TAPI versions are still incorrect.

That should be fine.

@feranick
Copy link
Contributor Author

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..

@kulinseth
Copy link
Contributor

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.
Can you please check and verify?

@shkarupa-alex
Copy link
Contributor

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. Can you please check and verify?

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

@feranick
Copy link
Contributor Author

feranick commented Mar 31, 2023

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. Can you please check and verify?

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, ld included in this release has finally been updated to version 857 (from 820). I am testing it right now (and I am temporarily overriding the compiler warning above to get to the end of compilation). Will report soon.

@feranick
Copy link
Contributor Author

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

I filed a separate issue report for this issue: #60191

@feranick
Copy link
Contributor Author

feranick commented Apr 1, 2023

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.

@feranick feranick closed this as completed Apr 1, 2023
@google-ml-butler
Copy link

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

@feranick
Copy link
Contributor Author

feranick commented Apr 1, 2023

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).
Patch: issue_60191_patch.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype:bazel Bazel related Build_Installation issues subtype:macOS macOS Build/Installation issues TF 2.10 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests