I'm trying to create a grpc service in Python. I'm using Bazel to drive the 
creation process.

My MODULE.bazel file:

module(name = "test", version = "1.0")

bazel_dep(name = "grpc", version = "1.63.1")
bazel_dep(name = "protobuf", version = "27.1")

My BUILD.bazel file:

package(default_visibility = ["//visibility:public"])

load("@grpc//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")

proto_library(
    name = "service_proto",
    srcs = ["service.proto"],
)

py_proto_library(
    name = "service_py_proto",
    deps = [":service_proto"],
)

py_grpc_library(
    name = "service_py_grpc",
    srcs = [":service_proto"],
    deps = [":service_py_proto"],
)

The service itself is trivial:

syntax = "proto3";

package test;

service Service {
    rpc Method(Request) returns (Response);
}

message Request {
    optional string request = 1;
}

message Response {
    optional string response = 1;
}

I first run `bazel clean --expunge` to make sure I'm in a clean state. Then 
I do `bazel build //:service_py_grpc". After running a few thousand 
actions, the build fails with:

ERROR: 
/private/var/tmp/_bazel_rgenter/e09a5588dd81d6de404e0f9df267a52c/external/grpc~/src/python/grpcio/grpc/_cython/BUILD.bazel:25:12:
 
Linking external/grpc~/src/python/grpcio/grpc/_cython/cygrpc.so failed: 
(Exit 1): cc_wrapper.sh failed: error executing CppLink command (from 
target @@grpc~//src/python/grpcio/grpc/_cython:cygrpc.so) 
external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh 
@bazel-out/darwin_arm64-fastbuild/bin/external/grpc~/src/python/grpcio/grpc/_cython/cygrpc.so-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the 
sandbox build root for debugging
Undefined symbols for architecture arm64:
  "_PyArg_UnpackTuple", referenced from:
      __Pyx_Coroutine_Throw(_object*, _object*) in cygrpc.o
      __Pyx_async_gen_athrow_send(__pyx_PyAsyncGenAThrow*, _object*) in 
cygrpc.o
  "_PyAsyncGen_Type", referenced from:
      __Pyx_PyGen_Send(PyGenObject*, _object*) in cygrpc.o
  "_PyBaseObject_Type", referenced from:
      __Pyx_InBases(_typeobject*, _typeobject*) in cygrpc.o
      __Pyx_setup_reduce(_object*) in cygrpc.o
      __pyx_tp_new_7_cython_6cygrpc__ChannelArg(_typeobject*, _object*, 
_object*) in cygrpc.o
      __pyx_tp_new_7_cython_6cygrpc__ChannelArgs(_typeobject*, _object*, 
_object*) in cygrpc.o
      __pyx_tp_new_7_cython_6cygrpc_Call(_typeobject*, _object*, _object*) 
in cygrpc.o
      __pyx_tp_new_7_cython_6cygrpc__CallState(_typeobject*, _object*, 
_object*) in cygrpc.o
      __pyx_tp_new_7_cython_6cygrpc__ChannelState(_typeobject*, _object*, 
_object*) in cygrpc.o
      ...
  "_PyByteArray_Type", referenced from:
      __Pyx_PyObject_AsStringAndSize(_object*, long*) in cygrpc.o
      PyByteArray_GET_SIZE(_object*) in cygrpc.o
      PyByteArray_AS_STRING(_object*) in cygrpc.o
      
__pyx_f_7_cython_6cygrpc_23ReceiveMessageOperation_un_c(__pyx_obj_7_cython_6cygrpc_ReceiveMessageOperation*)
 
in cygrpc.o

...a few thousand more lines omitted.

Every undefined symbol starts with "Py". I'm assuming it's the Cython 
implementation. What have I configured incorrectly?

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/64c92528-ec58-4776-940f-80331fc3690an%40googlegroups.com.

Reply via email to