2

After making and installing a snap package of tcl/tk, tcl complains it cant find init.tcl in a series of libraries. This has been documented many times with windows, python and tkinter, and a virt environment. This is Linux though. From what I gather so far, tcl just needs me to export the tcl and tk library paths that contain this file. side note- that file is there and in most of the paths listed. It just doesn't know it.

Looking at the snap demo https://developer.ubuntu.com/en/snappy/build-apps/your-first-snap/

I think I need to create a script, set the library paths then launch either tcl or tk. Much like the glue used in the example. these are early days and documentation is lacking but I think I am close.

my question: Anyone know how to set the library paths inside a snap? I don't mean set it in the terminal because that will only set a path on my actual system and not for anyone using this snap on their computer. If anything is needed to answer this let me know. I am at work and cant access my files currently.

1 Answers1

0

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 2 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

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

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

dholbach
  • 1,713
  • 12
  • 27