0

in a regular system, i could, if i had to, export librarys to stop tcl from complaining about not finding init.tcl. i am building a snap package to distribute tcl though. Once built and installed, i can run tcl.tclsh(this is the form it takes to maintain snap namespace) and it complains the above complaint and stays in the tclsh prompt. i can run a tcl script fine. however, i cant execute another binary called wish. this has the snap name tcl.wish. both of these are in the same snap and the file in question, init.tcl, is present in the library location tcl complains about not finding. i believe i need to export the necessary library locations just before tclsh executes so it can find this file. i tried this including an echo of these paths so i know its getting executed. this works but still doesnt help. i guess i am just stumped by more than one thing. i am no tcl pro and snappy packages are new and commands always evolving. i can move all binaries to /bin and all librarys to /lib with the organize command or i can put them exactly how tcl expects it. i vote for putting the files how they are expected. my questions:

  1. is there a well defined set of expected locations for tcl and tk? like an ideal setup out of the box?
  2. can i move init.tcl to a location already in a path it knows? i have avoided putting these lib paths in bashrc because this would only fix my situation but not someone who installs this on their machine. any path setting should take place when running a snap package ...i think.

sorry about the length. i wanted to make it clear we are dealing with tcl inside of a snappy enviornment whether or not this matters. i know i am missing the obvious because snapcraft should put these files where the .debs tell it to and my install on my computer works just fine. $ export -p does not show anything tcl or tk

Roman Khimov
  • 4,807
  • 1
  • 27
  • 35
user116272
  • 21
  • 1

1 Answers1

1

Here is the solution for anyone wanting to try this. Tcl was complaining about not finding init.tcl and wish wasnt even starting up. I tried every way to export the path the file was in with no luck. I noticed when generating a snap package, a wrapper is generated for each exposed binary. In this package I created two binaries - tclsh and wish. With no luck exporting I copied the wrapper files to where the snapcraft.yaml file is, because cleaning the system would kill all the previous files generated. I added the following to each wrapper:

export TCL_LIBRARY=$SNAP/usr/share/tcltk/tcl8.6:$TCL_LIBRARY:$TK_LIBRARY
export TK_LIBRARY=$SNAP/usr/share/tcltk/tk8.6:$TK_LIBRARY:$TCL_LIBRARY

Then I edited the apps: section to reflect the use of wrappers, not direct binary calls.

apps:
  tclsh:
    command: tclsh.wrapper #used to be just tclsh without the benefit of a wrapper with exports in it
    plugs: [home, unity7, network, x11]
  wish:
    command: wish.wrapper # same as above
    plugs: [home, unity7, network, x11]

Finally in my glue section I included those wrappers:

glue:
  plugin: copy
    files:
      tclsh.wrapper: usr/bin/tclsh.wrapper
      wish.wrapper: usr/bin/wish.wrapper

I then made the snap package and installed it. Both tclsh and wish work as expected with no complaints.

The execute command for tclsh is tcl.tclsh and for wish it is tcl.wish

tttppp
  • 7,723
  • 8
  • 32
  • 38
user116272
  • 21
  • 1