Skip to content

[CMake] Update builtin_cling=OFF configuration code #18598

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

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

Conversation

guitargeek
Copy link
Contributor

@guitargeek guitargeek commented May 4, 2025

In an attempt to further reduce build times, I attempted to build ROOT with builtin_cling=OFF, using a custom cling build that I install on my system.

However, I ran into several errors with cling header files not being found, as well as linker errors.

The simplest fix was to set the GLOBAL argument in find_package(Cling), to make all the Cling targets available globally. Then, one also doesn't need all this code for the transient dependencies anymore (this is all handled correctly in the ClingConfig.cmake).

The only caveat of this is that the GLOBAL argument is only available from CMake 3.24 onwards, so the configuration with builtin_cling=OFF will now error out if the CMake version is lower. That should be acceptable, since users that are adventurous enough to build ROOT like this probably also have a CMake version that is new enough (RHEL 9 has CMake version 3.26, and Ubuntu 24.04 has CMake version 3.28).

Also, don't add any custom search paths to find_package(Cling) and find_package(Clang), so that one is forced to use the Clang_DIR and Cling_DIR hints correctly.

In an attempt to further reduce build times, I attempted to build ROOT
with `builtin_cling=OFF`, using a custom cling build that I install on
my system.

However, I ran into several errors with cling header files not being
found, as well as linker errors.

The simplest fix was to set the `GLOBAL` argument in
`find_package(Cling)`, to make all the Cling targets available globally.
Then, one also doesn't need all this code for the transient dependencies
anymore (this is all handled correctly in the ClingConfig.cmake).

The only caveat of this is that the `GLOBAL` argument is only available
from CMake 3.24 onwards, so the configuration with `builtin_cling=OFF`
will now error out if the CMake version is lower. That should be
acceptable, since users that are adventurous enough to build ROOT like
this probably also have a CMake version that is new enough (RHEL 9 has
CMake version 3.26, and Ubuntu 24.04 has CMake version 3.28).

Also, don't add any custom search paths to `find_package(Cling)` and
`find_package(Clang)`, so that one is forced to use the `Clang_DIR` and
`Cling_DIR` hints correctly.
@guitargeek guitargeek self-assigned this May 4, 2025
@guitargeek guitargeek requested a review from bellenot as a code owner May 4, 2025 13:53
Copy link

github-actions bot commented May 4, 2025

Test Results

    19 files      19 suites   4d 11h 27m 23s ⏱️
 2 731 tests  2 731 ✅ 0 💤 0 ❌
50 450 runs  50 450 ✅ 0 💤 0 ❌

Results for commit 15f6743.

♻️ This comment has been updated with latest results.

@dpiparo dpiparo requested a review from vgvassilev May 5, 2025 04:23
@vgvassilev
Copy link
Member

Can we improve the Cling cmake infrastructure when it is being discovered as a installed package. I do not think we ever invested time in this and it's probably worth it.

@guitargeek
Copy link
Contributor Author

Which part of the CMake do you mean exactly? With this PR, building ROOT with builtin_cling=OFF seems to work, at least for the case with clad=OFF. For clad=ON, I still get linker errors, even if I build Cling with CLING_BUILD_PLUGINS=ON and clad=ON. So that's something that could be fixed. You see other problems?

@vgvassilev
Copy link
Member

Which part of the CMake do you mean exactly? With this PR, building ROOT with builtin_cling=OFF seems to work, at least for the case with clad=OFF. For clad=ON, I still get linker errors, even if I build Cling with CLING_BUILD_PLUGINS=ON and clad=ON. So that's something that could be fixed. You see other problems?

I meant to avoid needing GLOBAL.

@hahnjo hahnjo self-requested a review May 7, 2025 14:08
@hahnjo
Copy link
Member

hahnjo commented May 7, 2025

@guitargeek I would appreciate if you could start adding me as reviewer for this kind of PRs.......

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.

3 participants