# External library for Paraview plugin

**URL:** https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297
**Category:** Development
**Created:** [January 30, 2023, 2:50pm UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297 "2023-01-30T14:50:14Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![k\_herdzik77](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b4bc9f/32.png) [@k\_herdzik77](https://discourse.paraview.org/u/k_herdzik77)
#### Post date: [January 30, 2023, 2:50pm UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/1 "2023-01-30T14:50:14Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 30, 2023, 2:53pm UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/2 "2023-01-30T14:53:01Z")

</div>

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

---

<div class="post-metadata">

### Author: ![k\_herdzik77](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b4bc9f/32.png) [@k\_herdzik77](https://discourse.paraview.org/u/k_herdzik77)
#### Post date: [January 31, 2023, 9:12am UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/3 "2023-01-31T09:12:41Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 31, 2023, 9:14am UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/4 "2023-01-31T09:14:06Z")

</div>

> [@k\_herdzik77](#):
>
> undefined symbol: \_ZN6mesh3d6FEGridC1Ev

unmangled:

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

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

---

<div class="post-metadata">

### Author: ![k\_herdzik77](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b4bc9f/32.png) [@k\_herdzik77](https://discourse.paraview.org/u/k_herdzik77)
#### Post date: [January 31, 2023, 10:38am UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/5 "2023-01-31T10:38:17Z")

</div>

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](https://discourse.paraview.org/uploads/short-url/nZbvIUNG2zVtT8D7R9WmfymoDE5.txt) (1.7 KB)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 31, 2023, 10:50am UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/6 "2023-01-31T10:50:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![k\_herdzik77](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b4bc9f/32.png) [@k\_herdzik77](https://discourse.paraview.org/u/k_herdzik77)
#### Post date: [January 31, 2023, 11:51am UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/7 "2023-01-31T11:51:49Z")

</div>

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](https://discourse.paraview.org/uploads/short-url/oen8gme8rRWjk4ORByrcNajMXMc.txt) (1.9 KB)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 31, 2023, 12:02pm UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/8 "2023-01-31T12:02:13Z")

</div>

Hi @k_herdzik77

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

---

<div class="post-metadata">

### Author: ![k\_herdzik77](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b4bc9f/32.png) [@k\_herdzik77](https://discourse.paraview.org/u/k_herdzik77)
#### Post date: [February 3, 2023, 10:53am UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/9 "2023-02-03T10:53:18Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 3, 2023, 10:56am UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/10 "2023-02-03T10:56:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [April 24, 2023, 12:24am UTC](https://discourse.paraview.org/t/external-library-for-paraview-plugin/11297/11 "2023-04-24T00:24:36Z")

</div>

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.
