Cylinder Example Cannot be Created by CMake

Yes I run ninja install.

Tell me Aron, or screenshot the installation folder of your VTK if you have time. Your installation folder what is the files and folder inside it. Are you using VTK-9.1.0 too? or build from git repo?

Files in my installation folders are buried deep inside folders, vtkmodules containing .so files and some .dir as well, no VTKConfig.make file. Maybe this is the problem.

Thank You

Did you run ninja and then ninja install?

Yes I run ninja and then ninja install

can anyone here tell me what is supposed to be inside the installation folder?
I will share the build log after the building is finish. It took 8 hours and more

curl -O https://vtk.org/files/release/9.1/VTK-9.1.0.tar.gz
tar xvfz VTK-9.1.0.tar.gz
cmake \
  -G Ninja \
  -S ./VTK-9.1.0 \
  -B ./vtk-build \
  -D CMAKE_BUILD_TYPE=Release \
  -D VTK_ENABLE_WRAPPING=ON \
  -D VTK_WRAP_PYTHON=ON

 cmake --build ./vtk-build
 cmake --install ./vtk-build --prefix ./vtk-install

Then you can build an example like

cmake \
   -G Ninja \
   -S ./VTK-9.1.0/Examples/DataManipulation/Cxx \
   -B ./vtk-example \
   -D VTK_DIR=$PWD/vtk-build

cmake --build ./vtk-example

Or from the install tree

cmake \
   -G Ninja \
   -S ./VTK-9.1.0/Examples/DataManipulation/Cxx \
   -B ./vtk-example \
   -D VTK_DIR=$PWD/vtk-install/lib/cmake/vtk-9.1

cmake --build ./vtk-example

bin/ include/ lib/ share/

These four directories have lots of files and subdirectory themselves. bin/ has the runtime libraries (.so files) and some utility executables; include/ has the .h files; /lib has, among other files, the link-time libraries (.a files) and CMake library find scripts (find*.cmake files) and, finally, share/ has some auxiliary files that need to be distributed as well (e.g. license files).

For me, on a fresh install, it is :

turlais@smth INST]$ ls
bin include lib64 share

turlais@smth INST]$ ls lib64/cmake/
vtk-9.1

Using lib64 in VTK_DIR or creating a symbolic link ( ln -s lib64 lib )
works.

system Fedora release 35

cmake version 3.22.2

Hi Paulo,
I just finish building with this script (you can see the screenshot of my vtk-build folder that has been built below):

cmake -GNinja \
  -S ./VTK-9.1.0 \
  -B ./vtk-build \
  -D CMAKE_INSTALL_PREFIX=/opt/hamzstlib/vtk91 \
  -D VTK_BUILD_EXAMPLES=ON \
  -D CMAKE_BUILD_TYPE=Release \
  -D VTK_ENABLE_WRAPPING=ON \
  -D VTK_WRAP_JAVA=ON \
  -D VTK_WRAP_PYTHON=ON \
  -D VTK_USE_TK=ON \
  -D VTK_WHEEL_BUILD=ON /opt/hamzstlib/VTK-9.1.0 

It create vtk-build folder inside /opt/hamzstlib directory, then I run:
cmake --build ./vtk-build
then from /opt/hamzstlib directory, I run this:
cmake --install ./vtk-build --prefix ./vtk91
The result is still the same build directory, vtk.py, vtk-9.1.0.data directory, and vtkmodules directory.


1vtk2

Weird that your installation folder with Paulo Carvalho is the same.

Now why mine is like this? Can you share your building and installation scripts when you install it using Cmake?

Fedora is a great OS btw.

Hi Sebastien,

I follow your scripts, this is the installation folders, why is it different than it is supposed to? and I still cannot build example too.


Uploading: 1vtkinstall2.png…

For the example, it still cannot work, I do not know where to link VTK_DIR because there is no VTKConfig.cmake nor vtk-config.cmake within the installation directory.
Should I link VTK_DIR to the installation folder or the build folder? which directory or path for this VTK_DIR for my case ?

What is your OS and your building and installation scripts to get the:

bin/ include/ lib/ share/

I am trying to create the build.log now.

Hi Paulo,

I have created the build.log from ninja -j4

here is the link:
https://raw.githubusercontent.com/glanzkaiser/glanzshamzs/main/vtk_build.log

Hope you can figure it out and help me install VTK.
Thank You

Your build log is free from errors. And you’re building all the main VTK libraries. Please, do a ninja install, go to the installation directory and report the outputs of these commands:
find -name *.h*
find -name *.so
find -name *.cmake
find -name *.a

I suspect that by enabling Python and Java wrappings, your installation directory is not adequate for C++ applications, hence the Cylinder example fails to build.

I think this configuration will result in an installation better suited for building the C++ examples:

cmake -GNinja \
  -S ./VTK-9.1.0 \
  -B ./vtk-build \
  -D CMAKE_INSTALL_PREFIX=/opt/hamzstlib/vtk91 \
  -D BUILD_SHARED_LIBS=ON \
  -D VTK_BUILD_EXAMPLES=ON \
  -D CMAKE_BUILD_TYPE=Release \
  -D VTK_ENABLE_WRAPPING=OFF \
  -D VTK_WRAP_JAVA=OFF \
  -D VTK_WRAP_PYTHON=OFF \
  -D VTK_USE_TK=ON \
  -D VTK_WHEEL_BUILD=OFF /opt/hamzstlib/VTK-9.1.0 

I also believe that by disabling wrappings, you will build VTK in ~2 hours instead of taking all day long.

Hi all,

thanks for the reply it is finally work. Someone gives me the instruction

Basically at the beginning, I activate python environment while do the building till installation. Install all needed Python packages as well for VTK.

Then I create personal directory named Kitware under /opt/hamzstlib/ with branches for src/ build/ install/
It will be like this:
/opt/hamzstlib/Kitware/build/VTK
/opt/hamzstlib/Kitware/install/VTK
/opt/hamzstlib/Kitware/src/VTK

The source will contain the latest VTK from the website (VTK-9.1.0) then build it using ccmake and then I do make install.

It is installed to /usr/local and since I know from your posts what should be in the VTK installation directory I just move everything that is VTK related to
/opt/hamzstlib/Kitware/install/VTK

Lastly, the most important so vtk-config.cmake can be found:
I set the environment variable by
export VTK_DIR=/opt/hamzstlib/Kitware/install/VTK/lib/cmake/vtk-9.1

Finally. Told you I never give up. Now I want to try all other examples. If I could maybe convert from C++ to Python for some examples… Good luck for me then…

Thank You all.


1 Like

Hi Sebastien,

I try this example, but it cannot work, do you know why?

It looks some late-bind library not being loaded/found. Particularly one that implements pointing device interaction. Are your VTK .so files in LD_LIBRARY_PATH, for instance?