Skip to content

[core] ACLiC: skip dependency scan for explicitly linked libraries - #23538

Open
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:aclic-skip-dep-scan-explicit-link
Open

guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:aclic-skip-dep-scan-explicit-link

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

When loading an ACLiC library with C++ modules enabled and no rootmap file, LoadLibrary first resolves the library's dependencies by scanning its undefined symbols (GetSharedLibDeps with tryDyld) and loading each library that provides them.

This is not needed if the library was explicitly linked against its dependencies (ACLiC.LinkLibs & 1, the default on Linux and macOS): they are then recorded in the library itself and loaded by the dynamic linker. The scan is expensive though. For a macro that uses RDataFrame, RooFit, Tree, Hist and Gpad, it takes about 2.9 s, making .L macro.C+ with an up-to-date library take 4.9 s instead of 2.35 s (loading the library directly takes 2.2 s).

Only do the scan if the library is not explicitly linked.

This is the core part of #8017.

When loading an ACLiC library with C++ modules enabled and no rootmap
file, `LoadLibrary` first resolves the library's dependencies by
scanning its undefined symbols (`GetSharedLibDeps` with `tryDyld`) and
loading each library that provides them.

This is not needed if the library was explicitly linked against its
dependencies (`ACLiC.LinkLibs & 1`, the default on Linux and macOS):
they are then recorded in the library itself and loaded by the dynamic
linker. The scan is expensive though. For a macro that uses
RDataFrame, RooFit, Tree, Hist and Gpad, it takes about 2.9 s, making
`.L macro.C+` with an up-to-date library take 4.9 s instead of 2.35 s
(loading the library directly takes 2.2 s).

Only do the scan if the library is not explicitly linked.

This is the core part of root-project#8017.

🤖 Done with the help of AI
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 12h 37m 9s ⏱️
 3 896 tests  3 896 ✅ 0 💤 0 ❌
79 659 runs  79 659 ✅ 0 💤 0 ❌

Results for commit 2f53e69.

♻️ This comment has been updated with latest results.

Comment thread core/base/src/TSystem.cxx
// We have no rootmap files or modules to construct `-l` flags enabling
// explicit linking. We have to resolve the dependencies by ourselves
// taking the job of the dyld.
auto LoadLibrary = [linkDepLibraries, useCxxModules, produceRootmap, ForeachSharedLibDep](const TString &lib) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The only semantic problem I see here is that 'linkDepLibraries' is about how we will construct the upcoming library and not whether the library we are linking against are all fully explicitly linked :( ..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should it be maybe called preLoadDepLibraries instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you mean?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was trying to address with minimal changes your comment I think

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I might not have been clear. The flag linkDepLibraries only change how the ACLiC libraries are generated, however it does not tell anything about any other libraries. Thus for a given library in the list we still don't know if the deep search is needed or not as that library might or might be explicitly linked to its dependencies.

@dpiparo dpiparo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is a remnant of the old times... For me the PR can be merged once the failures are understood, provided that @pcanal agrees, of course.

@dpiparo dpiparo closed this Oct 24, 2026
@dpiparo dpiparo reopened this Oct 24, 2026

This branch has not been deployed

No deployments
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