0

I am trying to cross compile a basic gRPC server for an ARMv7 platform using Bazel.


Details

  • Building on Ubuntu 14.04 with Bazel
  • Target platform: Petalinux on Zynq 7000
  • My company supports a bazel rule which runs the gRPC code generation tools, and this depends on gRPC v1.27.0, since that is the only version of the gRPC repo which my company supports.
  • I was able to add gRPC v1.38.1 to my sysroot (I think that is the only supported version). This allowed me to add gRPC shared objects to my Bazel environment using the cc_import rule.

Expected Outcome

  • I expected that Bazel would run the code generation tools and service class source code would be generated. This was true.
  • I expected that I would be able to include the generated source files from the generation rule when cross compiling my server. This was true.
  • I expected that the cross compiler (using grpc v1.38.1) would compile my server which included source files generated by grpc v1.27.0. This did not work, pasting the error below:
ERROR: /home/mromlewski/second_petalinux_driving/driving/experimental/mromlewski/grpc_arm/BUILD:29:11: Compiling experimental/mromlewski/grpc_arm/grpc_interface.cpp failed: (Exit 1): arm-linux-gnueabihf-gcc failed: error executing command external/petalinux_x86_64_aarch32_gcc_11_2_0/bin/arm-linux-gnueabihf-gcc -Wall -Werror -Wno-error-switch -Wno-erorr-float -DNDEBUG -ggdb -no-canonical-prefixes -mthumb '-mfpu=neon' '-mfloat-abi=hard' ... (remaining 21 argument(s) skipped)
In file included from bazel-out/k8-fastbuild-ST-60abce904cf1/bin/experimental/mromlewski/grpc_arm/hello.grpc.pb.h:7,
                 from ./experimental/mromlewski/grpc_arm/protos.h:3,
                 from experimental/mromlewski/grpc_arm/grpc_interface.h:3,
                 from experimental/mromlewski/grpc_arm/grpc_interface.cpp:1:
bazel-out/k8-fastbuild-ST-60abce904cf1/bin/experimental/mromlewski/grpc_arm/hello.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
   17 | #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer headers. Please regenerate this file with a newer version of protoc.

...
bazel-out/k8-fastbuild-ST-60abce904cf1/bin/experimental/mromlewski/grpc_arm/hello.grpc.pb.h:243:17: error: 'grpc_impl' in namespace '::' does not name a type; did you mean 'grpc_op'?
  243 |           new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>(
      |                 ^~~~~~~~~
      |                 grpc_op


What I've Tried

  • I cannot find an easy way to tell Yocto to use gRPC v1.27.0 to match my company's version. It seems to default to v1.38.1. If anyone can tell me how to include v1.27.0 in my rootfs and SDK using Petalinux please let me know.
  • Adding gRPC v1.38.1 to my company's third party support. This did not work as our version of Protobuf(v3.9.2) was incompatible with gRPC v1.38.1. After adding a more compatible version of Protobuf (v3.19), I still encountered a lot of Bazel/compatibility issues that I need to work though (will update this post with details).

Thank you

0 Answers0