1.下载源码
tcl库源码
https://sourceforge.net/projects/expect/files/Expect/5.45/expect5.45.tar.gz/download
expect源码
Download expect5.45.tar.gz (Expect)
先编译tcl,再编译expect
2.交叉编译tcl
先执行以下两句,
export tcl_cv_strtod_buggy=1
export ac_cv_func_strtod=yes
否则会报错
fixstrtod.o: In function `fixstrtod':
fixstrtod.c:(.text+0x0): multiple definition of `fixstrtod'
strtod.o:strtod.c:(.text+0x0): first defined here
进入tcl源码的unix目录
./configure --prefix=/home/xxx/output CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ --host=aarch64-linux
make
make install
3.交叉编译expect
expect本身不支持交叉编译,可以先config,再修改Makefile
./configure --prefix=/home/xxx/output --with-tcl/home/xxx/output/lib --witch-tclinclude=/home/xxx/output/include
修改Makefile
把CC=gcc改成CC=aarch64-linux-gnu-gcc
AR=ar 改成AR=aarch64-linux-gnu-ar
INCLUDES后面加一句,否则报错
INCLUDES=。。。。。。。 -I"use/include"
make
make install
expect可执行文件在源码目录
依赖库在output目录
参考文献: