When building TensorFlow with Bazel, you might encounter the following error:
$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
...
tensorflow/core/kernels/fifo_queue.cc:59:43: error: expected body of lambda expression
[tuple, this](Attempt* attempt) EXCLUSIVE_LOCKS_REQUIRED(mu_) {
^
./tensorflow/core/platform/default/thread_annotations.h:89:3: note: expanded from macro 'EXCLUSIVE_LOCKS_REQUIRED'
THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))
^
./tensorflow/core/platform/default/thread_annotations.h:42:42: note: expanded from macro 'THREAD_ANNOTATION_ATTRIBUTE__'
#define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
^
...
6 warnings and 4 errors generated.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
...
$
Check your gcc version as follows:
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
$
Upgrade your gcc version by upgrading Xcode to the latest version (in my case, 7.2.1):
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
$
Reference:
https://github.com/tensorflow/tensorflow/issues/1192
No comments:
Post a Comment