What is the correct method for compiling a c++ application with TCL/TK8.4 so that it can be run on a system with TCL/TK8.5?

StackOverflow https://stackoverflow.com/questions/22176975

Question

I have a C++ application that acts as an interpreter for TCL/TK. tms was compiled against TCL/TK8.4.

I need to run this in an environment that only has TCL/TK8.5 installed.

When I run the application on the TCL/TK8.5 system, I get this error:

tms: error while loading shared libraries: libtk8.4.so: cannot open shared object file: No such file or directory

tms is compiled on a Linux box using g++ and the -ltcl8.4 and -ltk8.4 flags.

Était-ce utile?

La solution

If you linked the application against the 8.4 libraries then you have to have 8.4 shared objects present to run the application. You should be shipping your executable plus all the tcl libraries and scripts necessary as a package.

Having said that -- it is actually possible to do what you are talking about. The stubs mechanism used to allow Tcl extensions to be loaded into hight versions of tcl than they were compiled against can be extended to use in executables that host the Tcl interpreter. See the tcl wiki for more detailed discussion but you can arrange to dynamically load the Tcl shared library and initialize it using the stubs mechanism. There is an example on that page. However, doing this may lead to issues where the installed version of Tcl is missing things your application expects. If you stick with the standard route for embedding Tcl where you ship your application plus all the Tcl files required you can insulate your application from system specific variations.

Another possibility is to link your application to a dll/shared library that includes a virtual filesystem that contains all the supporting Tcl scripts. Originally referred to as stardll and also as basekit dlls. This makes it possible to link your executable to a single dll/.so that holds all the Tcl dependent information.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top