2021-10-04

PLplot, Tcl and openSUSE

我不知道在其它平台的情況怎麼樣,但是有趣的地方在於,如果我自己從 source code build 以後安裝,問題反而小一點。

首先是使用 zypper 安裝:

sudo zypper in plplot-common plplot-tcltk-devel plplot-driver-cairo plplot-driver-svg

從安裝檔案可以發現,pkgIndex.tcl 在 /usr/share/plplot5.15.0 (ps. 版本號要看安裝的版本而定),所以要讓 Tcl shell 可以正確找到的話,需要在 .tclshrc 或者是執行 tclsh 後加入下面的命令:

lappend auto_path /usr/share/plplot5.15.0

可能是因為設定的關係,pkgIndex.tcl 的目錄搜尋設定是錯的,下面是修正的設定:

    if {![string compare -length $bLen $buildDir $pkgIndexDir]} then {
        set searchdirs [list "/home/abuild/rpmbuild/BUILD/plplot-5.15.0/build/bindings/tcl"]
    } else {
        set searchdirs [list "/usr/lib64"]
    }
    if {![string compare -length $bLen $buildDir $pkgIndexDir]} then {
        set searchdirs [list "/home/abuild/rpmbuild/BUILD/plplot-5.15.0/build/drivers"]
    } else {
        set searchdirs [list "/usr/lib64/plplot5.15.0/drivers"]
    }
    if {![string compare -length $bLen $buildDir $pkgIndexDir]} then {
        set searchdirs [list "/home/abuild/rpmbuild/BUILD/plplot-5.15.0/build/drivers"]
    } else {
        set searchdirs [list "/usr/lib64/plplot5.15.0/drivers"]
    }

 

如果使用 tclsh ,還需要:

package require Pltcl

 

但是設定完上列的項目,在 pltcl 執行 plinit 初始化仍然會有下面的錯誤訊息:

plInitDispatchTable: Could not open drivers directory, aborting operation

或者是 tclsh 沒有選擇列表的情況下有下列的訊息:

Enter device number or keyword:

這表示 PLplot 找不到 driver 的位置(但是其實你已經安裝了)。 一個解法是設定 PLPLOT_DRV_DIR,例如下面的設定:

export PLPLOT_DRV_DIR=/usr/lib64/plplot5.15.0/drivers

沒有留言: