Skip to content

Commit

Permalink
fix: link tests with --no-as-needed due to JANA #255 (#1130)
Browse files Browse the repository at this point in the history
### Briefly, what does this PR introduce?
This fixes an issue in the linking of algorithms_test which popped up
today (and likely was always there...). Until
JeffersonLab/JANA2#255 is included, we install a
libJANA.so with undefined references to podio because it doesn't include
it in the NEEDED section. By passing `--no-as-needed` we don't strip the
podio calls from the algorithms_test executables where they are unused.

### What kind of change does this PR introduce?
- [x] Bug fix (issue #__)
- [ ] New feature (issue #__)
- [ ] Documentation update
- [ ] Other: __

### Please check if this PR fulfills the following:
- [ ] Tests for the changes have been added
- [ ] Documentation has been added / updated
- [ ] Changes have been communicated to collaborators

### Does this PR introduce breaking changes? What changes might users
need to make to their code?
No.

### Does this PR change default behavior?
No.

---------

Co-authored-by: Dmitry Kalinkin <[email protected]>
  • Loading branch information
wdconinc and veprbl committed Nov 22, 2023
1 parent fdc79ac commit 46dc22b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tests/algorithms_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ add_executable(${TEST_NAME}

# Explicit linking to podio::podio is needed due to https://github.com/JeffersonLab/JANA2/issues/151
target_link_libraries(${TEST_NAME} PRIVATE Catch2::Catch2WithMain algorithms_calorimetry_library algorithms_pid_library podio::podio podio::podioRootIO)
# As-needed fails due to absent podio symbols in libJANA.so (https://github.com/JeffersonLab/JANA2/pull/255)
if (CMAKE_CXX_COMPILER_LINKER_ID MATCHES "GNU(gold)?")
target_link_options(${TEST_NAME} PRIVATE "-Wl,--no-as-needed")
endif()

# Install executable
install(TARGETS ${TEST_NAME} DESTINATION bin)
Expand Down

0 comments on commit 46dc22b

Please sign in to comment.