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

Bazel build error - C++ compilation of rule '//tensorflow/core:protos_all_proto_cc_impl' failed #5728

Closed
timur-st94 opened this issue Aug 1, 2018 · 1 comment

Comments

@timur-st94
Copy link

Description of the problem:

I'm trying to build the .so file using bazel and getting error:

INFO: From Linking external/protobuf_archive/libprotobuf.a [for host]:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/protobuf_archive/libprotobuf.a(gzip_stream.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/protobuf_archive/libprotobuf.a(error_listener.o) has no symbols
INFO: From Linking external/protobuf_archive/libprotobuf_lite.a [for host]:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/protobuf_archive/libprotobuf_lite.a(arenastring.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: bazel-out/host/bin/external/protobuf_archive/libprotobuf_lite.a(io_win32.o) has no symbols
INFO: From ProtoCompile tensorflow/core/lib/core/error_codes.pb.cc:
bazel-out/armeabi-v7a-opt/genfiles/external/protobuf_archive/src: warning: directory does not exist.
INFO: From ProtoCompile tensorflow/core/example/example.pb.cc:
bazel-out/armeabi-v7a-opt/genfiles/external/protobuf_archive/src: warning: directory does not exist.
bazel-out/armeabi-v7a-opt/genfiles/external/protobuf_archive/src: warning: directory does not exist.
ERROR: /Users/apple/Desktop/android/tensorflow/tensorflow/core/BUILD:2320:1: C++ compilation of rule '//tensorflow/core:protos_all_proto_cc_impl' failed (Exit 1)
In file included from bazel-out/armeabi-v7a-opt/genfiles/tensorflow/core/framework/kernel_def.pb.cc:4:
In file included from bazel-out/armeabi-v7a-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:9:
In file included from external/protobuf_archive/src/google/protobuf/stubs/common.h:52:
In file included from external/protobuf_archive/src/google/protobuf/stubs/mutex.h:33:
In file included from external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include/mutex:35:
external/androidndk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/c++0x_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
 
In file included from bazel-out/armeabi-v7a-opt/genfiles/tensorflow/core/framework/kernel_def.pb.cc:4:
In file included from bazel-out/armeabi-v7a-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:9:
In file included from external/protobuf_archive/src/google/protobuf/stubs/common.h:52:
external/protobuf_archive/src/google/protobuf/stubs/mutex.h:58:8: error: no type named 'mutex' in namespace 'std'
  std::mutex mu_;

In file included from bazel-out/armeabi-v7a-opt/genfiles/tensorflow/core/framework/kernel_def.pb.cc:4:
In file included from bazel-out/armeabi-v7a-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:9:
In file included from external/protobuf_archive/src/google/protobuf/stubs/common.h:53:
external/protobuf_archive/src/google/protobuf/stubs/callback.h:346:25: error: no type named 'remove_reference' in namespace 'std'
  typedef typename std::remove_reference<T>::type base_type;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:346:41: error: expected member name or ';' after declaration specifiers
  typedef typename std::remove_reference<T>::type base_type;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:347:17: error: unknown type name 'base_type'
  typedef const base_type& type;
                
external/protobuf_archive/src/google/protobuf/stubs/callback.h:401:17: error: no type named 'remove_reference' in namespace 'std'
  typename std::remove_reference<P1>::type p1_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:401:33: error: expected member name or ';' after declaration specifiers
  typename std::remove_reference<P1>::type p1_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:402:17: error: no type named 'remove_reference' in namespace 'std'
  typename std::remove_reference<P2>::type p2_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:402:33: error: expected member name or ';' after declaration specifiers
  typename std::remove_reference<P2>::type p2_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:403:17: error: no type named 'remove_reference' in namespace 'std'
  typename std::remove_reference<P3>::type p3_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:403:33: error: expected member name or ';' after declaration specifiers
  typename std::remove_reference<P3>::type p3_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:404:17: error: no type named 'remove_reference' in namespace 'std'
  typename std::remove_reference<P4>::type p4_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:404:33: error: expected member name or ';' after declaration specifiers
  typename std::remove_reference<P4>::type p4_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:405:17: error: no type named 'remove_reference' in namespace 'std'
  typename std::remove_reference<P5>::type p5_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:405:33: error: expected member name or ';' after declaration specifiers
  typename std::remove_reference<P5>::type p5_;

external/protobuf_archive/src/google/protobuf/stubs/callback.h:383:9: error: member initializer 'p1_' does not name a non-static data member or base class
        p1_(p1),

external/protobuf_archive/src/google/protobuf/stubs/callback.h:384:9: error: member initializer 'p2_' does not name a non-static data member or base class
        p2_(p2),

external/protobuf_archive/src/google/protobuf/stubs/callback.h:385:9: error: member initializer 'p3_' does not name a non-static data member or base class
        p3_(p3),

external/protobuf_archive/src/google/protobuf/stubs/callback.h:386:9: error: member initializer 'p4_' does not name a non-static data member or base class
        p4_(p4),

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 159.375s, Critical Path: 27.30s
INFO: 214 processes: 214 local.
FAILED: Build did NOT complete successfully

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

bazel build -c opt //tensorflow/contrib/android:libtensorflow_inference.so --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cpu=armeabi-v7a

What operating system are you running Bazel on?

macOS High Sierra 10.13.3

What's the output of bazel info release?

release 0.15.2

Any other information, logs, or outputs that you want to share?

I have tried build use android-ndk-r13b and android-ndk-r16b

@jin
Copy link
Member

jin commented Aug 1, 2018

Please try building again with the --cxxopt=-std=c++11 flag. Also, please open Tensorflow build errors at github.com/tensorflow/tensorflowl, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants