Skip to content
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

fix: link tests with --no-as-needed due to JANA #255 #1130

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

wdconinc
Copy link
Contributor

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?

  • 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.

@wdconinc
Copy link
Contributor Author

@bleaktwig This should fix the issue you were seeing. Can you verify, and approve if it does? Then we can merge this before too many others run into the same issue.

veprbl
veprbl previously approved these changes Nov 21, 2023
Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

We should be patching JANA2, but this is probably a fine stopgap.

src/tests/algorithms_test/CMakeLists.txt Outdated Show resolved Hide resolved
@wdconinc wdconinc added this pull request to the merge queue Nov 21, 2023
Merged via the queue into main with commit 183aa52 Nov 21, 2023
72 checks passed
@wdconinc wdconinc deleted the fix-libjana-missing-podio branch November 21, 2023 05:57
@bleaktwig
Copy link

@bleaktwig This should fix the issue you were seeing. Can you verify, and approve if it does? Then we can merge this before too many others run into the same issue.

Sorry for being late to the party. This fix is not solving the issue between libJANA and podio on my machine, even after upgrading eic-shell, re-cloning the repository, and building from scratch. It can still be "solved" by leaving src/tests out of CMakeLists.txt tho.

The exact error thrown by cmake is:

/bin/ld: /usr/local/lib/libJANA.so: undefined reference to `podio::ROOTFrameWriter::ROOTFrameWriter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/bin/ld: /usr/local/lib/libJANA.so: undefined reference to `podio::ROOTFrameWriter::finish()'
/bin/ld: /usr/local/lib/libJANA.so: undefined reference to `podio::ROOTFrameWriter::writeFrame(podio::Frame const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status

@bleaktwig
Copy link

It seems to me that the problem is in this conditional statement. Taking the target_link_options out of it fixes the problem. I'm not very familiar with cmake so as to provide a better solution but let me know if you need any other check.

wdconinc added a commit that referenced this pull request Nov 22, 2023
### 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]>
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