Skip to content

Instantly share code, notes, and snippets.

@claudiobizzotto
Last active July 5, 2018 20:13
Show Gist options
  • Save claudiobizzotto/0fde9eb3c4014048b0a181982759b2f8 to your computer and use it in GitHub Desktop.
Save claudiobizzotto/0fde9eb3c4014048b0a181982759b2f8 to your computer and use it in GitHub Desktop.
Install Expect on Ubuntu 16.04

http://expect.sourceforge.net/

I've just tried this on a 16.04, but it should work on older versions of Ubuntu as well.

(1) Download and install ActiveTcl Free Community Edition

http://www.activestate.com/activetcl/downloads

Download and extract the files, then cd into the extracted directory and run ./install.sh (with root permissions).

Follow the installation instructions and put everything under the default directory (/opt).

(2) Download Expect

https://sourceforge.net/projects/expect/files/Expect/

Extract the contents into /opt.

(3) Configure, build, install Expect

From the installation directory (example /opt/expect5.45/), run the following commands:

$ sudo ./configure \
--with-tcl=/opt/ActiveTcl-8.6/lib/tcl8.6 \
--with-tclinclude=/opt/ActiveTcl-8.6/include/tcl8.6 \
--with-tk=/opt/ActiveTcl-8.6/lib/tcl8.6 \
--with-tkinclude=/opt/ActiveTcl-8.6/include/tcl8.6
$ sudo make && sudo make install

To have the final executable globally available, create a symlink for it:

$ sudo ln -s /opt/expect5.45/expect /usr/bin/expect
@quiquediez
Copy link

quiquediez commented Feb 13, 2018

You need a c compiler in your system. I used gcc (apt-get install gcc if you don't have it previously)
Actually there are some mistakes in the ./configure command as some paths don't exist.
This is what I run (I picked /usr as base folder instead of /opt):
./configure --with-tcl=/usr/ActiveTcl-8.6/lib --with-tclinclude=/usr/ActiveTcl-8.6/include --with-tk=/usr/ActiveTcl-8.6/lib/tcl8.6 --with-tkinclude=/var/ActiveTcl-8.6/include
ActiveTcl-8.6/include folder doesn't have a tcl8.6 sub-folder
And in --with-tcl you have to provide the path to tclConfig.sh which is ActiveTcl-8.6/lib not ActiveTcl-8.6/lib/tcl8.6
Apart from this everything runs smoothly.
Thanks a lot

@wisahmed
Copy link

I'm stuck at private-headers.
Below is what I get when I run ./configure :

checking for correct TEA configuration... ok (TEA 3.9)
configure: configuring expect 5.45.4
checking for Tcl configuration... found /opt/ActiveTcl-8.6/lib/tcl8.6/tclConfig.sh
checking for existence of /opt/ActiveTcl-8.6/lib/tcl8.6/tclConfig.sh... loading
configure: WARNING: With Tk request ignored - use package require Tk & Expect
configure: --prefix defaulting to TCL_PREFIX /usr
configure: --exec-prefix defaulting to TCL_EXEC_PREFIX /usr
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking whether make sets $(MAKE)... yes
checking for ranlib... ranlib
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking if the compiler understands -pipe... yes
checking whether byte ordering is bigendian... no
checking for sin... no
checking for main in -lieee... yes
checking for main in -linet... no
checking net/errno.h usability... no
checking net/errno.h presence... no
checking for net/errno.h... no
checking for connect... yes
checking for gethostbyname... yes
checking dirent.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking values.h usability... yes
checking values.h presence... yes
checking for values.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking for Tcl public headers... /opt/ActiveTcl-8.6/include/tcl8.6
checking for Tcl private include files... configure: error: Cannot find private header tclInt.h in opt/expect5.45.4/incl
  • The file tclInt.h is available in the /opt/ActiveTcl-8.6/include/ Directory .
  • I created a Symbolic link "incl" and pasted it in opt/expect5.45.4/
  • I edited the "tclConfig.sh" file, parameter "TCL_SRC_DIR" in line 149 (which had the previous [non-existent]DirectoryPath, prior to "opt/expect5.45.4/" )

Please help me understand how the filepath is being read?
If Possible, the solution to this issue .

@betsalel-williamson
Copy link

betsalel-williamson commented Jul 5, 2018

On ubuntu 16 I tried to install, but the error it gave was:

checking for correct TEA configuration... ok (TEA 3.9)
configure: configuring expect 5.45.4
checking for Tcl configuration... configure: error: /opt/ActiveTcl-8.6/lib/tcl8.6/ directory doesn't contain tclConfig.sh

I edited this to run and was able to proceed with the install.

sudo ./configure \
--with-tcl=/opt/ActiveTcl-8.6/lib \
--with-tclinclude=/opt/ActiveTcl-8.6/include \
--with-tk=/opt/ActiveTcl-8.6/lib/tcl8.6 \
--with-tkinclude=/opt/ActiveTcl-8.6/include/tcl8.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment