Bazel built GRPC with a different result, depending on whether I used toolchain or not
Description of the problem / feature request:
I tried to used bazel build my project which includes grpc-dependency, when I not used toolchain, everything is ok!
command like this:
bazel build //src/main/cpp:xxxxxx
But when I tried to generate c++ .so files of different CPU architectures with toolchain, I can't build my project success!
command like this:
bazel build //src/main/cpp:xxxxxx --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a
Error Info:
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:166:14: error: 'OrphanablePtr' in namespace 'grpc_core' does not name a template type
grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message = nullptr;
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:168:43: error: 'nullptr' was not declared in this scope
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc: In constructor '{anonymous}::call_data::call_data(grpc_call_element*, const {anonymous}::channel_data&, const grpc_call_element_args&)':
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:122:56: **error**: 'nullptr' was not declared in this scope
const grpc_core::MessageSizeParsedConfig* limits = nullptr;
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:133:13: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
const auto* objs_vector =
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:133:19: **error**: ISO C++ forbids declaration of 'objs_vector' with no type [-fpermissive]
const auto* objs_vector =
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:134:26: **error**: 'class grpc_core::ServiceConfig' has no member named 'GetMethodParsedConfigVector'
chand.svc_cfg->GetMethodParsedConfigVector(args.path);
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:137:71: **error**: invalid types 'const int[size_t {aka unsigned int}]' for array subscript
(*objs_vector)[grpc_core::MessageSizeParser::ParserIndex()].get());
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc: In function 'void recv_message_ready(void*, grpc_error*)':
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:182:15: **error**: 'struct {anonymous}::call_data' has no member named 'recv_message'
if (*calld->recv_message != nullptr && calld->limits.max_recv_size >= 0 &&
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc: In function 'void recv_trailing_metadata_ready(void*, grpc_error*)':
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:226:41: **error**: 'nullptr' was not declared in this scope
if (calld->next_recv_message_ready != nullptr) {
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc: In function 'void start_transport_stream_op_batch(grpc_call_element*, grpc_transport_stream_op_batch*)':
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:246:33: **error**: 'struct grpc_transport_stream_op_batch_payload::<anonymous>' has no member named 'send_message'
op->payload->send_message.send_message->length() >
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:250:44: **error**: 'struct grpc_transport_stream_op_batch_payload::<anonymous>' has no member named 'send_message'
op->payload->send_message.send_message->length(),
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:265:12: **error:** 'struct {anonymous}::call_data' has no member named 'recv_message'
calld->recv_message = op->payload->recv_message.recv_message;
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:265:53: **error**: 'struct grpc_transport_stream_op_batch_payload::<anonymous>' has no member named 'recv_message'
calld->recv_message = op->payload->recv_message.recv_message;
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc: In function 'grpc_error* init_channel_elem(grpc_channel_element*, grpc_channel_element_args*)':
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:343:29: **error**: 'nullptr' was not declared in this scope
if (service_config_str != nullptr) {
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:345:5: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
auto svc_cfg = grpc_core::ServiceConfig::Create(service_config_str,
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:345:10: **error**: 'svc_cfg' does not name a type
auto svc_cfg = grpc_core::ServiceConfig::Create(service_config_str,
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:348:24: **error**: 'move' is not a member of 'std'
chand->svc_cfg = std::move(svc_cfg);
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:348:34: **error**: 'svc_cfg' was not declared in this scope
chand->svc_cfg = std::move(svc_cfg);
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc: In function 'bool maybe_add_message_size_filter_subchannel(grpc_channel_stack_builder*, void*)':
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:385:43: **error**: 'nullptr' was not declared in this scope
builder, &grpc_message_size_filter, nullptr, nullptr);
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc: In function 'bool maybe_add_message_size_filter(grpc_channel_stack_builder*, void*)':
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:403:22: **error**: 'nullptr' was not declared in this scope
if (svc_cfg_str != nullptr) {
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:408:45: error: 'nullptr' was not declared in this scope
builder, &grpc_message_size_filter, nullptr, nullptr);
^
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc: In function 'void grpc_message_size_filter_init()':
external/com_github_grpc_grpc/src/core/ext/filters/message_size/message_size_filter.cc:417:49: **error**: 'nullptr' was not declared in this scope
maybe_add_message_size_filter_subchannel, nullptr);
^
Target //src/main/cpp:libclient.so failed to build
Feature requests: what underlying problem are you trying to solve with this feature?
I found everywhere, but I can't find a useful demo about how to do cross-compile by high-version bazel.
it seems like official tutorial is not friendly to [Configuring C++ toolchains](https://docs.bazel.build/versions/0.29.0/tutorial/cc-toolchain-config.html#using-menu or Toolchains )
I don't know if there is a useful way for me to successfully generate the.so file of armeabi-v7a.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
- git clone [email protected]:HNU-Microsoft-Douzi/WxHomework.git
- cd grpc-project
- ./run
What operating system are you running Bazel on?
ubunt16.04
What's the output of bazel info release?
release 0.29.0
If bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.
bazel build //src/main/cpp:xxxxxx --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a
What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?
https://github.com/HNU-Microsoft-Douzi/WxHomework.git c5c5afc39fea9bd67816fc46e8e77e4d177f42d8 c5c5afc39fea9bd67816fc46e8e77e4d177f42d8
There anyone can help me? I think this bug may be cause by bazel-toolchain. If official can provide more easily way to do cross-compile, bazel community would be batter. For one '.so' file of armeabi-v7a I did too much work. Very grateful.
I tried my best to solve the question and get a great result! Thanks for watching this issue. The way of how I solve the question was post on my github page, may be can help someone else who want to use cross-compile! I will close the issue!