koth/kcws

bazel build //kcws/cc:seg_backend_api 编译报错

yao8822 opened this issue · 6 comments

ERROR: /root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/BUILD:434:1: Traceback (most recent call last):
File "/root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/BUILD", line 434
cc_proto_library(name = "cc_test_protos", srcs = (L...), <4 more arguments>)
File "/root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/protobuf.bzl", line 247, in cc_proto_library
cc_libs += [default_runtime]
trying to mutate a frozen object
ERROR: /root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/BUILD:728:1: Traceback (most recent call last):
File "/root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/BUILD", line 728
py_proto_library(name = "python_specific_test_pro...", <6 more arguments>)
File "/root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/protobuf.bzl", line 373, in py_proto_library
py_libs += [default_runtime]
trying to mutate a frozen object
ERROR: /root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/BUILD:113:1: Target '@protobuf//:ios_arm64' contains an error and its package is in error and referenced by '@protobuf//:protobuf'
ERROR: /root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/BUILD:113:1: Target '@protobuf//:ios_armv7' contains an error and its package is in error and referenced by '@protobuf//:protobuf'
ERROR: /root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/BUILD:113:1: Target '@protobuf//:ios_armv7s' contains an error and its package is in error and referenced by '@protobuf//:protobuf'
ERROR: /root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/BUILD:113:1: Target '@protobuf//:android' contains an error and its package is in error and referenced by '@protobuf//:protobuf'
ERROR: /usr/local/projects/kcws/kcws/cc/BUILD:3:1: Target '@protobuf//:protobuf' contains an error and its package is in error and referenced by '//kcws/cc:tf_seg_model'
ERROR: Analysis of target '//kcws/cc:seg_backend_api' failed; build aborted: Loading failed
INFO: Elapsed time: 2.413s
FAILED: Build did NOT complete successfully (0 packages loaded)

koth commented

目测是bazel版本问题,你的bazel版本多少?

bazel [是0.11的版本,换了0.4.5版本,跑了下,还是有些问题:
/usr/bin/install -c -m 644 'libgflags_nothreads.pc' '/root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/execroot/kcws/bazel-out/local-fastbuild/genfiles/third_party/gflags/lib/pkgconfig/libgflags_nothreads.pc'
make[1]: Leaving directory `/tmp/gflags.8cMsM/gflags-2.0'
ERROR: /root/.cache/bazel/_bazel_root/c57281e52862ca1f4c15bbb22593b787/external/protobuf/BUILD:113:1: C++ compilation of rule '@protobuf//:protobuf' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-D_GLIBCXX_USE_CXX11_ABI=0' '-std=c++0x' ... (remaining 36 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
external/protobuf/src/google/protobuf/extension_set_heavy.cc: In member function 'int google::protobuf::internal::ExtensionSet::SpaceUsedExcludingSelf() const':
external/protobuf/src/google/protobuf/extension_set_heavy.cc:350:32: error: 'const struct google::protobuf::internal::ExtensionSet::Extension' has no member named 'SpaceUsedExcludingSelf'
total_size += iter->second.SpaceUsedExcludingSelf();
^
external/protobuf/src/google/protobuf/extension_set_heavy.cc: At global scope:
external/protobuf/src/google/protobuf/extension_set_heavy.cc:356:32: error: no 'int google::protobuf::internal::ExtensionSet::RepeatedMessage_SpaceUsedExcludingSelf(google::protobuf::internal::RepeatedPtrFieldBase*)' member function declared in class 'google::protobuf::internal::ExtensionSet'
RepeatedPtrFieldBase* field) {
^
external/protobuf/src/google/protobuf/extension_set_heavy.cc:360:55: error: no 'int google::protobuf::internal::ExtensionSet::Extension::SpaceUsedExcludingSelf() const' member function declared in class 'google::protobuf::internal::ExtensionSet::Extension'
int ExtensionSet::Extension::SpaceUsedExcludingSelf() const {
^
In file included from external/protobuf/src/google/protobuf/extension_set_heavy.cc:41:0:
/usr/local/protobuf/include/google/protobuf/extension_set.h:483:10: error: 'struct google::protobuf::internal::ExtensionSet::Extension' is private
struct Extension {
^
external/protobuf/src/google/protobuf/extension_set_heavy.cc:360:5: error: within this context
int ExtensionSet::Extension::SpaceUsedExcludingSelf() const {
^
Target //kcws/cc:seg_backend_api failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 137.730s, Critical Path: 57.61s

清掉所有缓存可以了

还有个问题,我这运行的分词结果,跟demo不一样
“我想相互约会是在冬季”
我的结果是:我/ 想/ 相/ 互约会/ 是/ 在/ 冬季 ======分词错误:互约会
demo结果是:我/ 想/ 相互/ 约会/ 是/ 在/ 冬季 ======分词正确

koth commented

demo给出的效果训练语料很多,不止说明里的,有一些别人没授权的语料

bazel 版本换成0.7.0的版本可以