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

Undefined Symbol Error when using preCICE Python bindings #161

Closed
Timo-Schrader opened this issue Jan 8, 2023 · 2 comments · Fixed by #159 or #169
Closed

Undefined Symbol Error when using preCICE Python bindings #161

Timo-Schrader opened this issue Jan 8, 2023 · 2 comments · Fixed by #159 or #169
Labels
bug Something isn't working

Comments

@Timo-Schrader
Copy link
Contributor

Describe your setup

Operating system (e.g. Linux distribution and version): Debian 11 Bullseye
preCICE Version: Latest (develop)

preCICE Python bindings: 71e7a6e

Describe the problem

I am currently fixing the preCICE Python bindings s.t. they are compatible with 632b4fbfa5608b57eb1b46e897cb8a049d09847b and ec11b6e918151b22d5d6d78a3da4d03c3b3d059b. This requires building the Python bindings from scratch and linking it against preCICE dynamically. However, this produces the following error messages during import in Python even though libprecice.so is accessible:

ImportError: ~/.local/lib/python3.9/site-packages/cyprecice.cpython-39-x86_64-linux-gnu.so: undefined symbol: _ZN7precice9cplscheme9constants22actionWriteInitialDataB5cxx11Ev

Looking into the ELF symbol table, it gets clear that actionWriteInitialData has a LOCAL binding instead of GLOBAL which makes it inaccessible for the linker. I found the following setting to be the root cause of the problem, which has been introduced a month ago:

https://github.com/precice/precice/blob/dd70dc238a87d9263370d09dc320779c2d72dcbb/CMakeLists.txt#L264

Therefore, we either need to change this setting s.t. the functions actionWriteInitialData, actionWriteIterationCheckpoint, actionReadIterationCheckpoint and so on are accessible again in the shared library of preCICE or we need to remove them from the Python bindings.

Step To Reproduce

  1. Build preCICE Python bindings from scratch.
  2. Run import precice in Python.

Expected behaviour
preCICE gets imported without any linking errors. Removing the visibility flag from CMakeLists.txt fixes that.

@Timo-Schrader Timo-Schrader added the bug Something isn't working label Jan 8, 2023
@BenjaminRodenberg
Copy link
Member

I think removing actionWriteInitialData etc. should be the right way to go. In precice/precice#1487 we replaced actionWriteInitialData etc. with explicit calls. This is not yet consistently implemented in the python bindings. @fsimonis Correct?

Looks to me like this is not an issue of preCICE, but of the python bindings and we can also fix it there.

@fsimonis fsimonis transferred this issue from precice/precice Jan 11, 2023
@IshaanDesai
Copy link
Member

I think removing actionWriteInitialData etc. should be the right way to go. In precice/precice#1487 we replaced actionWriteInitialData etc. with explicit calls.

Action calls have been replaced in #159. @Timo-Schrader can you please test the branch in that pull request and see if it works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants