为什么要源码安装automake1.16?
基于coreutils-8.32, 修改了linux系统命令head、tail的源码, 引入了一个自定义的.a文件,需重新编译。
但是编译时报错了:
configure.ac:38: error: version mismatch. This is Automake 1.15.1,
configure.ac:38: but the definition used by this AM_INIT_AUTOMAKE
configure.ac:38: comes from Automake 1.16.1. You should recreate
configure.ac:38: aclocal.m4 with aclocal and run automake again.
WARNING: 'automake-1.15' is probably too old.
看上去需要安装 Automake 1.16.1 版本。
automake本质上是一个perl脚本, 安装是很容易的,从官网下载(https://ftp.gnu.org/gnu/automake/),然后安装(./configure && make )即可。
但是在部署的时候出现了一些问题,记录之:
1.安装完成后,执行bin目录下面automake 失败:
robert@10-23-227-66:~/software/automake-1.16.1$ ./bin/automake
Can't locate Automake/Config.pm in @INC (you may need to install the Automake::Config module) (@INC contains: /home/robert/software/automake-1.16.1/lib2 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./bin/automake line 47.
BEGIN failed--compilation aborted at ./bin/automake line 47.
原因是找不到 Automake/Config.pm ,此时查看 bin/automake 中 @INC 相关内容为:
unshift (@INC, '/usr/local/share/automake-1.16')
但是该目录下并没有Automake/Config.pm , 而Automake 在安装目录的lib目录下,为此需要做一次拷贝:
sudo cp -r lib/Automake /usr/local/share/automake-1.16/
拷贝成功后automake即可使用。此后可以将其部署到系统目录下(/usr/bin)。
2.在 coreutils-8.32 目录下执行make 报错:
robert@10-23-227-66:/data/robert/software/blockfs_tools/coreutils-8.32$ make
cd . && /bin/bash /data/robert/software/blockfs_tools/coreutils-8.32/build-aux/missing automake-1.16 --gnu Makefile
automake-1.16: error: cannot open < /usr/local/share/automake-1.16/am/header-vars.am: No such file or directory
Makefile:7034: recipe for target 'Makefile.in' failed
原因同样是automake-1.16 的am相关脚本为拷贝到预期目录:/usr/local/share/automake-1.16 。 因此做一次拷贝即可:
sudo cp -r lib/am /usr/local/share/automake-1.16/
总结:
automake是一个规模较大的perl脚本,从源码安装时,难免会出现路径不对的问题。此时,认真分析,仔细推理,把源码目录下面相关文件,拷贝到执行地址即可。