# Failing to compile ParaView 5.8.0 with Spack on Cori

**URL:** https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872
**Category:** ParaView Support
**Created:** [August 26, 2021, 4:03pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872 "2021-08-26T16:03:22Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [August 26, 2021, 4:03pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/1 "2021-08-26T16:03:22Z")

</div>

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:

```auto
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](https://discourse.paraview.org/uploads/short-url/n1JGpinWn4I57CuNFhtoQsy1cu4.yaml) (5.3 KB)

which I use as follows

```auto
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:

```auto
/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?

---

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [August 26, 2021, 6:46pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/2 "2021-08-26T18:46:08Z")

</div>

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:

```auto
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

```

---

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [August 26, 2021, 7:22pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/3 "2021-08-26T19:22:36Z")

</div>

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

```auto
'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?

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [August 26, 2021, 9:07pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/4 "2021-08-26T21:07:14Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [August 26, 2021, 9:07pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/5 "2021-08-26T21:07:30Z")

</div>

cc: @danlipsa , any thoughts?

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.paraview.org/user_avatar/discourse.paraview.org/danlipsa/32/1563_2.png) [@danlipsa](https://discourse.paraview.org/u/danlipsa)
#### Post date: [August 26, 2021, 9:16pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/6 "2021-08-26T21:16:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.paraview.org/user_avatar/discourse.paraview.org/danlipsa/32/1563_2.png) [@danlipsa](https://discourse.paraview.org/u/danlipsa)
#### Post date: [August 26, 2021, 9:44pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/7 "2021-08-26T21:44:49Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [August 26, 2021, 10:26pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/8 "2021-08-26T22:26:34Z")

</div>

The paraview package is define here: [spack/package.py at develop · spack/spack · GitHub](https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/paraview/package.py)  
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.

---

<div class="post-metadata">

### Author: ![mdorier](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/eb9ed0/32.png) [@mdorier](https://discourse.paraview.org/u/mdorier)
#### Post date: [August 26, 2021, 11:06pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/9 "2021-08-26T23:06:52Z")

</div>

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).

```auto
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

```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [September 18, 2021, 7:03pm UTC](https://discourse.paraview.org/t/failing-to-compile-paraview-5-8-0-with-spack-on-cori/7872/10 "2021-09-18T19:03:41Z")

</div>

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:

- [https://gitlab.kitware.com/vtk/vtk/-/commit/dae1718d50bec1b40b860280acafbdd94fc4cd5d](https://gitlab.kitware.com/vtk/vtk/-/commit/dae1718d50bec1b40b860280acafbdd94fc4cd5d)
- [https://gitlab.kitware.com/vtk/vtk/-/commit/31e8e4ebeb3152f7cfdb3f14f24f7e5d31a4f8b5](https://gitlab.kitware.com/vtk/vtk/-/commit/31e8e4ebeb3152f7cfdb3f14f24f7e5d31a4f8b5)
