Build of Qt6.9.1 from source with gRPC and Protobuf in debug results in error: --qtgrpcgen_out: protoc-gen-qtgrpcgen: Plugin failed with status code 3221225781
-
I'm looking to use gRPC/Protobuf for a client/server application.
I've built from source using:
https://doc.qt.io/qt-6.9/windows-building.htmlI've installed the protobuf following:
https://doc.qt.io/qt-6.9/qtprotobuf-installation-windows-vcpkg.htmlThe build script breakdown I used:
-> Directories:
Purpose Path
Source C:\Projects\qt691-source
Debug Build C:\Projects\qt-build
Install Prefix C:\Qt\Qt-6.9.1
Protoc C:\Program Files\protoc-31.1-win64
vcpkg toolchain C:\Projects\vcpkg\scripts\buildsystems\vcpkg.cmake-> CMake (Debug)
cmake C:\Projects\qt691-source ^ -G Ninja ^ -DCMAKE_BUILD_TYPE=Debug ^ -DCMAKE_INSTALL_PREFIX=C:\Qt\Qt-6.9.1 ^ -DCMAKE_TOOLCHAIN_FILE=C:/Projects/vcpkg/scripts/buildsystems/vcpkg.cmake ^ -DQT_FEATURE_protobuf=ON ^ -DQT_FEATURE_grpc=ON ^ -DBUILD_qtprotobuf=ON ^ -DBUILD_qtgrpc=ON ^ -DProtobuf_PROTOC_EXECUTABLE="C:/Program Files/protoc-31.1-win64/bin/protoc.exe" ^ -DQT_BUILD_EXAMPLES=OFF ^ -DQT_BUILD_TESTS=OFF ^ -DCMAKE_VERBOSE_MAKEFILE=ON
-> Gives Debug build of Qt 6.9.1 — including gRPC and Protobuf — installed to C:\Qt\Qt-6.9.1.
The were no configure or build errors from this.
I've set this kit in QtCreator.
Configure works with no errors:However when I build I can the below error:
FAILED: smappoc-client/vehicleservice_client.grpc.qpb.h smappoc-client/vehicleservice_client.grpc.qpb.cpp smappoc-client/navigationservice_client.grpc.qpb.h smappoc-client/navigationservice_client.grpc.qpb.cpp smappoc-client/glLicense_client.grpc.qpb.h smappoc-client/glLicense_client.grpc.qpb.cpp smappoc-client/DataAcquisitionService_client.grpc.qpb.h smappoc-client/DataAcquisitionService_client.grpc.qpb.cpp C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client/vehicleservice_client.grpc.qpb.h C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client/vehicleservice_client.grpc.qpb.cpp C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client/navigationservice_client.grpc.qpb.h C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client/navigationservice_client.grpc.qpb.cpp C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client/glLicense_client.grpc.qpb.h C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client/glLicense_client.grpc.qpb.cpp C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client/DataAcquisitionService_client.grpc.qpb.h C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client/DataAcquisitionService_client.grpc.qpb.cpp
C:\Windows\system32\cmd.exe /C "cd /D C:\Projects_clientserverpoc\smappoc-gl-client-grpc\build\Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug\smappoc-client && "C:\Program Files\CMake\bin\cmake.exe" -DPROTOC_EXECUTABLE=C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/vcpkg_installed/x64-windows/tools/protobuf/protoc.exe -DPROTOC_ARGS=--plugin=protoc-gen-qtgrpcgen=C:/Qt/6.9.1-msvc2022-64bit-from-source-debug/bin/qtgrpcgen.exe;--qtgrpcgen_out=C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client;--qtgrpcgen_opt=;C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/smappoc-shared-protos/proto/examples/vehicleservice.proto;C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/smappoc-shared-protos/proto/examples/navigationservice.proto;C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/smappoc-shared-protos/proto/license/glLicense.proto;C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/smappoc-shared-protos/proto/acquisition/DataAcquisitionService.proto;-IC:/Projects/_clientserverpoc/smappoc-gl-client-grpc/smappoc-shared-protos/proto/acquisition;-IC:/Projects/_clientserverpoc/smappoc-gl-client-grpc/smappoc-shared-protos/proto/license;-IC:/Projects/_clientserverpoc/smappoc-gl-client-grpc/smappoc-shared-protos/proto/examples -DWORKING_DIRECTORY=C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/smappoc-client -DGENERATOR_NAME=qtgrpcgen -P C:/Qt/6.9.1-msvc2022-64bit-from-source-debug/lib/cmake/Qt6ProtobufTools/QtProtocCommandWrapper.cmake"
CMake Error at C:/Qt/6.9.1-msvc2022-64bit-from-source-debug/lib/cmake/Qt6ProtobufTools/QtProtocCommandWrapper.cmake:22 (message):
Unable to execute
C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/vcpkg_installed/x64-windows/tools/protobuf/protoc.exe:(1)
--qtgrpcgen_out: protoc-gen-qtgrpcgen: Plugin failed with status code
3221225781.From looking online I 'think' it's related to mixing debug/release - i.e. my build was debug but the dependency for the protoc.exe running in debug are missing as I think it's pulling the release files down from my vcpkg.json:
"dependencies": [
"grpc",
"protobuf"], "features": { "vcpkg-qt": { "description": "Use Qt libraries from vcpkg", "dependencies": [ { "name": "qtgrpc", "version>=": "6.9" }, { "name": "qtdeclarative", "version>=": "6.9" } ] } }
This project is a tweaked version of one of the Qt examples, which builds with Qt6.9.1 using the Qt pre-built msvc2022.
Due to LGPLv3 we need to be able to build the source our self.
My main open point is what is the correct way to build in debug, without having to manually build the protoc tools myself in debug.
If there's anything obviously wrong from how I've built this I'd be thankful for a second pair of eyes.
-
Hi @Ben-Campbell-Wallis, sorry for the delayed response. If you use vcpkg protobuf installation please make sure that the vcpkg tripplet binary directory is in PATH when you build your project. I expect that it should be something like "C:/Projects/_clientserverpoc/smappoc-gl-client-grpc/build/Desktop_Qt_6_9_1_MSVC2022_64bit-FromSrc-Debug/vcpkg_installed/x64-windows/bin" in your layout. It should help, but we probably need to think about setting it automatically. Qt delivers packages where protoc plugins are build statically, so you don't face missing dependency issues.