1、VTK及其下载安装(三维可视化工具包)
http://vtk.org/VTK/resources/software.html
UNIX / Cygwin / Mac OSX
CMake should be run from the command line on these platforms. The current working directory should be set to the desired binary tree location in which the build system should be generated. One command-line argument is used to specify the location of the source tree. CMake will usually choose the system C and C++ compilers automatically but it can be told to use specific compilers through the "CC" and "CXX" environment variables.
A typical in-source build for VTK might look like this:
$ ls -d VTK
VTK/
$ cd VTK
$ ccmake .
$ make
A typical out-of-source build for VTK might look like this:
$ ls -d VTK
VTK/
$ mkdir VTK-build
$ cd VTK-build
$ ccmake ../VTK
$ make
In the above examples the call to ccmake may be replaced by
$ env CC=/your/c/compiler CXX=/your/C++/compiler ccmake /path/to/VTK
in order to tell CMake to use specific C and C++ compilers. Setting the environment in this way will only change the compilers the first time CMake is run for a specific build tree. Do not attempt to change the compiler of an existing build tree. Instead one should create a separate build tree for each desired compiler.
2、配置安装VTK遇到的问题:
[root@localhost bin]# env CC=/usr/bin/gcc CXX=/usr/bin/g++ ccmake ../VTK5.10.1/
CMake Error at CMake/vtkWrapTcl.cmake:209 (MESSAGE):
Tk was not found. Install the Tk development package (see http://tcl.tk or
ActiveState Tcl) and set the appropriate variables (TK_INCLUDE_PATH,
TK_LIBRARY, TK_WISH) or disable VTK_USE_TK.
Call Stack (most recent call first):
CMakeLists.txt:1134 (INCLUDE)
2、1 报错&解决:
../../bin/libvtkRenderingTCL.so.5.10.1: undefined reference to `Tk_PhotoSetSize_Panic' collect2: ld 返回 1 make[2]: *** [bin/vtk] 错误 1 make[1]: *** [Wrapping/Tcl/CMakeFiles/vtk.dir/all] 错误 2 make: *** [all] 错误 2
3、tcl、tk脚本解释器的安装
http://tcl.tk
http://tcl.tk/software/tcltk/download.html下载tar包;
#./configure
#make
#make install
使用的redhat的话最好在redhat系统安装包里面找出相关rpm安装包,直接安装,可以减少自己编译和安装存在的版本和出错风险。
4、继续安装VTK
# su
# export TK_INCLUDE_PATH=/usr/local/include/
# export TK_LIBRARY=/usr/local/lib/
# export TK_WISH=/usr/local/bin/
# export TK_LIBRARY=/usr/local/lib/
# export TK_WISH=/usr/local/bin/
# ccmake ../VTK5.10.1/
# make
# make install
5、优化pvb。重新安装pvbrower
Build with VTK:
download VTK5.x from http://www.kitware.com/VTK
download cmake (See: readme.html within VTK package)
configure VTK with:
build shared libraries: ON
wrap Tcl: ON
install VTK
cd pvb/pvbrowser
edit pvbrowser.pro and uncomment USE_VTK
make clean
download VTK5.x from http://www.kitware.com/VTK
download cmake (See: readme.html within VTK package)
configure VTK with:
build shared libraries: ON
wrap Tcl: ON
install VTK
cd pvb/pvbrowser
edit pvbrowser.pro and uncomment USE_VTK
make clean
make
su
cp pvbrowser /usr/local/bin/pvbrowservtk
exit
su
cp pvbrowser /usr/local/bin/pvbrowservtk
exit
5、1问题&解决
#make
lQtOpenGL -lQtGui -lQtNetwork -lQtCore -lGLU -lGL -lpthread
g++: /usr/lib64/libtcl8.5.so:没有那个文件或目录
g++: /usr/lib64/libX11.so.6:没有那个文件或目录
make: *** [pvbrowser] 错误 1
g++: /usr/lib64/libtcl8.5.so:没有那个文件或目录
g++: /usr/lib64/libX11.so.6:没有那个文件或目录
make: *** [pvbrowser] 错误 1
[root@localhost /]# ln -s /usr/lib64/libtcl8.4.so /usr/lib64/libtcl8.5.so
#export TK_INCLUDE_PATH=/usr/local/include/
#export TK_LIBRARY=/usr/local/lib/
#export TK_WISH=/usr/local/bin/
#export TK_LIBRARY=/usr/local/lib/
#export TK_WISH=/usr/local/bin/
# ccmake ../VTK5.10.1/
# make
# make install
6、运行及其环境变量设置:
1004 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/vtk-5.10/
1007 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
1007 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
1006 pvbrowservtk