About building GmshIO plugin

Dear ParaView community,

I would like to use Gmsh API in ParaView. There are two official plugins: GmshIO and GmshReader. Looking at the commit history, I understand GmshReader is now depreciated (But it seems like not all the features from GmshReader have been merged to GmshIo yet.).
To build GmshIO,

  1. git clone gmsh / gmsh · GitLab. And built it using cmake
cmake 
-DCMAKE_BUILD_TYPE=Release 
-DCMAKE_INSTALL_PREFIX=/path_to_gmsh_install_dir/ 
-DENABLE_BUILD_SHARED=ON 
-DENABLE_BUILD_LIB=ON 
-DDEFAULT=0 
-DENABLE_POST=ON 
-DENABLE_PARSER=ON 
-DENABLE_PRIVATE_API=ON 
../gmsh-source
  1. Configure in ParaView
"Gmsh_INCLUDE_DIR": "<path>/Gmsh_build/include"
"Gmsh_LIBRARY": "<path>/Gmsh_build/lib/gmsh.lib"

The build succeeded. I can launch ParaView but unable to load GmshIo plugin. I got

ERROR: In ...\vtkPVPluginLoader.cxx, line 536
vtkPVPluginLoader (000001F11049B770): .../GmshIO.dll: The specified module could not be found."

If I move gmsh.dll to my ParaView bin directory, the error disappeared and I can load GmshIO. I thought Gmsh is built as part of GmshIO as static library. Why do I still have to copy and move gmsh.dll?

Add path_to_gmsh_install_dir/bin to your PATH or compile Gmsh statically.

How to compile GmshIO statically?

You need to compile Gmsh statically:

cmake 
-DCMAKE_BUILD_TYPE=Release 
-DCMAKE_INSTALL_PREFIX=/path_to_gmsh_install_dir/ 
-DENABLE_BUILD_SHARED=OFF 
-DENABLE_BUILD_LIB=ON 
-DDEFAULT=0 
-DENABLE_POST=ON 
-DENABLE_PARSER=ON 
-DENABLE_PRIVATE_API=ON 
../gmsh-source

Static build is successful with -DENABLE_BUILD_SHARED=OFF

1 Like