libtool:您应该使用 libtool 2.4.6 中的宏重新创建 aclocal.m4

libtool: You should recreate aclocal.m4 with macros from libtool 2.4.6

我正在尝试编译和安装 phpredis 存储库的分支 php7,但出现以下错误:

    
    /bin/sh /root/phpredis/libtool --mode=compile cc  -I. -I/root/phpredis -    DPHP_ATOM_INC -I/root/phpredis/include -I/root/phpredis/main -I/root/phpredis -I/usr/lib64/php7.0/include/php -I/usr/lib64/php7.0/include/php/main -I/usr/lib64/php7.0/include/php/TSRM -I/usr/lib64/php7.0/include/php/Zend -I/usr/lib64/php7.0/include/php/ext -I/usr/lib64/php7.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c         /root/phpredis/redis.c -o redis.lo 
    libtool: Version mismatch error.  This is libtool 2.4.6, but the
    libtool: definition of this LT_INIT comes from an older release.
    libtool: You should recreate aclocal.m4 with macros from libtool 2.4.6
    libtool: and run autoconf again.
    Makefile:193: recipe for target 'redis.lo' failed
    make: *** [redis.lo] Error 63

现在这是我遵循的步骤:

    git clone https://github.com/phpredis/phpredis.git
    cd phpredis/
    git checkout php7
    phpize && ./configure --with-php-config=/usr/bin/php-config && make

工具版本:

    # autoconf --version
    autoconf (GNU Autoconf) 2.69

    # aclocal --version
    aclocal (GNU automake) 1.15

    # libtoolize --version
    libtoolize (GNU libtool) 2.4.6

运行 autoreconf --force --install 我得到以下信息:

    # autoreconf --force --install
    libtoolize: putting auxiliary files in '.'.
    libtoolize: copying file './ltmain.sh'
    libtoolize: You should add the contents of the following files to 'aclocal.m4':
    libtoolize:   '/usr/share/aclocal/libtool.m4'
    libtoolize:   '/usr/share/aclocal/ltoptions.m4'
    libtoolize:   '/usr/share/aclocal/ltsugar.m4'
    libtoolize:   '/usr/share/aclocal/ltversion.m4'
    libtoolize:   '/usr/share/aclocal/lt~obsolete.m4'
    libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.in,
    libtoolize: and rerunning libtoolize and aclocal.
    libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

那么我会做:

cat /usr/share/aclocal/libtool.m4 /usr/share/aclocal/ltoptions.m4 /usr/share/aclocal/ltsugar.m4 /usr/share/aclocal/ltversion.m4 /usr/share/aclocal/lt~obsolete.m4 >> aclocal.m4  
Then i add  AC_CONFIG_MACRO_DIRS([m4]) to the top level of configure.in

现在 运行 autoreconf --force --install 没有输出,但我在尝试编译 phpredis 时仍然遇到同样的错误。

我终于解决了这个问题。如果您遇到上述问题,这些是获取 phpredis 运行 所需的步骤:

git clone https://github.com/phpredis/phpredis.git
cd phpredis/
git checkout php7
rm -f aclocal.m4
phpize
aclocal && libtoolize --force && autoreconf
./configure --with-php-config=/usr/bin/php-config && make
# in my case previous make command installed the redis.so into ~/phpredis/modules/ 
make install #optional