Hello everybody,
I am trying to build a universal binary of libtensorflow.
I am using the Bazel command here mentioned. The build process seems to start correctly but after some hours it ends with some linking errors, something like the header files are not found.
What should I check to avoid this behaviour and to complete successfully the build?
Thanks in advance for your help.
depending on the version of clang that you’re using, some warnings may show up as errors. add these options to your build --copt=-Wno-gnu-offsetof-extensions --copt=-Wno-error=unused-command-line-argument
and also --verbose_failures
for better build fail error output.
Hello @Roland_Daynauth, thank you for your suggestions. I have re-configured the build and executed the following command:
bazelisk build --config=opt --cpu=darwin_arm64 --host_cpu=darwin_x86_64 //tensorflow/tools/lib_package:libtensorflow --verbose_failures --copt=-Wno-gnu-offsetof-extensions --copt=-Wno-error=unused-command-line-argument
After some hours of computation, I still see some errors. Here is one of them:
ERROR: /Users/<me>/Github/tensorflow/tensorflow/tensorflow/cc/BUILD:675:22: Linking tensorflow/cc/ops/string_ops_gen_cc [for tool] failed: (Exit 1): cc_wrapper.sh failed: error executing command (from target //tensorflow/cc:ops/string_ops_gen_cc)
(cd /private/var/tmp/<bazel_folder>/41c06c9af3b7532628a873971f3ab866/execroot/org_tensorflow && \
exec env - \
APPLE_SDK_PLATFORM=MacOSX \
APPLE_SDK_VERSION_OVERRIDE=11.0 \
PATH=/Users/<me>/Library/Caches/bazelisk/downloads/sha256/fc8078f7e9f84406bb677e4c863fe1f7692aba331b04c995f2e3eab9aec10bbf/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/opt/php@7.4/sbin:/usr/local/opt/php@7.4/bin:/Users/<me>/opt/anaconda3/bin:/Users/<me>/opt/anaconda3/condabin:/Users/<me>/.gem/ruby/2.7.0/bin:/usr/local/opt/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin \
XCODE_VERSION_OVERRIDE=12.2.0.12B45b \
ZERO_AR_DATE=1 \
external/local_config_cc/cc_wrapper.sh @bazel-out/darwin_x86_64-opt-exec-50AE0418/bin/tensorflow/cc/ops/string_ops_gen_cc-2.params)
# Configuration: 379f895b614b53d7d7203198996c81b9a5f344ae0991b3df834261ea5c3f13b7
# Execution platform: @local_execution_config_platform//:platform
ld: library not found for -l:libtensorflow_framework.so.2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in child process '/usr/bin/xcrun'. 1
Target //tensorflow/tools/lib_package:libtensorflow failed to build
It is weird because by executing a simple find
command, those library files are found. What should I better check in order to solve this issue?
Hello everybody, here is a humble follow-up, since I still didn’t solve the issue in question.
Anyway, I tried to relaunch the original bazelisk
command by adding some directives to gcc
:
bazelisk build --config=opt --cpu=darwin_arm64 --host_cpu=darwin_x86_64 //tensorflow/tools/lib_package:libtensorflow --verbose_failures --copt=-Wno-gnu-offsetof-extensions --copt=-Wno-error=unused-command-line-argument --copt=-I/private/var/tmp/_bazel_<me>/41c06c9af3b7532628a873971f3ab866/execroot/org_tensorflow/bazel-out/darwin_x86_64-opt-exec-50AE0418/bin/tensorflow/ --copt=-L/private/var/tmp/_bazel_<me>/41c06c9af3b7532628a873971f3ab866/execroot/org_tensorflow/bazel-out/darwin_x86_64-opt-exec-50AE0418/bin/tensorflow/
In particular:
/private/var/tmp/_bazel_<me>/41c06c9af3b7532628a873971f3ab866/execroot/org_tensorflow/bazel-out/darwin_x86_64-opt-exec-50AE0418/bin/tensorflow/
is the folder where the command find
found a file named libtensorflow_framework.so.2
.
So, in theory now there should be all the directives to allow gcc
find the library file. However, the issue still persists, since the same errors are returned during build.
I am wondering if the character :
might be the source of the issue, since I expected something like -llibtensorflow_framework.so.2
, honestly speaking. Does it make sense what I am saying? If yes, how could I remove that character? Should there be a script built from bazel
which executes that command? How could I find it?
Welcome to the TensorFlow Forum!
Please check if you have correct xcode
version as mentioned in this TF build from source link and set the library path correctly. Please follow the instructed steps mentioned in the given link.
Let us know if the issue still persists. Thank you.