When i am trying to execute the following tcl code i got this
can't find package des
while executing
"package require des"
(file "encdec.tcl" line 1)
Tcl code
package require des
set key "12345678"; # Must be 8 bytes long
set msg "abcde"
##### ENCRYPTION
set encryptedMsg [DES::des -dir encrypt -key $key $msg]
# $encryptedMsg is a bunch of bytes; you'll want to send this around...
##### DECRYPTION
set decryptedMsg [DES::des -dir decrypt -key $key $encryptedMsg]
puts "I got '$decryptedMsg'"
how to get that package ?
This package is a part of "the standard Tcl library", tcllib.
If you're using a "batteries included" Tcl distribution, like ActiveTcl, you should use its means to get this package; for instance, with ActiveTcl, the command to install tcllib would be
teacup install tcllib
(you should run it in your Windows console prompt).
If you're using Tcl installed from a package of your operating system, tcllib is typically available in the form of a package as well. For instance, on a Debian (or its derivative) the command to install tcllib would be
apt-get install tcllib
Next time please tell us about your platform up front, without forcing anyone here to guess.
Related
I'm building DBI and DBD::mysql in a continuous integration build server. The build of DBI is successful, as seen in the excerpt of the build log below. It clearly installs DBI/DBD.pm in the correct location.
pushd DBI-1.643
perl Makefile.PL INSTALL_BASE=/data/pods/mysql-tools/mysql-tools/current
...
Installing /data/pods/mysql-tools/mysql-tools/current/lib/perl5/x86_64-linux-thread-multi/DBI/DBD.pm
...
Appending installation info to /data/pods/mysql-tools/mysql-tools/current/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
But the next part of the build for DBD::mysql fails because it can't find the files installed by DBI.
pushd DBD-mysql-4.050
perl Makefile.PL INSTALL_BASE=/data/pods/mysql-tools/mysql-tools/current --ssl
Can't locate DBI/DBD.pm in #INC (#INC contains:
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5 .)
at Makefile.PL line 15.
You can see, MakeMaker for DBD::mysql isn't adding the install location to its #INC at all. It just has default directories.
Is there a way to pass an argument to MakeMaker to add the install directory to #INC? I suppose I could hard-code it, but that seems improper and hard to maintain. Is there a better way to automatically add INSTALL_BASE/lib/perl5/<arch> to #INC?
Environment:
CentOS 7 Linux
Perl 5.16.3
I would have preferred to use cpanm of course. But the CI build server is isolated from the internet because of my employer's security policy. No http proxying is allowed from CI.
According to the documentation, INSTALL_BASE is used for telling make install where to put the installed module:
INSTALL_BASE
INSTALL_BASE can be passed into Makefile.PL to change where your
module will be installed. INSTALL_BASE is more like what everyone else
calls "prefix" than PREFIX is.
but it does not tell perl where to look for installed modules. To do that you can use the environment variable PERL5LIB, according to the documentation :
PERL5LIB
A list of directories in which to look for Perl library files before
looking in the standard library. Any architecture-specific and
version-specific directories, such as version/archname/, version/, or
archname/ under the specified locations are automatically included if
they exist, with this lookup done at interpreter startup time. In
addition, any directories matching the entries in
$Config{inc_version_list} are added.
I'm trying to install modules from SourceForge and I'm getting an error that a variable named TCL_LIB_SPEC is not set. What is this supposed to be set to?
The answer here is to install the TCL development package
% yum install tcl-devel
This gives you a tclConfig.sh file at /usr/lib64/tcl8.5
So
% cd /usr/lib64/tcl8.5
% . ./tclConfig.sh
Then configure works.
It's supposed to be set to the instructions to use with your compiler for linking against the Tcl C library, and it should (conventionally) be generated by running the relevant configure script inside a Tcl source distribution. Or a distribution of Tcl (e.g., on Linux perhaps called tcl-dev) may have alternate correct values already set up.
mcu8051ide on Linux mint 19 not working or opening, all dependencies are installed but when I check libraries, itcl is not present is the error.
I am confused what to do?
I installed Linux mint 19 in a virtual machine to check out what's going on.
The Itcl 3.4 pkgIndex.tcl file has the following contents:
# Tcl package index file, version 1.0
if {![package vsatisfies [package provide Tcl] 8.6]} {return}
package ifneeded Itcl 3.4 [list load [file join /usr lib x86_64-linux-gnu "libitcl3.4.so.1"] Itcl]
This means that Itcl will only be available with Tcl 8.6. However, mcu8051ide specifically starts tclsh8.5. That's the reason it can't find Itcl.
The mcu8051ide command is a very short shell script that only starts tclsh8.5 and passes /usr/share/mcu8051ide/lib/main.tcl as the script to run. If instead you run that script with tclsh (which is a symbolic link that points to tclsh8.6), it seems to work at first glance.
So, you can either modify the original startup script, or put a modified copy in your own bin directory.
go to /usr/local/share/mcu8051ide/lib
(or to /usr/share/mcu8051ide/lib depending on config during cmake)
and then edit the main.tcl file
using sudo nano main.tcl
On the 51st line,
change the value for MIN_TCL_VER from 8.5 to 8.6.
When I run a tcl script in linux, the system return the error "can't find package Tclx"
I've checked the ActiveTcl-8.5/lib file, the Tcl8.5 exists.
Has anyone met it before? What can I do ?
Are you sure you are running ActiveState's tclsh?
tclsh is included in most Linux distributions, but TclX is not.
bll-tecra:bll$ which tclsh
/usr/bin/tclsh
bll-tecra:bll$ tclsh
% package require Tclx
can't find package Tclx
% exit
bll-tecra:bll$ /home/bll/ActiveTcl-8.5/bin/tclsh
% package require Tclx
8.4
% exit
execute the command, link your Tcl installation to the new repository - pick any shell in your Tcl installation
bash> teacup link make /path/to/new/repository /path/to/shell
install the package Tclx
bash> teacup install Tclx
check the environment from within your Tcl shell:
% package require Tclx
I am using the following code
#!/usr/bin/expect -f
#!usr/bin/expect
#package require Expect
puts "Hello world"
spawn ssh xyz#172.31.112.182
expect -nocase "password:"
send "abc123\r"
puts "done"
while executing, it throws error
Hello world
invalid command name "spawn"
while executing
"spawn ssh xyz#172.31.112.182"
(file "temp.tcl" line 9)
whats the wrong in my code
remove '#' before package require Expect.
The problem you've got is that while it is running in Tcl (I recognize that format of trace), the Expect package (which provides the spawn command) is absent for some reason. The first thing to do is to make the requirement for the Expect package explicit by uncommenting that package require line. That may be enough to fix your problem in itself, but if not it will complain about the package not being available. If it's not available, that means either that it just isn't installed, or that it's not being found. The former is... obvious to fix. :-) The latter is resolved by putting a line like this before that package require:
lappend auto_path /full/path/to/Expect/package/installation
Note that if you run the script with the expect program instead of the tclsh program, that package require will be done for you automatically. You're obviously not doing that…
Try running under tcl interpreter (!/usr/bin/tcl) and import Expect.
Did you installed Expect on your PC?
Please run the following command on your PC to check if Expect is available.
$which expect
/usr/bin/expect
sudo apt-get update -y
sudo apt-get install -y expect
which expect
Run the above commands respectively. If installed correctly, "which expect" will show "/usr/bin/expect" as an output. Run your script after installation,