External library for Paraview plugin

Hello everyone,
we’re in the process of developing our plugin and we need to use an in-house developed library. After our naive plugin build completes, the plugin loads, but the Paraview crashes, complaining about an undefinded symbol, which of course is a class from the in-house library. How can we solve this?

Regards,
Krzysztof Herdzik

complaining about an undefinded symbol

What is that exact error ?
It probably means the wrong library is being loaded and it does not contains the expected symbols.

You may be able to fix this with LD_LIBRARY_PATH or better rpath management.

Hi Mathieu,
the exact error look like this:
… paraview-5.8.1-intelmpi/bin/paraview: symbol lookup error: … /libFRDReaders.so: undefined symbol: _ZN6mesh3d6FEGridC1Ev

(our lib is mesh3d). We ran ldd on the plugin (FRDReader.so) and the accompanying dynamic lib (libFRDReaders.so) and our external library doesn’t show on any of the lists.
We set the LD_LIBRARY_PATH to contain the path to the library and it it didn’t help.
Any help would be very much appreciated :slight_smile:

unmangled:

undefined symbol: mesh3d::FEGrid::FEGrid()

Check that method is defined and not just declared in your lib.

Hello Mathieu, yes - this method is both declared & defined. The lib we’re using is probably not the issue, but our build process. What is the proper & formally correct way of linking external library? Please see the top level CMakeLists.txt file we’re using now.
CMakeLists.txt (1.7 KB)

you should use target_link_library and target_include_directories, nevertheless, this would not explain this kind of symbol issues.

Hi again Mathieu, take a look at the attached file. It doesn’t work, cmake won’t start the build process because:
CMake Error at CMakeLists.txt:44 (target_link_directories): Cannot specify link directories for target “FRDReader” which is not built by this project.
CMake Error at CMakeLists.txt:46 (target_link_libraries): Cannot specify link libraries for target “FRDReader” which is not built by this project.

CMakeLists.txt (1.9 KB)

Hi @k_herdzik77

I would need to take a look at the whole plugin and your libraries to be able to help

Hi, thank you very much for your responses.
We made a little progress with our issue, but now the problem is that within our library there are some unresolved symbols, related to VTK lib. Now, we write & run our plugin with Paraview 5.8.1, and our library is built with VTK 9.1. Could the VTK version be the source of the discrepancy? Is there a way of determining which version of VTK does my Paraview use? (We use paraview 5.8.1 built from source).
Thanks :slight_smile:

If you library uses VTK, you will need to make it uses ParaView own internal VTK or build it inside the plugin directly to avoid name conflicts. Using the same version will not be enough.

You may need to add to the rpath entries for the plugin to be able to find your library. CMake has a variety of variables related to it.