【问题标题】:when i use bazel to bulid libtensorflow_inference.so当我使用 bazel 构建 libtensorflow_inference.so
【发布时间】:2017-04-21 11:42:21
【问题描述】:

系统:ubuntu 16.04 巴泽尔:0.4.5 张量流:cpu 版本 r1.0 gcc 版本:(Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

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

错误是:

tensorflow/core/kernels/BUILD:3749:1: C++ compilation of rule '//tensorflow/core/kernels:android_tensorflow_kernels' failed: Process exited with status 1 [sandboxed].
tensorflow/core/kernels/split_v_op.cc:212:28: error: non-constant-expression cannot be narrowed from type 'value_type' (aka 'long long') to 'int' in initializer list [-Wc++11-narrowing]
          prefix_dim_size, split_sizes_vec[i], suffix_dim_size};
                           ^~~~~~~~~~~~~~~~~~
tensorflow/core/kernels/split_v_op.cc:172:12: note: in instantiation of member function 'tensorflow::SplitVOpCPU<int, long long>::Compute' requested here
  explicit SplitVOpCPU(OpKernelConstruction* c) : Base(c) {}
           ^
tensorflow/core/kernels/split_v_op.cc:355:19: note: in instantiation of member function 'tensorflow::SplitVOpCPU<int, long long>::SplitVOpCPU' requested here
TF_CALL_ALL_TYPES(REGISTER_SPLIT_LEN);
                  ^
tensorflow/core/kernels/split_v_op.cc:212:28: note: insert an explicit cast to silence this issue
          prefix_dim_size, split_sizes_vec[i], suffix_dim_size};
                           ^~~~~~~~~~~~~~~~~~
                           static_cast<int>( )
tensorflow/core/kernels/split_v_op.cc:212:28: error: non-constant-expression cannot be narrowed from type 'value_type' (aka 'long long') to 'int' in initializer list [-Wc++11-narrowing]
          prefix_dim_size, split_sizes_vec[i], suffix_dim_size};
                           ^~~~~~~~~~~~~~~~~~
tensorflow/core/kernels/split_v_op.cc:172:12: note: in instantiation of member function 'tensorflow::SplitVOpCPU<float, long long>::Compute' requested here
  explicit SplitVOpCPU(OpKernelConstruction* c) : Base(c) {}
           ^
tensorflow/core/kernels/split_v_op.cc:355:19: note: in instantiation of member function 'tensorflow::SplitVOpCPU<float, long long>::SplitVOpCPU' requested here
TF_CALL_ALL_TYPES(REGISTER_SPLIT_LEN);
                  ^
tensorflow/core/kernels/split_v_op.cc:212:28: note: insert an explicit cast to silence this issue
          prefix_dim_size, split_sizes_vec[i], suffix_dim_size};
                           ^~~~~~~~~~~~~~~~~~
                           static_cast<int>( )
tensorflow/core/kernels/split_v_op.cc:212:28: error: non-constant-expression cannot be narrowed from type 'value_type' (aka 'long long') to 'int' in initializer list [-Wc++11-narrowing]
          prefix_dim_size, split_sizes_vec[i], suffix_dim_size};
                           ^~~~~~~~~~~~~~~~~~
tensorflow/core/kernels/split_v_op.cc:172:12: note: in instantiation of member function 'tensorflow::SplitVOpCPU<tensorflow::bfloat16, long long>::Compute' requested here
  explicit SplitVOpCPU(OpKernelConstruction* c) : Base(c) {}
           ^
tensorflow/core/kernels/split_v_op.cc:356:1: note: in instantiation of member function 'tensorflow::SplitVOpCPU<tensorflow::bfloat16, long long>::SplitVOpCPU' requested here
REGISTER_SPLIT_LEN(bfloat16);
^
tensorflow/core/kernels/split_v_op.cc:353:3: note: expanded from macro 'REGISTER_SPLIT_LEN'
  REGISTER_SPLIT(type, int64);
  ^
tensorflow/core/kernels/split_v_op.cc:349:27: note: expanded from macro 'REGISTER_SPLIT'
                          SplitVOpCPU<type, len_type>);
                          ^
tensorflow/core/kernels/split_v_op.cc:212:28: note: insert an explicit cast to silence this issue
          prefix_dim_size, split_sizes_vec[i], suffix_dim_size};
                           ^~~~~~~~~~~~~~~~~~
                           static_cast<int>( )
3 errors generated.
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //tensorflow/contrib/android:libtensorflow_inference.so failed to build
Use --verbose_failures to see the command lines of failed build steps.

【问题讨论】:

    标签: android linux tensorflow bazel


    【解决方案1】:

    这些错误来自在 Android NDK r13 中从 gcc 切换到 Clang。为了在使用 Bazel 构建时获得最佳结果,请暂时使用 NDK r12b。

    【讨论】:

    • 非常感谢,一开始我用的是r14b版本,现在我用的是r12b版本,没问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-10
    • 1970-01-01
    • 1970-01-01
    • 2018-05-07
    • 1970-01-01
    相关资源
    最近更新 更多