Missing protobuf configuration when installing via ue4-conan

Viewed 246

I'm trying to get gRPC running in Unreal Engine 4, using the conan-ue4cli tool. I use the provided grpc-ue4 recipe linked here: https://github.com/adamrehn/ue4-conan-recipes/tree/master/grpc-ue4

While running ue4 conan build "grpc-ue4" an error is thrown "Could not find a package configuration file provided by "Protobuf""

Output:

...
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found c-ares: C:/Users/Redux Gamer/.conan/data/cares-ue4/1.16.1/adamrehn/4.27/package/7333dc905312a2df09e78e1a60d59e628a5f0321/lib/cmake/c-ares/c-ares-config.cmake (found suitable version "1.16.1", minimum required is "1.13.0")
CMake Error at cmake/protobuf.cmake:58 (find_package):
  Could not find a package configuration file provided by "Protobuf" with any
  of the following names:

    ProtobufConfig.cmake
    protobuf-config.cmake

  Add the installation prefix of "Protobuf" to CMAKE_PREFIX_PATH or set
  "Protobuf_DIR" to a directory containing one of the above files.  If
  "Protobuf" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:224 (include)


-- Configuring incomplete, errors occurred!
See also "C:/.conan/9d531a/1/CMakeFiles/CMakeOutput.log".
See also "C:/.conan/9d531a/1/CMakeFiles/CMakeError.log".
grpc-ue4/1.30.2@adamrehn/4.27:
grpc-ue4/1.30.2@adamrehn/4.27: ERROR: Package 'bf9f4e336e64d98ce96ba6aaac093ac1ff3705d4' build failed
grpc-ue4/1.30.2@adamrehn/4.27: WARN: Build folder C:\.conan\9d531a\1
ERROR: grpc-ue4/1.30.2@adamrehn/4.27: Error in build() method, line 98
        cmake.configure(source_folder="grpc", args=self.cmake_flags())
        ConanException: Error 1 while executing cd C:\.conan\9d531a\1 && ...

I'm running Windows 10, UE4.27, python 3.7.8, cmake 3.21.3. I tried searching for the missing protobuf-config.cmake but it also can't be found in the conan or project folder.

Any suggestions or pointers where to look would be greatly appreciated.

The responsible conan-file is here: https://github.com/adamrehn/ue4-conan-recipes/tree/master/grpc-ue4/1.30.2

1 Answers

This got broken with commit 865c38e99f694e63fd109ae06423472ebb7885a3 (see: https://github.com/adamrehn/ue4-conan-recipes/pull/8)

Reverting this change solved it for me.

To manually fix this: Go to C:\Users\USERNAME.conan\data\grpc-ue4\1.30.2\adamrehn\4.27\export\conanfile.py and in line 51 change:

"-DProtobuf_DIR=" + os.path.join(protobuf.rootpath, "lib/cmake/protobuf"),

to

"-DProtobuf_DIR=" + os.path.join(protobuf.rootpath, "cmake"),

Then you need to run the command with the --no-cache parameter (otherwise the recipe will be replaced again by the original) ue4 conan build grpc-ue4 --no-cache

Related