I have adjusted the environment variables, and moved all the compiled
files to my destination folder for VTK.
I am using my own OS made with Linux From Scratch. I run it on Qemu/KVM.
I can run vtk from inside python interpreter. I can do “import vtk”, but on the console terminal I cannot run the .tcl file. I can run VTK with Python following this tutorial:
(Project 0: Getting VTK... to Work).
I just want to run vtk from bash without using Python interpreter.
That book hasn’t been updated, it uses VTK 4.2, we are now up to VTK 9.1 so Python or C++ is the way to go.
Also have a look here for Python and C++ examples: vtk-examples. The examples will compile/run with the VTK master. Also there is a PDF of the VTK TextBook and most of the examples in it will run with VTK 9+.
I do: git clone --recursive https://gitlab.kitware.com/vtk/vtk.git
then inside the vtk folder I mkdir build
then cd build
then I run: ccmake
Now after ccmake generate files inside the build folder I run: make
I am waiting now since it is compiling as I send this post.
When it is done I will do: make install
What are the last few lines of output of each of the commands? If it’s taking the build command is taking a long time, the cmake command was probably successful. What are the last few lines of output of your make/ninja command for building and the last few lines of output of your make/ninja install command?
This option is overriding your CMAKE_INSTALL_PREFIX directive of your cmake command, so if your last command is working, your vtk files are installed in ./vtk-install.
What is in that directory? What are the last few lines of output when you run that command?
@Freya_the_Goddess , my feeling is that you should start with a build in your home folder and once this works, then:
Familarise yourself with the directory structure and what needs to be set in the environment in order to build C++ code and Python code.
Adjust the VTK build parameters specifying what you want in cmake.
When you are satisfied, then consider building and installing a wheel, if you want.
To help you do this I have just written and tested some instructions that will lead you step by step through the process of setting up VTK in your home folder. The instructions cover:
It looks like everything built. I strongly suggest that you try my instructions and do a build in your home directory. This will give you a good basis for:
folder structures in the VTK build folder
what you need to do to build your own code and how to set up Python
once you check that there are no errors and the tests work, you can modofy with confidence
A wheel is a Python package that you can install. Basically since you are not well verse with building VTK, you should either use a pre-built wheel version (pip install vtk) or build VTK with the basic options.
You are providing the source directory twice -S ./VTK-9.1.0 and /opt/hamzstlib/VTK-9.1.0 . I don’t think it matters but still, there is no point to setting the same key to maybe two different values.
Why are you enabling Java? -D VTK_WRAP_JAVA=ON Are you planning to use Java? Java tend to require a different install tree than standard C++ library so the JVM can load those libraries easily.
-D VTK_USE_TK=ON Why?
-D VTK_WHEEL_BUILD=ON Are you aiming to publish your VTK build to PyPI? This also imply some tree structure that might be incompatible with Java and maybe even VTK install tree for C++.
To summarize, if you don’t know what those options are for, don’t enable them. I already gave you the properties required to build VTK with Python support along with how to build an example against your build and install tree.