环境: VTK-8.1.1 Mac OS X 10.13.6 /usr/bin/tclsh build vtk,cmake一下: cmake ./ -G "Unix Makefiles" \ -DVTK_USE_QVTK:BOOL=ON \ -DCMAKE_INSTALL_PREFIX=/usr/local \ -DVTK_USE_GUISUPPORT:BOOL=ON \ -DVTK_QT_VERSION=5 \ -DModule_vtkGUISu
环境:
VTK-8.1.1
Mac OS X 10.13.6
/usr/bin/tclsh
build vtk,cmake一下:
cmake ./ -G "Unix Makefiles" \-DVTK_USE_QVTK:BOOL=ON \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DVTK_USE_GUISUPPORT:BOOL=ON \
-DVTK_QT_VERSION=5 \
-DModule_vtkGUISupportQt:BOOL=ON \
-DModule_vtkGUISupportQtOpenGL:BOOL=ON \
-DModule_vtkGUISupportQtSQL:BOOL=ON \
-DModule_vtkGUISupportQtWebkit:BOOL=OFF \
-DModule_vtkRenderingQt:BOOL=ON \
-DModule_vtkViewsQt:BOOL=ON \
-DVTK_WRAP_TCL:BOOL=ON \
-DTCL_INTERNAL_PATH=/Users/weiyang/Downloads/VTK-8.1.1/ThirdParty/TclTk/internals/tk8.6
注意:Module_vtkGUISupportQtWebkit 是被关掉的。
然后make, make install。
接着尝试使用tcl脚本
can't find package vtk
while executing
"package require vtk"
(file "assembly.tcl" line 8)
查看默认的Tcl变量 auto_path:
weiyang@WeiMac ~/Downloads tclsh% puts $auto_path
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources /usr/lib ~/Library/Tcl /Library/Tcl /System/Library/Tcl /System/Library/Tcl/8.5 ~/Library/Frameworks /Library/Frameworks /System/Library/Frameworks
%
寻找pkgIndex.tcl 的路径:
✘ weiyang@WeiMac ~ find / -name pkgIndex.tcl 2>/dev/null/usr/local/lib/tcltk/vtk-8.1/pkgIndex.tcl
/System/Library/Tcl/tklib0.5/crosshair/pkgIndex.tcl
/System/Library/Tcl/tklib0.5/tablelist/pkgIndex.tcl
/System/Library/Tcl/tklib0.5/tooltip/pkgIndex.tcl
...
将包含pkgIndex.tcl的路径/Users/weiyang/Downloads/VTK-8.1.1/Wrapping/Tcl放到 auto_path中。可设置环境变量TCLLIBPATH
weiyang@WeiMac ~/Downloads/VTK-8.1.1/Examples/Rendering/Tcl export TCLLIBPATH=/Users/weiyang/Downloads/VTK-8.1.1/Wrapping/Tclweiyang@WeiMac ~/Downloads/VTK-8.1.1/Examples/Rendering/Tcl tclsh
% puts $auto_path
/Users/weiyang/Downloads/VTK-8.1.1/Wrapping/Tcl /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources /usr/lib ~/Library/Tcl /Library/Tcl /System/Library/Tcl /System/Library/Tcl/8.5 ~/Library/Frameworks /Library/Frameworks /System/Library/Frameworks
% exit
然后就能正常解释,运行tcl脚本:
weiyang@WeiMac ~/Downloads/VTK-8.1.1/Examples/Rendering/Tcl vtk assembly.tcl