I was trying "Run the tests", and saw some failures, apparently due to having GCC linked under gcc
/g++
instead of clang, on macOS:
ERROR: /private/var/tmp/_bazel_ryan/b82c47e810a34e3560644976a9c6bf6f/external/protobuf_archive/BUILD:626:1: Linking of rule '@protobuf_archive//:python/google/protobuf/internal/_api_implementation.so' failed (Exit 1)
gcc: error: unrecognized command line option '-fobjc-link-runtime'; did you mean '-fgnu-runtime'?
Specifying clang
in the CC
env var seemed to work:
CC=clang bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/lite/...
This comment pointed me to this fix: bazelbuild/bazel#4077 (comment)
For completeness:
- I'm trying to build the latest release
1.13.1
- I had to cherry-pick in:
- https://github.com/tensorflow/tensorflow/commit/8c22259497e9914c37a7adcd33aebaf754473a02
- for protobuf dependencies
- cf. tensorflow/tensorflow#25000 (comment))
- https://github.com/tensorflow/tensorflow/commit/91da898cb6f6b0e751e15ceb813a37cdfe18a035
- bump max Bazel version to 0.22.0
- that's what I have from
brew
, and didn't want to bother with downgrading Bazel to 0.21.0 - cf. bazelbuild/bazel#7340 (comment)
- https://github.com/tensorflow/tensorflow/commit/8c22259497e9914c37a7adcd33aebaf754473a02
brew install bazel
bazel --version
git clone [email protected]:tensorflow/tensorflow.git
cd tensorflow
git checkout v1.13.1
git cherry-pick 8c22259497e9914c37a7adcd33aebaf754473a02 # upgrade something related to protobufs
git cherry-pick 91da898cb6f6b0e751e15ceb813a37cdfe18a035 # bump max bazel version to 0.22.0
Defaults seem fine:
yes "" | ./configure
CC=clang bazel build -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/lite/...
This command took 45mins on an 8-core macbook, and ran 14k targets, iirc.
CC=clang bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/lite/...
Several failures due to pip
modules needing to be installed:
pip install scipy portpicker tensorflow-estimation
to be continued