Undefined references to `CamAdaptor` when building `libvtkPVAdaptorsCam`

When building libvtkPVAdaptorsCam, multiple undefined references to CamAdaptor causes the build to fail. This is when building packages for openSUSE, where the default linker flags include -Wl,--as-needed -Wl,--no-undefined. Any help with this would be appreciated. If I should open an issue on paraview’s gitlab repo, please let me know.

From the build log:

[  503s] [18341/18802] : && /var/lib/build/ccache/bin/c++ -fPIC -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g -DNDEBUG  -O2 -g -DNDEBUG  -Wl,-lc -flto=auto -ffat-lto-objects -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -Wl,-soname,libvtkPVAdaptorsCam-pv5.9.so.1 -o lib64/libvtkPVAdaptorsCam-pv5.9.so.5.9 Adaptors/Cam/CMakeFiles/AdaptorsCam.dir/fv_create_data.cxx.o Adaptors/Cam/CMakeFiles/AdaptorsCam.dir/se_create_data.cxx.o  -Wl,-rpath,/home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/lib64:  lib64/libvtkPVPythonCatalyst-pv5.9.so.5.9  lib64/libvtkPVCatalyst-pv5.9.so.5.9  lib64/libvtkPythonInterpreter-pv5.9.so.5.9  /usr/lib64/libpython3.8.so  lib64/libvtkCommonDataModel-pv5.9.so.5.9  lib64/libvtkCommonTransforms-pv5.9.so.5.9  lib64/libvtkCommonMath-pv5.9.so.5.9  lib64/libvtkCommonCore-pv5.9.so.5.9  -lpthread  lib64/libvtksys-pv5.9.so.5.9  -ldl  -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/lib64 && :
[  503s] FAILED: lib64/libvtkPVAdaptorsCam-pv5.9.so.5.9 
[  503s] : && /var/lib/build/ccache/bin/c++ -fPIC -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g -DNDEBUG  -O2 -g -DNDEBUG  -Wl,-lc -flto=auto -ffat-lto-objects -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -Wl,-soname,libvtkPVAdaptorsCam-pv5.9.so.1 -o lib64/libvtkPVAdaptorsCam-pv5.9.so.5.9 Adaptors/Cam/CMakeFiles/AdaptorsCam.dir/fv_create_data.cxx.o Adaptors/Cam/CMakeFiles/AdaptorsCam.dir/se_create_data.cxx.o  -Wl,-rpath,/home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/lib64:  lib64/libvtkPVPythonCatalyst-pv5.9.so.5.9  lib64/libvtkPVCatalyst-pv5.9.so.5.9  lib64/libvtkPythonInterpreter-pv5.9.so.5.9  /usr/lib64/libpython3.8.so  lib64/libvtkCommonDataModel-pv5.9.so.5.9  lib64/libvtkCommonTransforms-pv5.9.so.5.9  lib64/libvtkCommonMath-pv5.9.so.5.9  lib64/libvtkCommonCore-pv5.9.so.5.9  -lpthread  lib64/libvtksys-pv5.9.so.5.9  -ldl  -Wl,-rpath-link,/home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/lib64 && :
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libvtkPVAdaptorsCam-pv5.9.so.5.9.pTk7EP.ltrans0.ltrans.o: in function `fv_add_chunk_':
[  503s] /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:152: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)0>::AddPointsAndCells(double, double)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:156: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)1>::AddPointsAndCells(double, double)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:164: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)0>::SetAttributeValue(int, double*, double*, double*, double*, double*, double*)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libvtkPVAdaptorsCam-pv5.9.so.5.9.pTk7EP.ltrans0.ltrans.o: in function `fv_catalyst_finalize_':
[  503s] /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:43: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)0>::~Grid()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libvtkPVAdaptorsCam-pv5.9.so.5.9.pTk7EP.ltrans0.ltrans.o:/home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:47: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)1>::~Grid()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libvtkPVAdaptorsCam-pv5.9.so.5.9.pTk7EP.ltrans0.ltrans.o: in function `se_add_chunk_':
[  503s] /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/se_create_data.cxx:131: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)2>::AddPointsAndCells(double, double)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libvtkPVAdaptorsCam-pv5.9.so.5.9.pTk7EP.ltrans0.ltrans.o: in function `se_catalyst_finalize_':
[  503s] /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/se_create_data.cxx:46: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)2>::~Grid()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libvtkPVAdaptorsCam-pv5.9.so.5.9.pTk7EP.ltrans0.ltrans.o: in function `fv_create_grid_':
[  503s] /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:101: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)0>::Grid()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:110: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)0>::Create()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:111: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)0>::SetToCoprocessor(vtkCPDataDescription*, char const*, vtkSmartPointer<vtkUnstructuredGrid>)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:117: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)0>::~Grid()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:121: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)1>::Grid()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:130: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)1>::Create()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:131: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)1>::SetToCoprocessor(vtkCPDataDescription*, char const*, vtkSmartPointer<vtkUnstructuredGrid>)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:137: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)1>::~Grid()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:113: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)0>::SetToCoprocessor(vtkCPDataDescription*, char const*, vtkSmartPointer<vtkUnstructuredGrid>)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:133: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)1>::SetToCoprocessor(vtkCPDataDescription*, char const*, vtkSmartPointer<vtkUnstructuredGrid>)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libvtkPVAdaptorsCam-pv5.9.so.5.9.pTk7EP.ltrans0.ltrans.o: in function `se_create_grid_':
[  503s] /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/se_create_data.cxx:99: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)2>::Grid()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/se_create_data.cxx:104: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)2>::SetCubeGridPoints(int, int, int, double*, int, double*)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/se_create_data.cxx:106: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)2>::Create()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/se_create_data.cxx:107: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)2>::SetToCoprocessor(vtkCPDataDescription*, char const*, vtkSmartPointer<vtkUnstructuredGrid>)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/se_create_data.cxx:113: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)2>::~Grid()'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/se_create_data.cxx:109: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)2>::SetToCoprocessor(vtkCPDataDescription*, char const*, vtkSmartPointer<vtkUnstructuredGrid>)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libvtkPVAdaptorsCam-pv5.9.so.5.9.pTk7EP.ltrans0.ltrans.o: in function `fv_add_chunk_':
[  503s] /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/fv_create_data.cxx:168: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)1>::SetAttributeValue(int, double*, double*, double*, double*, double*, double*)'
[  503s] /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /tmp/libvtkPVAdaptorsCam-pv5.9.so.5.9.pTk7EP.ltrans0.ltrans.o: in function `se_add_chunk_':
[  503s] /home/abuild/rpmbuild/BUILD/ParaView-v5.9.0/build/../Adaptors/Cam/se_create_data.cxx:137: undefined reference to `CamAdaptor::Grid<(CamAdaptor::GridType)2>::SetAttributeValue(int, double*, double*, double*, double*, double*, double*)'
[  503s] collect2: error: ld returned 1 exit status

CamAdaptor::Grid is a template class, so these files should be instantiating things as needed. However, the source files don’t include the .txx file.

Does this MR fix things?

Many thanks, that does the trick. Solved!