报错“Libtool library used but ‘LIBTOOL‘ is undefined”解决方案

报错信息

在编译安装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,就通过了。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宋发元

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值