How to Install VTKData-9.1.0 with CMake with Operating System: LFS

Hi all good day to you,

I have tried to use VTK but a bit confused. I am downloading the source files of

  1. VTK-9.1.0.tar.gz
  2. VTKData-9.1.0.tar.gz
    from this link https://vtk.org/download/
    I use Linux From Scratch OS. Not Ubuntu or anything. So I build it from source.

I am able to make .ExternalData from the extracted VTKData-9.1.0 into the extracted directory of VTK-9.1.0, however when I do CMAKE there are no examples downloaded. Since VTKData-9.1.0 only contain SHA512 data without actual files that can be used.

Then, when I see the VTKDataFiles-9.1.0.tar.gz
It has folders and a lot of files. I want to make sure is VTKDataFiles-9.1.0 is the downloaded version of VTKData-9.1.0 ?

This is my build scripts with CMake and Ninja:
mkdir build &&
cd build &&
cmake -GNinja
-DCMAKE_INSTALL_PREFIX=/opt/hamzstlib/Vtk9
-DVTK_BUILD_EXAMPLES=ON \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DVTK_ENABLE_WRAPPING=ON \
-DVTK_DATA_STORE=/sources/Hamzstlab/VTK-9.0.1/VtkData \
-DVTK_WRAP_JAVA=ON \
-DVTK_WRAP_PYTHON=ON \
-DVTK_USE_TK=ON \
-DVTK_WHEEL_BUILD=ON /sources/Hamzstlab/VTK-9.1.0
-Wno-dev … &&
ninja

Tell me what did I miss? Is using CMake and make is better? I tried building it multiple times and still not getting it right. When I call “vtk” it becomes bash: vtk command not found.

Lastly, based on experienced developers and users here, I want to know the best tools to try VTK examples is it using Python3 or C++?

VTKData is really meant to pre-fill the cache for cmake when building tests so files could be found without individual download.

VTKDataFiles is basically the resolved version of VTKData.

If you want to test and play with VTK, it might be easier using Python by creating a virtual environment and running some examples from the Python section of that website. That way you can skip the compilation part.

To get a virtual-env setup you can run the following

python3 -m venv vtk-venv
source ./vtk-venv/bin/activate
pip install -U pip
pip install vtk

Then run any python script like python ./vtk-test-script.py.

You can even try a trame example using that same venv. (just pip install trame though)

Thanks for the reply Sebastien,

I am new to VTK so apologize if my question is too trivial.

I have build VTK and I move the build folder into another place. Is that wrong?

I try the cxx example here:
https://kitware.github.io/vtk-examples/site/Cxx/GeometricObjects/CylinderExample/

I couldn’t run the cmake to build the example. It triggers an error:

Couldn’t find:
VTKConfig.cmake
VTK-config.cmake
add the installation prefix of “VTK” to CMAKE_PREFIX_PATH
set VTK_DIR to the above files

The weird things are there are no VTKConfig.cmake under the build directory after the compiling/building for VTK-9.1.0. So maybe my Cmake compiling scripts are wrong or lack some scripts? If I run “make install” it only install several vtkmodules and still no VTKConfig.cmake files in there.

I will try the Python example after this cxx.

Thank You.

Yes build tree can not be relocated while install tree can.