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

When found with pkg-config the INTERFACE_INCLUDE_DIRECTORIES property of UUID::UUID is not the one expected by ignition projects #103

Closed
traversaro opened this issue Jul 11, 2020 · 2 comments

Comments

@traversaro
Copy link
Contributor

The uuid.pc file contained in Debian packages is:

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib/x86_64-linux-gnu
includedir=/usr/include

Name: uuid
Description: Universally unique id library
Version: 2.31.1
Requires:
Cflags: -I${includedir}/uuid
Libs: -L${libdir} -luuid

As you can see from the line Cflags: -I${includedir}/uuid, the include directory that is intended to be passed to the compiler is /usr/include/uuid, and given that the header path is /usr/include/uuid/uuid.h, that means that the headers are meant to be consumed as:

#include <uuid.h>

Unfortunately, Ignition libraries such as ignition-transport ( https://github.com/ignitionrobotics/ign-transport/blob/3e84d43aba2c4aeeceda03b3f7ac1647258f6e16/include/ignition/transport/Uuid.hh#L32 ), ignition-common ( https://github.com/ignitionrobotics/ign-common/blob/1c75659001becdb4e8f8f444aaabe540cc32e287/include/ignition/common/Uuid.hh#L31 ) and Gazebo ( https://github.com/osrf/gazebo/blob/6fd426b3949c4ca73fa126cde68f5cc4a59522eb/plugins/rest_web/RestWebPlugin.cc#L27 ) consume the headers of the uuid library as:

#include <uuid/uuid.h>

This is working only when uuid is installed in the system prefix /usr, and so /usr/include is part of the default compiler header search path, but it fails if uuid is not installed in the /usr or /usr/local prefix.

TL;DR: On Linux and macOS ignition projects that link UUID::UUID fail to compile if UUID is not installed in the /usr or /usr/local prefixes.

@traversaro
Copy link
Contributor Author

To ensure both compatibilty with projects that expect the pkg-config-style include #include <uuid.h> and the existing ignition projects that use #include <uuid/uuid.h>, the safer option is to put both <uuid_install_prefix>/include and <uuid_install_prefix>/include/uuid in INTERFACE_INCLUDE_DIRECTORIES.

traversaro added a commit to traversaro/gz-cmake that referenced this issue Jul 11, 2020
traversaro added a commit to traversaro/gz-cmake that referenced this issue Jul 11, 2020
traversaro added a commit to traversaro/gz-cmake that referenced this issue Jul 14, 2020
@traversaro
Copy link
Contributor Author

Fixed by #104 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant