8.17. Expect-5.45.4

The Expect package contains tools for automating, via scripted dialogues, interactive applications such as telnet, ftp, passwd, fsck, rlogin, and tip. Expect is also useful for testing these same applications as well as easing all sorts of tasks that are prohibitively difficult with anything else. The DejaGnu framework is written in Expect.

Approximate build time: 0.2 SBU
Required disk space: 3.9 MB

8.17.1. Installation of Expect

Expect needs PTYs to work. Verify that the PTYs are working properly inside the chroot environment by performing a simple test:

python3 -c 'from pty import spawn; spawn(["echo", "ok"])'

This command should output ok. If, instead, the output includes OSError: out of pty devices, then the environment is not set up for proper PTY operation. You need to exit from the chroot environment, read Section 7.3, “Preparing Virtual Kernel File Systems” again, and ensure the devpts file system (and other virtual kernel file systems) mounted correctly. Then reenter the chroot environment following Section 7.4, “Entering the Chroot Environment”. This issue needs to be resolved before continuing, or the test suites requiring Expect (for example the test suites of Bash, Binutils, GCC, GDBM, and of course Expect itself) will fail catastrophically, and other subtle breakages may also happen.

Update two config scripts to allow building this package for AArch64:

tar -C tclconfig -xf ../autoconf-2.72.tar.xz --strip-components=2 \
    autoconf-2.72/build-aux/config.{guess,sub}

Now, make some changes to allow the package with gcc-14.1 or later:

patch -Np1 -i ../expect-5.45.4-gcc14-1.patch

Prepare Expect for compilation:

./configure --prefix=/usr           \
            --with-tcl=/usr/lib     \
            --enable-shared         \
            --disable-rpath         \
            --mandir=/usr/share/man \
            --with-tclinclude=/usr/include

The meaning of the configure options:

--with-tcl=/usr/lib

This parameter is needed to tell configure where the tclConfig.sh script is located.

--with-tclinclude=/usr/include

This explicitly tells Expect where to find Tcl's internal headers.

Build the package:

make

To test the results, issue:

make test

Install the package:

make install
ln -svf expect5.45.4/libexpect5.45.4.so /usr/lib

8.17.2. Contents of Expect

Installed program: expect
Installed library: libexpect5.45.4.so

Short Descriptions

expect

Communicates with other interactive programs according to a script

libexpect-5.45.4.so

Contains functions that allow Expect to be used as a Tcl extension or to be used directly from C or C++ (without Tcl)