grpc / grpc

The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)

Home Page:https://grpc.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

request support use bazel cross compile for arm with --incompatible_enable_cc_toolchain_resolution option

xiedeacc opened this issue · comments

my project import grpc 1.47.0, build will fail when cross compile for arm use bazel with --incompatible_enable_cc_toolchain_resolution option

error log:

ERROR: /root/.cache/bazel/_bazel_root/212dd51f8d897b720cf9b65a010c79c8/external/com_github_protocolbuffers_protobuf/BUILD:387:15: Generating Descriptor Set proto_library @com_github_protocolbuffers_protobuf//:descriptor_proto failed: (Exit 2): protoc.exe failed: error executing command bazel-out/k8-opt-exec-A1C23A69/bin/external/com_google_protobuf_protoc_linux_aarch64/protoc.exe ... (remaining 7 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
bazel-out/k8-opt-exec-A1C23A69/bin/external/com_google_protobuf_protoc_linux_aarch64/protoc.exe: 1:ELF▒▒A@▒▒@8: not found
bazel-out/k8-opt-exec-A1C23A69/bin/external/com_google_protobuf_protoc_linux_aarch64/protoc.exe: 1: Syntax error: word unexpected (expecting ")")
INFO: Elapsed time: 205.323s, Critical Path: 4.62s
INFO: 67 processes: 60 internal, 7 linux-sandbox.
FAILED: Build did NOT complete successfully

build command:

 clear && bazel build --incompatible_enable_cc_toolchain_resolution --platforms=@bazel_build_file//platforms:linux_gcc11_aarch64_none_musleabi -s --copt=-g3 --strip=never //...

demo:
https://github.com/xiedeacc/tbox

I found out protoc.exe generated for arm, not for host linux x86_64, so I think grpc not recognised it's a cross compilation, grpc may not recognise below option

--incompatible_enable_cc_toolchain_resolution --platforms=@bazel_build_file//platforms:linux_gcc11_aarch64_none_musleabi

it's grpc problem or I need specify other option to make it correct?

cc @jtattermusch
Jan, can you take a look please?

@jtattermusch can you take a look?

it's rules_proto problem or bazel has select defect