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

Configuring with builtin xrootd can fail because of seemingly not found OpenSSL library #16374

Open
pcanal opened this issue Sep 4, 2024 · 1 comment
Assignees
Labels

Comments

@pcanal
Copy link
Member

pcanal commented Sep 4, 2024

Doing in a empty build directory

cmake -Dminimal=ON $ROOT_SRC_DIR
cmake -Dbuiltin_xrootd=ON .

fails with:

CMake Error at cmake/modules/SearchInstalledSoftware.cmake:924 (target_link_libraries):
  The link interface of target "XRootD" contains:

    OpenSSL::SSL

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  CMakeLists.txt:305 (include)

while on the same machine and in another empty directory doing just:

cmake -Dbuiltin_xrootd=ON .

The difference between the two case is that the ssl variable usually default to ON but in the minimal case it default to OFF and turning on builtin_xrootd does not turn ssl back on.

The reason why this matters is that find_package defaults to declaring its results only inside the parent_scope. In practice we see find_package works properly in the top level CMakeList.txt and in one level of indirection (typically cmake/modules/SearchInstalledSoftware.cmake) but a second level of direction (i.e. inside the add_subdirectory(builtins/xrootd) inside SearchInstalledSoftware.cmake), it does not work.

From https://cmake.org/cmake/help/latest/command/find_package.html we read:

New in version 3.24: Specifying the GLOBAL keyword will promote all imported targets to a global scope in the importing project. Alternatively, this functionality can be enabled by setting the CMAKE_FIND_PACKAGE_TARGETS_GLOBAL variable.

So there is 3 possible solution

  1. Require CMake version 3.24 and add the GLOBAL keyword where needed (or set the variable)
  2. Make sure that builtin_xrootd (and any other similar components) to turn ssl ON when turned ON
  3. Move the find_package(OpenSSL) from inside builtins/xrootd/CMakeLists.txtto it inclusion point inSearchInstalledSoftware.cmake`
  4. Add an error if builtin_xrootd is ON while ssl is OFF.
@pcanal pcanal added the bug label Sep 4, 2024
@guitargeek
Copy link
Contributor

guitargeek commented Sep 5, 2024

  1. Move the find_package(OpenSSL) from inside builtins/xrootd/CMakeLists.txtto it inclusion point inSearchInstalledSoftware.cmake`

Sounds like a good and simple solution to me!

@pcanal pcanal changed the title Configuring with builtin xrootd can failed because of seemingly not found OpenSSL library Configuring with builtin xrootd can fail because of seemingly not found OpenSSL library Sep 6, 2024
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

3 participants