# Loading custom built plugin into official PV binary causes segfault

**URL:** https://discourse.paraview.org/t/loading-custom-built-plugin-into-official-pv-binary-causes-segfault/3664
**Category:** ParaView Support
**Created:** [February 25, 2020, 5:33pm UTC](https://discourse.paraview.org/t/loading-custom-built-plugin-into-official-pv-binary-causes-segfault/3664 "2020-02-25T17:33:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Senui](https://discourse.paraview.org/user_avatar/discourse.paraview.org/senui/32/1403_2.png) [@Senui](https://discourse.paraview.org/u/Senui)
#### Post date: [February 25, 2020, 5:33pm UTC](https://discourse.paraview.org/t/loading-custom-built-plugin-into-official-pv-binary-causes-segfault/3664/1 "2020-02-25T17:33:06Z")

</div>

Hello,

I am trying to load my own plugin (called BDMGlyphFilter) that I have built in the superbuild development environment (the `CATALYST_RENDERING` edition, at the v5.8.0 tag), into the ParaView client from the official download page (v5.8.0). I add the directory of `BDMGlyphFilter.so` to the `PV_PLUGIN_PATH` envar, so that it is loaded upon startup. I also add the directory of the `libBDM.so` to `LD_LIBRARY_PATH`, which is the shared library generated when generating the plugin. The plugin code can be found here: [https://github.com/BioDynaMo/biodynamo/tree/upgrade-paraview-5.8/paraview\_plugin](https://github.com/BioDynaMo/biodynamo/tree/upgrade-paraview-5.8/paraview_plugin)

This results in the following segfault upon startup (with verbose output):

```auto
ahmad: $ env PARAVIEW_LOG_PLUGIN_VERBOSITY=0 ~/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/paraview
( 0.024s) [paraview] vtkPVPlugin.cxx:62 INFO| Import status: success 
----------------------------------------------------------
Importing plugin: **vtkPVInitializerPlugin**
  name: vtkPVInitializerPlugin
  version: 0.0
  filename: (nullptr)
  required-on-server: 0
  required-on-client: 0
  has-eula: 0

( 0.024s) [paraview] vtkPVPluginLoader.cxx:244 INFO| PV_PLUGIN_PATH: /home/ahmad/biodynamo/build/lib/pv_plugin
( 0.024s) [paraview] vtkPVPluginLoader.cxx:270 INFO| appDir: /home/ahmad/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/plugins
( 0.024s) [paraview] vtkPVPluginLoader.cxx:244 INFO| PV_PLUGIN_PATH: /home/ahmad/biodynamo/build/lib/pv_plugin
( 0.024s) [paraview] vtkPVPluginLoader.cxx:270 INFO| appDir: /home/ahmad/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/plugins
( 0.024s) [paraview] vtkPVPluginLoader.cxx:296 INFO| Loading Plugins from standard PLUGIN_PATHS
/home/ahmad/biodynamo/build/lib/pv_plugin:/home/ahmad/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/plugins
( 0.024s) [paraview] vtkPVPluginLoader.cxx:342 INFO| Loading plugins in Path: /home/ahmad/biodynamo/build/lib/pv_plugin
( 0.024s) [paraview] vtkPVPluginLoader.cxx:446 INFO| Attempting to load: /home/ahmad/biodynamo/build/lib/pv_plugin/libBDM.so
( 0.025s) [paraview] vtkPVPluginLoader.cxx:526 INFO| Loaded shared library successfully. Now trying to validate that it's a ParaView plugin.
( 0.025s) [paraview] vtkPVPluginLoader.cxx:542 INFO| We've encountered an error locating the other global function "pv_plugin_instance" which is required to locate the instance of the vtkPVPlugin class. Possibly the plugin shared library was not compiled properly.
( 0.025s) [paraview] vtkPVPluginLoader.cxx:446 INFO| Attempting to load: /home/ahmad/biodynamo/build/lib/pv_plugin/BDMGlyphFilter.so
( 0.026s) [paraview] vtkPVPluginLoader.cxx:526 INFO| Loaded shared library successfully. Now trying to validate that it's a ParaView plugin.
( 0.027s) [paraview] vtkPVPluginLoader.cxx:244 INFO| PV_PLUGIN_PATH: /home/ahmad/biodynamo/build/lib/pv_plugin
( 0.027s) [paraview] vtkPVPluginLoader.cxx:270 INFO| appDir: /home/ahmad/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/plugins
( 0.027s) [paraview] vtkPVPlugin.cxx:62 INFO| Import status: success 
----------------------------------------------------------
Importing plugin: **BDMGlyphFilter**
  name: BDMGlyphFilter
  version: 1.0
  filename: /home/ahmad/biodynamo/build/lib/pv_plugin/BDMGlyphFilter.so
  required-on-server: 1
  required-on-client: 1
  has-eula: 0

( 0.027s) [paraview] vtkPVPluginLoader.cxx:342 INFO| Loading plugins in Path: /home/ahmad/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/plugins

Loguru caught a signal: SIGSEGV
Stack trace:
23 0x407a7d /home/ahmad/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/paraview() [0x407a7d]
22 0x7f905b2de830 __libc_start_main + 240
21 0x407734 /home/ahmad/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/paraview() [0x407734]
20 0x40c502 /home/ahmad/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/paraview() [0x40c502]
19 0x408939 /home/ahmad/Downloads/ParaView-5.8.0-MPI-Linux-Python3.7-64bit/bin/paraview() [0x408939]
18 0x7f905af594d1 pqParaViewBehaviors::pqParaViewBehaviors(QMainWindow*, QObject*) + 1041
17 0x7f905aecfea5 pqAlwaysConnectedBehavior::pqAlwaysConnectedBehavior(QObject*) + 293
16 0x7f905aecfd14 pqAlwaysConnectedBehavior::serverCheck() + 132
15 0x7f9059ae98a7 pqObjectBuilder::createServer(pqServerResource const&, int) + 199
14 0x7f905821573b vtkSMSession::ConnectToSelf(int) + 91
13 0x7f9058213cb2 vtkSMSession::New() + 34
12 0x7f9058213c35 vtkSMSession::vtkSMSession(bool, vtkPVSessionCore*) + 197
11 0x7f9058131a4b vtkPVSessionCore::New() + 27
10 0x7f90581313d2 vtkPVSessionCore::vtkPVSessionCore() + 2258
9 0x7f905815b2cb vtkSIProxyDefinitionManager::New() + 27
8 0x7f905815b1c5 vtkSIProxyDefinitionManager::vtkSIProxyDefinitionManager() + 357
7 0x7f905815ae96 vtkSIProxyDefinitionManager::HandlePlugin(vtkPVPlugin*) + 198
6 0x7f905815ad5a vtkSIProxyDefinitionManager::LoadConfigurationXMLFromString(char const*, bool) + 42
5 0x7f9056421bd8 vtkXMLParser::Parse(char const*) + 24
4 0x7f90564222ba vtkXMLParser::Parse() + 346
3 0x7f9056422bbd vtkXMLParser::ParseXML() + 125
2 0x7f9056421eac vtkXMLParser::ParseBuffer(char const*) + 28
1 0x7f905b349746 strlen + 38
0 0x7f905b2f34b0 /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7f905b2f34b0]
( 0.243s) [paraview] :0 FATL| Signal: SIGSEGV
Segmentation fault (core dumped)
                     :0 FATL| Signal: SIGSEGV

```

In the mailing list of about 2 years ago I found: [https://www.paraview.org/pipermail/paraview-developers/2018-March/005814.html](https://www.paraview.org/pipermail/paraview-developers/2018-March/005814.html)  
This user reported that using different compilers for compiling the plugin and compiling the client was the cause of his segfault (which is one similar to mine).

Is it possible to load plugins that have been compiled with a different compiler toolchain than the one used for compiling the official binary releases? If so, could you please help me out on how I can fix this issue. If not, is there a way to mimic the build system that Kitware uses for the PV releases (e.g. a docker image)?

Best,  
Ahmad

---

<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 26, 2020, 2:26am UTC](https://discourse.paraview.org/t/loading-custom-built-plugin-into-official-pv-binary-causes-segfault/3664/2 "2020-02-26T02:26:42Z")

</div>

On linux, the only way to be able to load a plugin into the official release is to build it exactly in the same environment as the release.

You can use our paraview-plugin-builder for that, which is docker-based:  
[https://gitlab.kitware.com/paraview/paraview-plugin-builder](https://gitlab.kitware.com/paraview/paraview-plugin-builder)

---

<div class="post-metadata">

### Author: ![Senui](https://discourse.paraview.org/user_avatar/discourse.paraview.org/senui/32/1403_2.png) [@Senui](https://discourse.paraview.org/u/Senui)
#### Post date: [February 26, 2020, 1:45pm UTC](https://discourse.paraview.org/t/loading-custom-built-plugin-into-official-pv-binary-causes-segfault/3664/3 "2020-02-26T13:45:52Z")

</div>

Thanks @mwestphal, that works 🙂

Since I am also using the plugin in our C++ pipeline, should I also build the development environment (`CATALYST_RENDERING` edition with paraviewsdk enabled) using this docker container? Because currently I am getting a segfault when I use the plugin in our C++ pipeline:

The stacktrace:

```auto
15 0x7f9b74b72e0f vtkCPProcessor::Initialize(char const*) + 399
14 0x7f9b74b6d7d5 vtkCPCxxHelper::New() + 517
13 0x7f9b6d5567f9 vtkSMSession::ConnectToSelf(int) + 105
12 0x7f9b6d554e12 vtkSMSession::New() + 34
11 0x7f9b6d554d95 vtkSMSession::vtkSMSession(bool, vtkPVSessionCore*) + 197
10 0x7f9b6d46c06b vtkPVSessionCore::New() + 27
9 0x7f9b6d46ba0b vtkPVSessionCore::vtkPVSessionCore() + 2283
8 0x7f9b6d49738b vtkSIProxyDefinitionManager::New() + 27
7 0x7f9b6d497289 vtkSIProxyDefinitionManager::vtkSIProxyDefinitionManager() + 361
6 0x7f9b6d4970a1 vtkSIProxyDefinitionManager::HandlePlugin(vtkPVPlugin*) + 353
5 0x7f9b769a253c cfree + 76
4 0x7f9b7699e37a /lib/x86_64-linux-gnu/libc.so.6(+0x8037a) [0x7f9b7699e37a]
3 0x7f9b769957ea /lib/x86_64-linux-gnu/libc.so.6(+0x777ea) [0x7f9b769957ea]
2 0x7f9b7695502a abort + 362
1 0x7f9b76953428 gsignal + 56
0 0x7f9b769534b0 /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7f9b769534b0]
( 0.090s) [pvbatch] :0 FATL| Signal: SIGABRT

```

---

<div class="post-metadata">

### Author: ![Senui](https://discourse.paraview.org/user_avatar/discourse.paraview.org/senui/32/1403_2.png) [@Senui](https://discourse.paraview.org/u/Senui)
#### Post date: [February 26, 2020, 7:49pm UTC](https://discourse.paraview.org/t/loading-custom-built-plugin-into-official-pv-binary-causes-segfault/3664/4 "2020-02-26T19:49:47Z")

</div>

I have opened another post regarding this issue: [Build redistributable ParaView (SDK) using ParaViewPluginBuilder](https://discourse.paraview.org/t/build-redistributable-paraview-sdk-using-paraviewpluginbuilder/3676)

Thanks for helping out with the plugin issue!

---

<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 27, 2020, 3:25am UTC](https://discourse.paraview.org/t/loading-custom-built-plugin-into-official-pv-binary-causes-segfault/3664/5 "2020-02-27T03:25:02Z")

</div>

You should build the plugin using paraview-plugin-builder for loading the plugin in the official binary release.

You should build the plugin using your own built paraview sdk when loading into your C++ pipeline.

Afaik, the paraview sdk is not redistrbutable yet. (@ben.boeckel is that correct ?)
