Skip to content

Filter raw linker flags from GBL_LIBRARIES#15162

Open
f3sch wants to merge 2 commits intodevfrom
f3sch-patch-2
Open

Filter raw linker flags from GBL_LIBRARIES#15162
f3sch wants to merge 2 commits intodevfrom
f3sch-patch-2

Conversation

@f3sch
Copy link
Collaborator

@f3sch f3sch commented Mar 16, 2026

currently GBL exports: /home/fschlepp/alice/sw/ubuntu2404_x86-64/GBL/V03-01-04-4/lib/libGBL.so;-L/local/workspace/DailyBuilds/DailyO2-ubuntu2404/daily-tags.BsAuSDt8F5/ubuntu2404_x86-64/ROOT/v6-36-04-alice9-10/lib;-lCore;-lImt;-lRIO;-lNet;-lHist;-lGraf;-lGraf3d;-lGpad;-lROOTVecOps;-lTree;-lTreePlayer;-lRint;-lPostscript;-lMatrix;-lPhysics;-lMathCore;-lThread;-lROOTNTuple;-lMultiProc;-lROOTDataFrame;-lROOTNTupleUtil;Eigen3::Eigen

which leads to link failures

This removes all the -l flags from the library.

currently GBL exports: /home/fschlepp/alice/sw/ubuntu2404_x86-64/GBL/V03-01-04-4/lib/libGBL.so;-L/local/workspace/DailyBuilds/DailyO2-ubuntu2404/daily-tags.BsAuSDt8F5/ubuntu2404_x86-64/ROOT/v6-36-04-alice9-10/lib;-lCore;-lImt;-lRIO;-lNet;-lHist;-lGraf;-lGraf3d;-lGpad;-lROOTVecOps;-lTree;-lTreePlayer;-lRint;-lPostscript;-lMatrix;-lPhysics;-lMathCore;-lThread;-lROOTNTuple;-lMultiProc;-lROOTDataFrame;-lROOTNTupleUtil;Eigen3::Eigen

which leads to link failures
@github-actions
Copy link
Contributor

REQUEST FOR PRODUCTION RELEASES:
To request your PR to be included in production software, please add the corresponding labels called "async-" to your PR. Add the labels directly (if you have the permissions) or add a comment of the form (note that labels are separated by a ",")

+async-label <label1>, <label2>, !<label3> ...

This will add <label1> and <label2> and removes <label3>.

The following labels are available
async-2023-pbpb-apass4
async-2023-pp-apass4
async-2024-pp-apass1
async-2022-pp-apass7
async-2024-pp-cpass0
async-2024-PbPb-apass1
async-2024-ppRef-apass1
async-2024-PbPb-apass2
async-2023-PbPb-apass5

@f3sch f3sch marked this pull request as ready for review March 17, 2026 09:46
@f3sch f3sch requested a review from a team as a code owner March 17, 2026 09:46
@f3sch f3sch mentioned this pull request Mar 17, 2026
# also GBL_LIBRARIES contains raw linker flags to ROOT we need to filter out
set(GBL_LIBRARIES_FILTERED "")
foreach(_lib IN LISTS GBL_LIBRARIES)
if(NOT _lib MATCHES "^-[lL]")
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
if(NOT _lib MATCHES "^-[lL]")
if(TARGET "${_lib}" OR IS_ABSOLUTE "${_lib}" OR NOT _lib MATCHES "^-")

Copy link
Member

Choose a reason for hiding this comment

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

how about this?

Copy link
Member

Choose a reason for hiding this comment

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

there might be -Wl,... linker options, BTW...

Copy link
Collaborator Author

@f3sch f3sch Mar 19, 2026

Choose a reason for hiding this comment

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

thanks for the suggestion, how about I split the linker options and flags like this:

set(GBL_LIBRARIES_FILTERED "")
set(GBL_LINK_OPTIONS "")
foreach(_lib IN LISTS GBL_LIBRARIES)
    if(_lib MATCHES "^-[lL]")
        continue()
    elseif(_lib MATCHES "^-")
        list(APPEND GBL_LINK_OPTIONS "${_lib}")
    else()
        list(APPEND GBL_LIBRARIES_FILTERED "${_lib}")
    endif()
endforeach()

add_library(GBL::GBL INTERFACE IMPORTED)
target_include_directories(GBL::GBL INTERFACE ${GBL_INCLUDE_DIR})
target_link_libraries(GBL::GBL INTERFACE
    ${GBL_LIBRARIES_FILTERED}
    Eigen3::Eigen
)
target_link_options(GBL::GBL INTERFACE ${GBL_LINK_OPTIONS})

Copy link
Member

Choose a reason for hiding this comment

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

yeah, looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants