Skip to content

Investigate/Remove potentially unnecessary explicit linking #20731

@guitargeek

Description

@guitargeek

Was ROOT-9874 on JIRA, but it's good to make this issue public, as it's a good first issue for new contributors. No ROOT-specific knowledge is required, just some CMake.

According to ldd -u/ldd --unused we are (might be) sometimes explicitly linking too many libraries (see the list below for examples of how the output can look like for some libraries).

To address this issue for good, one would first have to check for unused dependecies in each of the shared libraries in the build directory. This is best done by writing a script. If there are unused dependencies, there are two general cases that one has to address:

  1. The unused dependency is linked directly in the library itself (via target_link_libraries or the LIBRARIES or DEPENDENCIES arguments if the library is declared with ROOT macros like ROOT_STANDARD_LIBRARY_PACKAGE). Then it just has to be removed
  2. The unused dependency comes indirectly from another dependency, which unnecessarily linked some of its own dependencies with the PUBLIC property. In that case, one has to identify where this indirect dependency comes from, and then make sure that the dependency is liked privately there (via the PRIVATE property of target_link_libraries, or by appending to the LIBRARIES instead of DEPENDENCIES argument when a ROOT macro is used. The mapping is PUBLIC -> DEPENDENCIES and PRIVATE -> LIBRARIES).
libCling.so:
Unused direct dependencies:
libcomplexDict.so:
Unused direct dependencies:
libCore.so:
Unused direct dependencies:
libdequeDict.so:
Unused direct dependencies:
libEG.so:
Unused direct dependencies:
	/home/pcanal/root_builds/master/gcc8/lib/libGraf3d.so
	/home/pcanal/root_builds/master/gcc8/lib/libGpad.so
	/home/pcanal/root_builds/master/gcc8/lib/libGraf.so
	/home/pcanal/root_builds/master/gcc8/lib/libHist.so
	/home/pcanal/root_builds/master/gcc8/lib/libMatrix.so
	/home/pcanal/root_builds/master/gcc8/lib/libRIO.so
	/home/pcanal/root_builds/master/gcc8/lib/libThread.so
libFitPanel.so:
Unused direct dependencies:
	/home/pcanal/root_builds/master/gcc8/lib/libGraf.so
	/home/pcanal/root_builds/master/gcc8/lib/libMatrix.so
	/home/pcanal/root_builds/master/gcc8/lib/libImt.so
	/home/pcanal/root_builds/master/gcc8/lib/libNet.so
	/home/pcanal/root_builds/master/gcc8/lib/libRIO.so
	/home/pcanal/root_builds/master/gcc8/lib/libThread.so
libFoam.so:
Unused direct dependencies:
	/home/pcanal/root_builds/master/gcc8/lib/libHist.so
	/home/pcanal/root_builds/master/gcc8/lib/libMatrix.so
	/home/pcanal/root_builds/master/gcc8/lib/libRIO.so
	/home/pcanal/root_builds/master/gcc8/lib/libThread.so

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions