0

I am trying to build a kbskit which includes iwidgets and img package using the following command :

./kbs.tcl -builddir=85 -r -mk-bi -bi="itcl3.4 itk3.4 iwidgets4.0.2 img1.4.1" install kbskit8.5 

cp 85/bin/kbsmk8.5-bi kbsmk8.5-bi-run 

ls sim.vfs 
main.tcl img1.jpg 

./kbsmk8.5-bi sdx.kit wrap sim -runtime kbsmk8.5-bi-run 

ls 
kbsmk8.5-bi kbsmk8.5-bi-run sdx.kit sim.vfs sim 

./sim 
couldnt open "img1.jpg": no such file or directory 
    while executing 
"image create photo sim_img -file "img1.jpg"" 
    (file "/home/user1/sim/main.tcl" line 10) 

Why is the img1.jpg file not found here ??

I tried unwrapping to check if the file is there inside "sim" executable and it is actually present !!

cp sim /tmp 
cd /tmp
./tclkit sdx.kit unwrap sim
ls sim.vfs 
boot.tcl main.tcl img1.jpg boot.tcl tclkit.ico lib 
ls sim.vfs/lib/ 
img1.4.1 itk3.4 tcl8 thread2.6.7 vfs1.4.2 
itcl3.4  iwidgets4.0.2  tcl8.5  tk8.5 

1) Could anyone please help me out on understanding the above behaviour ?

2) I'm building kbskit on suse 32bit. If i need to use the executable on ubuntu 32/64 bit, do i need to build another executable on ubuntu ??

4

1 回答 1

1

You are trying to load the file img1.jpg from the current directory, which is ususally the directory from where you start the script/kit (e.g. If you start /use/bin/yourkit from /home/user, the current directory will be /home/user).

The solution is to use a relative path to your script:

image create photo sim_img -file [file join [file dirname [info script]] img1.jpg]

This only works while you source a file. You can either save the result from info script in a variable, or use the ::starkit::topdir variable, which points to the topdir of the kit, so

image create photo sim_img -file [file join $::starkit::topdir img1.jpg]

Should work as expected.

于 2013-09-16T09:22:51.857 回答