Failing to compile ParaView 5.8.0 with Spack on Cori

Hi,

So far I have been compiling ParaView 5.8.0 on NERSC’s Cori supercomputer by cloning it and calling cmake manually. I have been trying to get the same build working with spack, but the build fails.

Here is how I build ParaView manually:

module load python3/3.8-anaconda-2020.11
module swap PrgEnv-intel PrgEnv-gnu
module swap gcc/8.3.0 gcc/9.3.0
module load cmake/3.18.2

git clone https://gitlab.kitware.com/paraview/paraview.git
cd paraview
git fetch --all --tags
git checkout v5.8.0
git submodule update --init --recursive

mkdir build
cd  build

cmake .. -DPARAVIEW_USE_QT=OFF \
             -DPARAVIEW_USE_PYTHON=ON \
             -DPARAVIEW_USE_MPI=ON \
             -DVTK_OPENGL_HAS_OSMESA:BOOL=TRUE \
             -DVTK_USE_X:BOOL=FALSE \
             -DCMAKE_CXX_COMPILER=CC \
             -DCMAKE_C_COMPILER=cc \
             -DVTK_PYTHON_OPTIONAL_LINK=OFF \
             -DCMAKE_BUILD_TYPE=Release \
             -DCMAKE_INSTALL_PREFIX=$HOME/paraview-install
make
make install

With spack I have the following environment file:
spack.yaml (5.3 KB)

which I use as follows

spack env create myenv spack.yaml
spack env activate myenv
spack install -j 1

(the -j 1 is there so the error doesn’t get buried in unrelated build logs)

The build process fails with the following errors:

/tmp/mdorier/spack-stage/spack-stage-paraview-5.8.0-zvsma5jbul5za63rkddaqezyutp37cuc/spack-src/VTK/Rendering/FreeType/vtkFreeTypeTools.cxx:382:1: error: expected constructor, destructor, or type conversion before 'vtkFreeTypeToolsFaceRequester'
  382 | vtkFreeTypeToolsFaceRequester(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/mdorier/spack-stage/spack-stage-paraview-5.8.0-zvsma5jbul5za63rkddaqezyutp37cuc/spack-src/VTK/Rendering/FreeType/vtkFreeTypeTools.cxx: In member function 'virtual FT_Error vtkFreeTypeTools::CreateFTCManager()':
/tmp/mdorier/spack-stage/spack-stage-paraview-5.8.0-zvsma5jbul5za63rkddaqezyutp37cuc/spack-src/VTK/Rendering/FreeType/vtkFreeTypeTools.cxx:1154:61: error: 'vtkFreeTypeToolsFaceRequester' was not declared in this scope; did you mean 'vtkFreeTypeToolsCleanupCounter'?
 1154 |     this->MaximumNumberOfSizes, this->MaximumNumberOfBytes, vtkFreeTypeToolsFaceRequester,
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                             vtkFreeTypeToolsCleanupCounter

Any idea why this happens?

Note that if I create a new spack package for ParaView, inheriting from the original one but hard-coding the cmake arguments I need, the build works fine:

from spack.pkg.builtin.paraview import Paraview

class Paraview(Paraview):

    def cmake_args(self):
        args = [ '-DPARAVIEW_USE_QT=OFF',
                 '-DPARAVIEW_USE_PYTHON=ON',
                 '-DPARAVIEW_USE_MPI=ON',
                 '-DVTK_OPENGL_HAS_OSMESA:BOOL=TRUE',
                 '-DVTK_USE_X:BOOL=FALSE',
                 '-DCMAKE_CXX_COMPILER=' + self.spec['mpi'].mpicxx,
                 '-DCMAKE_C_COMPILER=' + self.spec['mpi'].mpicc,
                 '-DVTK_PYTHON_OPTIONAL_LINK=OFF' ]
        return args

I managed to extract the argument passed to cmake by spack in the failing case:

'cmake' '-G' 'Unix Makefiles' '-DCMAKE_INSTALL_PREFIX:STRING=<some-path> 
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo' 
'-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' 
'-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON' 
'-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=OFF' 
'-DCMAKE_INSTALL_RPATH:STRING=<some-paths>
'-DCMAKE_PREFIX_PATH:STRING=<some-paths>
 '-DVTK_OPENGL_HAS_OSMESA:BOOL=ON' 
'-DVTK_USE_X:BOOL=OFF' 
'-DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON'
 '-DBUILD_TESTING:BOOL=OFF' 
'-DOpenGL_GL_PREFERENCE:STRING=LEGACY'
 '-DPARAVIEW_USE_QT:BOOL=OFF'
 '-DPARAVIEW_BUILD_WITH_EXTERNAL=ON' 
'-DPARAVIEW_ENABLE_EXAMPLES:BOOL=OFF' 
'-DVTK_MODULE_USE_EXTERNAL_ParaView_cgns=OFF' 
'-DVTK_MODULE_USE_EXTERNAL_VTK_glew=OFF' 
'-DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=OFF' 
'-DVTK_MODULE_USE_EXTERNAL_VTK_libharu=OFF' 
'-DVTK_MODULE_USE_EXTERNAL_VTK_utf8=OFF' 
'-DPARAVIEW_USE_PYTHON:BOOL=ON' 
'-DPYTHON_EXECUTABLE:FILEPATH=<some-path> 
'-DPARAVIEW_PYTHON_VERSION:STRING=3' 
'-DPARAVIEW_USE_MPI:BOOL=ON' 
'-DMPIEXEC:FILEPATH=<some-path> 
'-DMPI_CXX_COMPILER:PATH=/global/u1/m/mdorier/paraview-build-test/spack/lib/spack/env/gcc/g++'
 '-DMPI_C_COMPILER:PATH=/global/u1/m/mdorier/paraview-build-test/spack/lib/spack/env/gcc/gcc' 
'-DMPI_Fortran_COMPILER:PATH=/global/u1/m/mdorier/paraview-build-test/spack/lib/spack/env/gcc
/gfortran'
 '-DPARAVIEW_BUILD_SHARED_LIBS:BOOL=ON' 
'-DPARAVIEW_USE_CUDA:BOOL=OFF'
 '-DPARAVIEW_BUILD_WITH_KITS:BOOL=ON'
 '-DCMAKE_INSTALL_RPATH=<some-path>

Now the question is: which of these flags is the offending one, and I do I turn it off?

I suspect PARAVIEW_BUILD_WITH_EXTERNAL=ON is the problem. That forces ParaView to use external packages for all 3rd parties, except those manually forced off by using VTK_MODULE_USE_EXTERNAL_VTK_...=. I suspect some third party library has changed and no longer works with 5.8.0 exposing this issue. From the looks of it, it may be freetype.

cc: @danlipsa , any thoughts?

I don’t remember seeing this one. I’ve seen various packages failing to build which can be solved by downgrading the offending package - or fixing the error on the machine you are building.
Downgrading might fix this error as well as spack might pick up a version ParaView was not tested with.

Dan

The superbuild is using freetype-2.10.0. What is the version picked up by spack?

The paraview package is define here: spack/package.py at develop · spack/spack · GitHub
It does depend on freetype but doesn’t require a specific version.

But the error looks more like it’s in the ParaView code itself, or in VTK’s code, not a problem with freetype’s API.

Utkarsh seems to have been right; the following “hacked” package, which removes -DPARAVIEW_BUILD_WITH_EXTERNAL=ON, seems to work (I have a build in progress and it’s got passed the point where the freetype problem usually occurs).

from spack.pkg.builtin.paraview import Paraview

class Paraview(Paraview):

    def cmake_args(self):
        args = super(Paraview, self).cmake_args()
        args.remove('-DPARAVIEW_BUILD_WITH_EXTERNAL=ON')
        args.append('-DPARAVIEW_BUILD_WITH_EXTERNAL=OFF')
        return args

The problem is that VTK was using macros that new fontconfig has removed from its public headers (they were internal macros apparently). See these VTK commits: