Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Help: To install tcl and expect on Linux system

Posted by kumar (kumar), 5 February 2004
Hi,

I am trying to setup tcl and expect on a linux platform for some test automation. In my earlier company I have used and  developed some expect scripts. But had never setup tcl and  expect from the  scratch. I have joined in a new company, I have to setup this environment.

I have downloaded both the tar files tcl and expect and the  followed the instructions, not sure if I am making some mistake. the steps I have followed are  shown below:

"configure" and "make" goes through fine wthout any errors.

If some body have a simple neat procedure that would really help me out.

After successful installation, I tried to run couple of sample examples given along with expect and gets the error shown  below.

Any help is greatly appreciated.

cp tcl8.2.0.tar /usr/local/src
cp expect.tar   /usr/local/src

cd /usr/local/src

tar xvf tcl8.2.0.tar
tar xvf expect.tar

# Tcl

cd tcl8.2.0/unix
./configure
make install

--------------------------------------
# Expect

cd /usr/local/src/expect-5.40
./configure
make



/usr/local/src/expect-5.40/expect: -bash-2.05b$ ./vrfy
/usr/local/src/expect-5.40/expect: error while loading shared
libraries:
libtcl8.2.so: cannot open shared object file: No such file or directory



cat ./vrfy


#!/usr/local/src/expect-5.40/expect -f


# separate address into user and host
regexp (.*)@(.*) $argv ignore user host

log_user 0
set timeout -1

# host might be an mx record, convert to a real host via nslookup spawn nslookup expect "> " send "set query=mx\r" expect "> " send "$host\r" expect {
       "No mail exchanger" {}
       -re "mail exchanger = (\[^\r]*)" {
               set host $expect_out(1,string)
       }
}

spawn telnet $host smtp
expect "220*\r\n"
send "vrfy $user\r"
expect  "250" {send_user "GOOD\n"} \
       "550" {send_user "BAD\n"}
-bash-2.05b$



Posted by admin (Graham Ellis), 5 February 2004
Let's ask some questions to help narrow this down:

a) Why are you installing Tcl and Expect / don't you already have them with your Linux distribution?

b) You appear to be using the latest Expect (5.40) with quite an old Tcl (8.2 - from about 5 years ago).  Any reason?

c) Did you test your Tcl install once it was complete, before you installed expect?

d) Is you library path set up correctly?

e) Does the libtcl exist?  In the right place?  Anywhere?

Posted by kumar (kumar), 5 February 2004
Hi Graham,

Thank you for the quick response: My responses are prefixed with >>

Let's ask some questions to help narrow this down:  
 
a) Why are you installing Tcl and Expect / don't you already have them with your Linux distribution?  

>> I was not sure if it comes with the Linux OS, after your response I have checked  
>> rpm -qa | grep tcl; which shows the version as  tcl-8.3.5-88  
>> rpm -qa | grep -i expect does not show anything.
>> Is expect a part of Linux distribution? I was just following the instructions  
>>  from the web-site http://expect.nist.gov/

 
b) You appear to be using the latest Expect (5.40) with quite an old Tcl (8.2 - from about 5 years ago).  Any reason?

>> No specific reason, I saw in one of the expect install doc which says that tcl 8.2  
>> or above, so just picked up. All I need is my expect to be up and running,  
>> I have to automate large number of test-suites on network environment.
>> I was not knowing tcl_8.2 was that old.   If you can suggest me the tcl  
>> ver that would be great
 
c) Did you test your Tcl install once it was complete, before you installed expect?  
>> Yes, I have tested by executing  tclsh  executed couple of commands  
>> from % prompt and they were working fine.  

d) Is you library path set up correctly?  

>> I do not know how to set it up. Any help would be great.  
 
e) Does the libtcl exist?  In the right place?  Anywhere?

>> How do I check this up?

>> (PS: I am not hardcore developer, but good at unix, shell programming)
>> (so pl navigate me accordingly)
>> I am really very happy about the help I am getting, should help this in the new job..)

>>Thanks in advance.


Posted by admin (Graham Ellis), 5 February 2004
It looks to me as if your install of Tcl 8.2 when Tcl 8.3.5 was already there may have caused a problem for the Expect install; it found Tcl there, but got confused between the two versions!

Personally, I would start afresh and look around before I installed either Tcl or Expect (and Expect might be part of the Tcl RPM anyway!) because I think you might need to do nothing.  There are very often install directions on web sites like expect so that folks can upgrade to the very latest, but the vast majority of us are not pushing the technology and so we don't need to put in a minor upgrade (e.g. from expect 5.38 which I suspect you might already have there to expect 5.40).  I know it's very easy for me to suggest starting afresh, but that could be a lot of work restoring backups ... but without being able to type in commands to the machine and see what it does, we could end up with a very long thread otherwise.

I'm guessing you installed tcl and expect as the root user?  If so, the caution is "be careful - be VERY careful".  If not, your problem could simply be that some files weren't copied as you installed from a regular user account.

To find a file under Linux (search from root, name starts with libtcl):
      find / -name "libtcl*" -print
to learn more about find
      man find

Final tip, just try typing in expectk (that k on the end is NOT a typo) at the command line; you may find that your Linux has a clean Expect + Tk installed and that it remains intact.

Posted by kumar (kumar), 5 February 2004
Hi Graham,

After your reply, I tried checking up on couple of systems in our lab. Some of the systems have only tcl. Some systems were upgraded to Red Hat Enterprise Linux AS 3.0

Those systems have both expect and tcl

-bash-2.05b$ rpm -qa | grep expect
expect-5.38.0-92

-bash-2.05b$ rpm -qa | grep tcl
tcl-8.3.5-92

I tried executing couple of expect scripts, they worked fine.

So this takes care  of my requirements.

Thanks a million for the help, kind and promt response. It really releived me lot of tension in my new job.

Once again thank you so much...

Regards, Kumar

Posted by admin (Graham Ellis), 5 February 2004
My pleasure ... and enjoy the job!





This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho