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

Error evaluating generator expression: $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES> Target "protobuf::libprotobuf" not found. #60

Open
osrf-migration opened this issue Jun 13, 2019 · 13 comments
Labels
bug Something isn't working major

Comments

@osrf-migration
Copy link

Original report (archived issue) by Alex Biddulph (Bitbucket: Bidski).


I am having a very similar issue to Issue#55 (#55).

I am building a program using cmake (not using catkin) that depends on ignition-transport4. When creating my library and listing ${IGNITION-TRANSPORT_LIBRARIES} as target link libraries I get

CMake Error:
  Error evaluating generator expression:

    $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>

  Target "protobuf::libprotobuf" not found.

appearing about 10 times while cmake is creating the build files.

I have tried adding

find_package(ignition-math4 REQUIRED)
find_package(ignition-cmake0 REQUIRED)
find_package(IgnProtobuf REQUIRED)

both before and after my call to find_package(ignition-transport4 REQUIRED) but to no avail.

My guess is that the rest of my program also has a dependency on protobuf (included at the top-level directory) and that this is somehow clashing with FindIgnProtobuf.cmake in a strange way. Unfortunately, I can't figure out how to test this theory properly.

How can I resolve this?

@osrf-migration
Copy link
Author

Original comment by Michael Grey (Bitbucket: mxgrey, GitHub: mxgrey).


Does this happen even with a totally fresh configuration of cmake? The first thing I’d recommend is to delete your entire build folder and try to configuring cmake freshly. This kind of error is most common when the CMakeCache.txt is in a confused state.

In theory there shouldn't be a reason that multiple uses of Protobuf should cause this error. If this error always happens, even with a fresh configuration, then maybe the FindIgnProtobuf.cmake script can be patched somehow to deal with it.

@osrf-migration
Copy link
Author

Original comment by Alex Biddulph (Bitbucket: Bidski).


This error always happens, even with a fresh configuration.

@osrf-migration
Copy link
Author

Original comment by Michael Grey (Bitbucket: mxgrey, GitHub: mxgrey).


What version of protobuf does the rest of your project depend on?

@osrf-migration
Copy link
Author

Original comment by Alex Biddulph (Bitbucket: Bidski).


3.5.0, but I may be updating it to the latest (or a newer version) soon.

@osrf-migration
Copy link
Author

Original comment by Michael Grey (Bitbucket: mxgrey, GitHub: mxgrey).


Thanks, a few more questions:

  • What platform are you on? Ubuntu 18.04?
  • Are you installing your version of protobuf from source code or some other way?
  • What version of cmake are you using to configure the projects?

@osrf-migration
Copy link
Author

Original comment by Alex Biddulph (Bitbucket: Bidski).


Currently running 16.04.
Protobuf is compiled from source
CMake 3.5

@osrf-migration
Copy link
Author

Original comment by Michael Grey (Bitbucket: mxgrey, GitHub: mxgrey).


Thanks for the info!

Could you try out the change in this pull request?

@osrf-migration
Copy link
Author

Original comment by Alex Biddulph (Bitbucket: Bidski).


No change

@osrf-migration
Copy link
Author

Original comment by Michael Grey (Bitbucket: mxgrey, GitHub: mxgrey).


I've run out of theories for why it wouldn't be working. To help debug you could try adding this to your CMakeLists.txt:

message("PROTOBUF_FOUND Before:${PROTOBUF_FOUND}")
message("Protobuf_FOUND Before:${Protobuf_FOUND}")
find_package(IgnProtobuf REQUIRED)
message("PROTOBUF_FOUND After:${PROTOBUF_FOUND}")
message("Protobuf_FOUND After:${Protobuf_FOUND}")

I don’t know if that will tell me anything helpful, but it’s the next thing I would look at if I needed to debug this.

If you're able to share your project's CMakeLists.txt structure with us, that might be insightful. Otherwise, I don’t know what would be causing this.

@osrf-migration
Copy link
Author

Original comment by Alex Biddulph (Bitbucket: Bidski).


I added the following before find_package(ignition-transport4 REQUIRED)

FIND_PACKAGE(ignition-cmake0 REQUIRED)

message("PROTOBUF_FOUND Before:${PROTOBUF_FOUND}")
message("Protobuf_FOUND Before:${Protobuf_FOUND}")
find_package(IgnProtobuf REQUIRED)
message("PROTOBUF_FOUND After:${PROTOBUF_FOUND}")
message("Protobuf_FOUND After:${Protobuf_FOUND}"

Results are:

PROTOBUF_FOUND Before:TRUE
Protobuf_FOUND Before:TRUE
PROTOBUF_FOUND After:TRUE
Protobuf_FOUND After:0

My projects CMakeLists.txt is available on github. It’s not a simple structure though and cutting it down to a MWE is a non-trivial matter, so I am not sure how much help it would be. The module where we are finding ignition-transport4 is here. The point where we find protobuf is in the top-level file, via this module.

I can confirm that there is some sort of clash between the two detections of protobuf. If I edit this file to first find ignition-cmake0 and then IgnProtobuf (instead of finding Protobuf), everything works as expected. Not sure what could be happening though. (I need to revert your suggested PR to make this work though).

@osrf-migration
Copy link
Author

Original comment by Alex Biddulph (Bitbucket: Bidski).


Is there any update on this?

@osrf-migration
Copy link
Author

Original comment by Michael Grey (Bitbucket: mxgrey, GitHub: mxgrey).


Honestly I’ve run out of theories on what could be causing this.

I think I’d have to have a trace of the cmake run history to have any hope of making sense of this behavior.

You could add the --trace flag to your invocation of cmake and then dump the output into a gist. I don’t know if I’ll be able to make sense out of it, but I can try looking it over when I have time.

@osrf-migration
Copy link
Author

Original comment by Alex Biddulph (Bitbucket: Bidski).


CMake Trace output
I hope this helps, I tried to limit the output as much as I could, but trace outputs a lot of information 😞

@osrf-migration osrf-migration added major bug Something isn't working labels Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant