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

Ignition projects on macOS mix inclusion of system's uuid/uuid.h and linking to homebrew's ossp-uuid #127

Closed
traversaro opened this issue Nov 15, 2020 · 0 comments · Fixed by #128 or gazebosim/gazebo-classic#2878
Labels
macOS macOS support

Comments

@traversaro
Copy link
Contributor

The homebrew package ossp-uuid provides a library whose functionality is just a subset of the uuid library that is part of the libc/SDK of macOS (see https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/uuid.3.html). Exactly to avoid tricky bugs due to this overlap, the ossp-uuid homebrew package installs its headers in ossp\uuid.h (Homebrew/homebrew-core@fdb81d8), while the system uuid library header is installed in uuid\uuid.h . Due to how the UUID::UUID target is created by the ignition-cmake's FindUUID module, the ignition libraries link the library installed by homebrew's ossp-uuid, but apparently they consume the headers of the uuid library as:

#include <uuid/uuid.h>

See for example 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 ).

This means that, despite the apparent logic in CMake, the ignition libraries use the headers from macOS's uuid library, but then link the library provided by ossp-uuid. This is confusing at minimum, but everything works fine because the two libraries are ABI-compatible (at least the symbols used by the ignition libraries). However, in package managers such as conda-forge that do not use the workaround of homebrew of installing libuuid's headers to ossp\uuid.h, this confusion leads to compilation errors in programs that include macOS SDK headers, see for example robotology/robotology-superbuild#513 and conda-forge/libuuid-feedstock#16 .

To solve this confusion, I suggest to modify the FindUUID CMake module to do not search for any library on macOS, but rather just defined UUID::UUID as an empty target, as the necessary symbols are already provided by the macOS SDK. This is similar to what happens for the FindThreads CMake module, that defines the Threads::Threads imported target in any case.

@traversaro traversaro changed the title Ignition projects on macOS mix inclusion of system's uuid/uuid.h and homebrew's ossp-uuid Ignition projects on macOS mix inclusion of system's uuid/uuid.h and linking to homebrew's ossp-uuid Nov 15, 2020
traversaro added a commit to traversaro/gz-cmake that referenced this issue Nov 15, 2020
On Apple platforms, the headers of libuuid and its symbols
are provided by the OS SDK, so no further linking is necessary.

Fix gazebosim#127

Signed-off-by: Silvio Traversaro <silvio.traversaro@iit.it>
traversaro added a commit to traversaro/gz-cmake that referenced this issue Nov 16, 2020
On Apple platforms, the headers of libuuid and its symbols
are provided by the OS SDK, so no further linking is necessary.

Fix gazebosim#127

Signed-off-by: Silvio Traversaro <silvio.traversaro@iit.it>
traversaro added a commit to traversaro/gz-cmake that referenced this issue Nov 17, 2020
On Apple platforms, the headers of libuuid and its symbols
are provided by the OS SDK, so no further linking is necessary.

Fix gazebosim#127

Signed-off-by: Silvio Traversaro <silvio.traversaro@iit.it>
@chapulina chapulina added the macOS macOS support label Nov 24, 2020
j-rivero pushed a commit to gazebosim/gazebo-classic that referenced this issue Nov 24, 2020
scpeters added a commit that referenced this issue Dec 15, 2020
On Apple platforms, the headers of libuuid and its symbols
are provided by the OS SDK, so no further linking is necessary.

Fix #127

Signed-off-by: Silvio Traversaro <silvio.traversaro@iit.it>

Co-authored-by: Steve Peters <scpeters@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS macOS support
Projects
None yet
2 participants