报错信息
在编译安装libnet时,遇到报错如下:
[root@localhost libnet-master]# ./autogen.sh
autoreconf: export WARNINGS=portability
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4 ${ACLOCAL_FLAGS}
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
src/Makefile.am:11: error: Libtool library used but 'LIBTOOL' is undefined
src/Makefile.am:11: The usual way to define 'LIBTOOL' is to add 'LT_INIT'
src/Makefile.am:11: to 'configure.ac' and run 'aclocal' and 'autoconf' again.
src/Makefile.am:11: If 'LT_INIT' is in 'configure.ac', make sure
src/Makefile.am:11: its definition is in aclocal's search path.
autoreconf: error: automake failed with exit status: 1
解决方案
先检查
whereis m4 whereis autoconf whereis automake whereis libtool
看看是否有几个东西
想成功运行autoreconf命令,这四个东西都要有
如果wget下载不了,可以直接去http://mirrors.kernel.org/gnu/*这几个网址下载想要的版本的包,之后传到服务器中,对应的tar命令也是解压你下载的那几个版本的,别盲目
安装m4
wget http://mirrors.kernel.org/gnu/m4/m4-1.4.13.tar.gz \
tar -xzvf m4-1.4.13.tar.gz \
cd m4-1.4.13 \
./configure --prefix=/usr
make
make install
cd ..
安装autoconf
wget http://mirrors.kernel.org/gnu/autoconf/autoconf-2.65.tar.gz \
tar -xzvf autoconf-2.65.tar.gz \
cd autoconf-2.65 \
./configure --prefix=/usr
make
make install
cd ..
检查是否安装成功
autoconf -V
安装automake
wget http://mirrors.kernel.org/gnu/automake/automake-1.11.tar.gz \
tar xzvf automake-1.11.tar.gz \
cd automake-1.11 \
./configure --prefix=/usr
make
make install
cd ..
安装libtool
wget http://mirrors.kernel.org/gnu/libtool/libtool-2.2.6b.tar.gz \
tar xzvf libtool-2.2.6b.tar.gz \
cd libtool-2.2.6b \
./configure --prefix=/usr
make
make install
cd ..
大多数m4文件都在/usr/share/aclocal/目录下,但实际上configure的默认aclocal路径为/usr/local/share/aclocal,
那么可以有两种方法,
第一,将/usr/share/aclocal/下的*.m4文件都拷贝到usr/local/share/aclocal/目录下;
# 我是这么解决的
sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/
第二,指定aclocal的安装路径;
再次./autogen.sh,就通过了。