Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protobuf/Protoc: CMake files/config/location/target problem #598

Closed
Croydon opened this issue Jan 3, 2019 · 9 comments
Closed

Protobuf/Protoc: CMake files/config/location/target problem #598

Croydon opened this issue Jan 3, 2019 · 9 comments
Assignees
Labels

Comments

@Croydon
Copy link
Member

Croydon commented Jan 3, 2019

Package and Environment Details (include every applicable attribute)

  • Package Name: protobuf
  • Operating System+version: all
  • Compiler+version: all

Steps to reproduce (Include if Applicable)

grpc is searching for protobuf in the testing stages, but errors out with

CMake Error at CMakeLists.txt:21 (find_package):
Could not find a configuration file for package "Protobuf" that is
compatible with requested version "".
The following configuration files were considered but not accepted:
/home/conan/.conan/data/protobuf/3.5.2/bincrafters/stable/package/e56189dbbe24b43c2845881775ce71754e788050/lib/cmake/protobuf/protobuf-config.cmake, version: 3.5.2 (32bit)

https://travis-ci.org/inexorgame/conan-grpc/jobs/475032017#L3211

The first thing I'm noticing is that it is searching for CMake files in lib/cmake/protobuf/protobuf-config.cmake while, at least on Windows locally, the generated CMake files are in cmake/ for me instead of lib/cmake/.

Are the CMake files just in the wrong location and we should move them?

@Croydon Croydon added the bug label Jan 3, 2019
@Croydon
Copy link
Member Author

Croydon commented Jan 3, 2019

At a second look, Protobuf itself is placing the CMake files in this path, so we should likely not move them. Maybe we aren't setting some CMake variable/path?

@Croydon
Copy link
Member Author

Croydon commented Jan 3, 2019

@Croydon Croydon changed the title Protobuf: CMake files/config/location problem Protobuf/Protoc: CMake files/config/location/target problem Jan 3, 2019
@uilianries
Copy link
Member

Now we have a problem ... both protoc_installer and protobuf generates a bunch of cmake files, including protobuf:: target. However AFAIK it's not possible to generate the same target name by distinct files, I mean, both protoc_installer and protobuf are not able to generate protobuf::, so I opted to rename protobuf::protoc to protoc::protoc. As protoc_installer and protobuf are totally independent from each other we cant patch any cmake file generated.

@uilianries
Copy link
Member

Sorry, the target protobuf::protoc is correct, however it is available through protoc_installer. So grpc should include find_package(protoc CONFIG REQUIRED).

I'm checking what could be done to solve it on gRPC.

@Croydon
Copy link
Member Author

Croydon commented Jan 3, 2019

Sorry, the target protobuf::protoc is correct

Why is AppVeyor saying then that this target doesn't exist? 🤔

If the target definining is a problem maybe we can do something similar as we are doing in the modular find_boost?
https://github.com/bincrafters/conan-cmake_findboost_modular/blob/stable/1.66.0/FindBoost.cmake#L208

along the lines of this pseudo code...

if(TARGET protoc::protoc)
create_target_alias(protobuf::protoc protoc::protoc)
endif()

@uilianries
Copy link
Member

uilianries commented Jan 3, 2019

Why is AppVeyor saying then that this target doesn't exist? thinking

I think it's because of cmake config version:

if(CMAKE_SIZEOF_VOID_P AND "8")
  # check that the installed version has the same 32/64bit-ness as the one which is currently searching:
  if(NOT CMAKE_SIZEOF_VOID_P EQUAL "8")
    math(EXPR installedBits "8 * 8")
    set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
    set(PACKAGE_VERSION_UNSUITABLE TRUE)
  endif()
endif()

@Croydon
Copy link
Member Author

Croydon commented Jan 5, 2019

So I decided with inexorgame-obsolete/conan-grpc@f5efb04 to not cross-compile but rather using the -x86 containers and split by arch and the error went away.

However, I'm not sure now if these x86 packages are able to run on a x64 system because of this config file thing? 🤔

@uilianries
Copy link
Member

I've applied a patch to make possible to tin x86 on x86_64 but only for cmake, maybe there is something else missing

@Croydon
Copy link
Member Author

Croydon commented Sep 14, 2019

I can't test this under the same circumstances as back then anymore.

I will close this for now and will re-open another issue if I run into a similar problem in the future.

@Croydon Croydon closed this as completed Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants