Meson build system with gRPC

Viewed 77

I am trying to use the meson build system and gRPC as a dependency. Here's my example project:

helloworld
├── helloworld.cpp
├── meson.build
└── subprojects
    └── grpc.wrap

Here's the meson.build file:

project('helloworld', 'cpp',
  version : '0.1',
  default_options : ['warning_level=3',
                     'cpp_std=c++17'])

cmake = import('cmake')
grpc_sub = cmake.subproject('grpc')

grpc_dep = grpc_sub.dependency('grpc++')

exe = executable('helloworld', 'helloworld.cpp', dependencies: [grpc_dep])

test('basic', exe)

Here is the grpc.wrap file:

[wrap-git]

url = https://github.com/grpc/grpc.git
revision = master
depth = 1
clone-recursive = true

Contents of helloworld.cpp don't matter for the time being.

Then I do meson build. This downloads gRPC and all its sub projects. Then I do cd build and build it with ninja. The build process goes fine, but towards the end it fails:

[1/496] Generating subprojects/grpc/custom_tgt_6 with a custom command
FAILED: subprojects/grpc/reflection.grpc.pb.cc subprojects/grpc/reflection.grpc.pb.h subprojects/grpc/reflection_mock.grpc.pb.h subprojects/grpc/reflection.pb.cc subprojects/grpc/reflection.pb.h 
/usr/bin/meson --internal cmake_run_ctgt -o subprojects/grpc/reflection.grpc.pb.cc subprojects/grpc/reflection.grpc.pb.h subprojects/grpc/reflection_mock.grpc.pb.h subprojects/grpc/reflection.pb.cc subprojects/grpc/reflection.pb.h -O /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/reflection/v1alpha/reflection_mock.grpc.pb.h /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.cc /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.h -d /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/protos --grpc_out=generate_mock_code=true:/home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens --cpp_out=/home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens --plugin=protoc-gen-grpc= -I . -I /home/ayxan/src/helloworld/subprojects/grpc/third_party/protobuf/src src/proto/grpc/reflection/v1alpha/reflection.proto ';;;'
usage: meson [-h] -d D -o O [O ...] [-O [O ...]] ...
meson: error: unrecognized arguments: --grpc_out=generate_mock_code=true:/home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens --cpp_out=/home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens --plugin=protoc-gen-grpc= -I
[2/496] Generating subprojects/grpc/custom_tgt_0 with a custom command
FAILED: subprojects/grpc/channelz.grpc.pb.cc subprojects/grpc/channelz.grpc.pb.h subprojects/grpc/channelz_mock.grpc.pb.h subprojects/grpc/channelz.pb.cc subprojects/grpc/channelz.pb.h 
/usr/bin/meson --internal cmake_run_ctgt -o subprojects/grpc/channelz.grpc.pb.cc subprojects/grpc/channelz.grpc.pb.h subprojects/grpc/channelz_mock.grpc.pb.h subprojects/grpc/channelz.pb.cc subprojects/grpc/channelz.pb.h -O /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/channelz/channelz.grpc.pb.cc /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/channelz/channelz.grpc.pb.h /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/channelz/channelz_mock.grpc.pb.h /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/channelz/channelz.pb.cc /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens/src/proto/grpc/channelz/channelz.pb.h -d /home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/protos --grpc_out=generate_mock_code=true:/home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens --cpp_out=/home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens --plugin=protoc-gen-grpc= -I . -I /home/ayxan/src/helloworld/subprojects/grpc/third_party/protobuf/src src/proto/grpc/channelz/channelz.proto ';;;'
usage: meson [-h] -d D -o O [O ...] [-O [O ...]] ...
meson: error: unrecognized arguments: --grpc_out=generate_mock_code=true:/home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens --cpp_out=/home/ayxan/src/helloworld/build/subprojects/grpc/__CMake_build/gens --plugin=protoc-gen-grpc= -I

It looks like some sub-command is failing. The one that's trying to invoke protoc is failing because, for some reason, it tries to pass the arguments of protoc to meson itself. And meson doesn't recognize these arguments.

What am I doing wrong? How do we fix this?

0 Answers
Related