Skip to content

[grpc] codegen cross compilation support #46655

@JonatannQm

Description

@JonatannQm

Is your feature request related to a problem? Please describe.

When I cross compile grpc with codegen feature enabled and attempts to use protobuf_generate I get an issue that my grpc_cpp_plugin is not an executable.
After further inspection it seems that when crosscompiling grpc is not copying the host binaries to the tools folder.
(when comparing it to protobuf's port, it seems like there it is copying the host binaries when cross compiling)

Proposed solution

something along these lines

...
string(COMPARE EQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" gRPC_BUILD_GRPC_PLUGIN_BINARIES)
...
if (gRPC_BUILD_CODEGEN)
    if(gRPC_BUILD_GRPC_PLUGIN_BINARIES)
...
    else()
        file(COPY "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools")
    endif()
else()
...
endif()

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:port-featureThe issue is with a library, which is requesting new capabilities that didn’t exist

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions