Linking error while using USER-VTK package

Hi Everyone,

I am trying to use the dump custom/vtk command. I built the vtk code from https://github.com/Kitware/VTK and pointed to the shared libraries generated by it. Below is the contents of Makefile.lammps in /lammps/lib/vtk/ :

vtk_SYSINC = -I/usr/local/include/vtk-7.1
vtk_SYSLIB = -lvtkCommonCore-7.1 -lvtkIOCore-7.1 -lvtkIOXML-7.1 -lvtkIOLegacy-7.1 -lvtkCommonDataModel-7.1
vtk_SYSPATH = -L/usr/local/lib

The code compiles fine, but during linking, I get the following error:

dump_custom_vtk.o: In function vtkSmartPointer<vtkXMLPPolyDataWriter>::New()': /usr/local/include/vtk-7.1/vtkSmartPointer.h:137: undefined reference to vtkXMLPPolyDataWriter::New()’
dump_custom_vtk.o: In function vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New()': /usr/local/include/vtk-7.1/vtkSmartPointer.h:137: undefined reference to vtkXMLPUnstructuredGridWriter::New()’

Anybody faced this issue?

Thank you,
Stephen Thomas.

Hi Everyone,

I am trying to use the dump custom/vtk command. I built the vtk code from
https://github.com/Kitware/VTK and pointed to the shared libraries generated
by it. Below is the contents of Makefile.lammps in /lammps/lib/vtk/ :

vtk_SYSINC = -I/usr/local/include/vtk-7.1
vtk_SYSLIB = -lvtkCommonCore-7.1 -lvtkIOCore-7.1 -lvtkIOXML-7.1
-lvtkIOLegacy-7.1 -lvtkCommonDataModel-7.1
vtk_SYSPATH = -L/usr/local/lib

The code compiles fine, but during linking, I get the following error:

dump_custom_vtk.o: In function
`vtkSmartPointer<vtkXMLPPolyDataWriter>::New()':
/usr/local/include/vtk-7.1/vtkSmartPointer.h:137: undefined reference to
`vtkXMLPPolyDataWriter::New()'
dump_custom_vtk.o: In function
`vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New()':
/usr/local/include/vtk-7.1/vtkSmartPointer.h:137: undefined reference to
`vtkXMLPUnstructuredGridWriter::New()'

Anybody faced this issue?

please check the VTK documentation. as you can see from the examples
in lib/vtk, LAMMPS has only been tested against VTK 5.x and 6.x, so
most likely VTK 7.x requires additional libraries to be linked against
and this is usually mentioned in the documentation.

axel.

Hi Dr. Kohlmeyer,

Thanks for the response. I tried to build and use VTK 6.3 instead. But, unfortunately, I get the same error. I might be missing something else here. Here is the last part of the lammps build output .

mpicxx -g -O -L…/…/lib/vtk -L…/…/lib/atc -L/home/sthomas/projects/VTK-build/lib pair_lj_long_dipole_long.o … -lvtkCommonCore-6.3 -lvtkIOCore-6.3 -lvtkIOXML-6.3 -lvtkIOLegacy-6.3 -lvtkCommonDataModel-6.3 -lblas -llapack -o …/lmp_mpi
dump_custom_vtk.o: In function vtkSmartPointer<vtkXMLPPolyDataWriter>::New()': /usr/local/include/vtk-6.3/vtkSmartPointer.h:117: undefined reference to vtkXMLPPolyDataWriter::New()’
dump_custom_vtk.o: In function vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New()': /usr/local/include/vtk-6.3/vtkSmartPointer.h:117: undefined reference to vtkXMLPUnstructuredGridWriter::New()’
collect2: error: ld returned 1 exit status
Makefile:89: recipe for target ‘…/lmp_mpi’ failed
make[1]: *** […/lmp_mpi] Error 1

And here is the Makefile.lammps

vtk_SYSINC = -I/usr/local/include/vtk-6.3/
vtk_SYSLIB = -lvtkCommonCore-6.3 -lvtkIOCore-6.3 -lvtkIOXML-6.3 -lvtkIOLegacy-6.3 -lvtkCommonDataModel-6.3
vtk_SYSPATH = -L/home/sthomas/projects/VTK-build/lib

Thank you,
Stephen Thomas.

Hi Dr. Kohlmeyer,

Thanks for the response. I tried to build and use VTK 6.3 instead. But,
unfortunately, I get the same error. I might be missing something else here.
Here is the last part of the lammps build output .

mpicxx -g -O -L../../lib/vtk -L../../lib/atc
-L/home/sthomas/projects/VTK-build/lib pair_lj_long_dipole_long.o
.......................................... -lvtkCommonCore-6.3
-lvtkIOCore-6.3 -lvtkIOXML-6.3 -lvtkIOLegacy-6.3 -lvtkCommonDataModel-6.3
-lblas -llapack -o ../lmp_mpi
dump_custom_vtk.o: In function
`vtkSmartPointer<vtkXMLPPolyDataWriter>::New()':
/usr/local/include/vtk-6.3/vtkSmartPointer.h:117: undefined reference to
`vtkXMLPPolyDataWriter::New()'
dump_custom_vtk.o: In function
`vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New()':
/usr/local/include/vtk-6.3/vtkSmartPointer.h:117: undefined reference to
`vtkXMLPUnstructuredGridWriter::New()'
collect2: error: ld returned 1 exit status
Makefile:89: recipe for target '../lmp_mpi' failed
make[1]: *** [../lmp_mpi] Error 1

at any rate, the answer to this has to be in the VTK documentation, as
this isn't really a LAMMPS problem. LAMMPS only makes use of a very
small subset of VTK.
apparently, the correct list of libraries depends on how you have
configured/compiled VTK and seems to be changing significantly between
versions.
we have made tests with several linux distributions using the
distribution provided VTK development package and those are the
examples in the lib/vtk folder.

axel.