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

[cmake] use the vendor-provided pkgconfig for libuuid #16957

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

silverweed
Copy link
Contributor

@silverweed silverweed commented Nov 15, 2024

Our own FindLibuuid.cmake is flawed in several ways:

  • it doesn't set the variables it advertises to set
  • it doesn't always find libuuid in the system
  • it improperly sets libuuid_FOUND if it only finds the include dir but not the libraries, which can lead to linking errors

These linking errors are affecting Davix and daos/daos_mock (thus the ROOTNTuple lib).

Using the pkgconfig file provided with libuuid (or rather with util-linux) should be the most robust way to find libuuid and it's a quite straightforward change to our cmake infrastructure.

@silverweed
Copy link
Contributor Author

I guess pkg-config only works on Linux, so maybe we should use one or the other depending on the platform...

@bellenot
Copy link
Member

And if it's only needed for UUID, should it be required globally? (Not sure if UUID is supported on Windows, but Davix for sure is not)

@bellenot
Copy link
Member

BTW, there is apparently a FindLibUUID.cmake in CMake

@pcanal
Copy link
Member

pcanal commented Nov 15, 2024

This PR also fixes my local build (failing due to the missing variables mentioned in the descriptions).

there is apparently a FindLibUUID.cmake in CMake

Do we know which version of CMake it first appeared in?

Copy link

github-actions bot commented Nov 15, 2024

Test Results

    16 files      16 suites   4d 3h 53m 1s ⏱️
 2 678 tests  2 670 ✅ 0 💤 8 ❌
41 153 runs  41 145 ✅ 0 💤 8 ❌

For more details on these failures, see this check.

Results for commit cd55a1a.

♻️ This comment has been updated with latest results.

@bellenot
Copy link
Member

Do we know which version of CMake it first appeared in?

2017 AFAICS, but let see this next week

@dpiparo dpiparo closed this Nov 17, 2024
@dpiparo dpiparo reopened this Nov 17, 2024
CMakeLists.txt Outdated
@@ -34,6 +34,7 @@ foreach(policy ${policy_old})
endforeach()

include(cmake/modules/CaptureCommandLine.cmake)
find_package(PkgConfig REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find_package(PkgConfig REQUIRED)
if(NOT MSVC)
find_package(PkgConfig REQUIRED)
endif()

Our own FindLibuuid.cmake is flawed in several ways:
- it doesn't set the variables it advertises to set
- it doesn't always find libuuid in the system
- it improperly sets libuuid_FOUND if it only finds the include dir but
  not the libraries, which can lead to linking errors

NOTE: pkg-config won't be used on mac/windows as it's usually not
available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants