如果在./configure之前运行“autoreconf -i”,则库无法构建

时间:2011-10-11 13:17:30

标签: macos autotools expat-parser

我正在使用一种工具来简化基于Unix的应用程序的构建过程。它自动执行的操作之一是在执行“./configure”之前运行“autoreconf -i”。但是,当它尝试在OSX(Lion)上构建expat库时,构建失败:

$ tar xfz expat-2.0.1.tar.gz; cd expat-2.0.1
$ autoreconf -i
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `conftools'.
glibtoolize: copying file `conftools/ltmain.sh'
glibtoolize: You should add the contents of the following files to `aclocal.m4':
glibtoolize:   `/usr/bin/../share/aclocal/libtool.m4'
glibtoolize:   `/usr/bin/../share/aclocal/ltoptions.m4'
glibtoolize:   `/usr/bin/../share/aclocal/ltversion.m4'
glibtoolize:   `/usr/bin/../share/aclocal/ltsugar.m4'
glibtoolize:   `/usr/bin/../share/aclocal/lt~obsolete.m4'
glibtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.in and
glibtoolize: rerunning glibtoolize, to keep the correct libtool macros in-tree.
glibtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
$ ./configure
(Lots of output here)
configure: creating ./config.status
config.status: creating Makefile
config.status: WARNING:  Makefile.in seems to ignore the --datarootdir setting
config.status: creating expat_config.h    
$ make
bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o lib/xmlparse.lo -c lib/xmlparse.c
./libtool: line 473: CDPATH: command not found
./libtool: line 1297: func_opt_split: command not found
libtool: Version mismatch error.  This is libtool 2.2.10, but the
libtool: definition of this LT_INIT comes from an older release.
libtool: You should recreate aclocal.m4 with macros from libtool 2.2.10
libtool: and run autoconf again.

另一方面,如果我不首先执行autoreconf,它只构建fiine:

$ cd ..; rm -r expat-2.0.1; tar xfz expat-2.0.1.tar.gz; cd expat-2.0.1
$ ./configure
(Lots of output here)
configure: creating ./config.status
config.status: creating Makefile
config.status: creating expat_config.h    
$ make
/bin/sh ./libtool --silent --mode=compile gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o lib/xmlparse.lo -c lib/xmlparse.c
/bin/sh ./libtool --silent --mode=compile gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o lib/xmltok.lo -c lib/xmltok.c
/bin/sh ./libtool --silent --mode=compile gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o lib/xmlrole.lo -c lib/xmlrole.c
/bin/sh ./libtool --silent --mode=link gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -no-undefined -version-info 6:2:5 -rpath /usr/local/lib  -o libexpat.la lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo
gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/xmlwf.o -c xmlwf/xmlwf.c
gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/xmlfile.o -c xmlwf/xmlfile.c
gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/codepage.o -c xmlwf/codepage.c
gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -o xmlwf/unixfilemap.o -c xmlwf/unixfilemap.c
/bin/sh ./libtool --silent --mode=link gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H  -o xmlwf/xmlwf xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/unixfilemap.o libexpat.la

什么是“autoreconf -i”正在做什么,为什么导致构建失败?

2 个答案:

答案 0 :(得分:3)

我认为问题在于:

libtool: Version mismatch error.  This is libtool 2.2.10, but the
libtool: definition of this LT_INIT comes from an older release.
libtool: You should recreate aclocal.m4 with macros from libtool 2.2.10
libtool: and run autoconf again.

根据我对OS X Leopard和Snow Leopard的经验(我还没有尝试过Lion),实际安装OS X的autotools最近还不足以为系统重新配置任何东西。所以我通常从GNU镜像中获取最新的autotools,并在需要重新配置时制作它们的本地版本。

“autoreconf -i”将已安装的GNU autotools中的文件复制到AC_CONFIG_AUX_DIR,在这种情况下可能是ltmain.sh。

答案 1 :(得分:0)

用户永远不应该运行autoreconf。正如ldav1s指出的那样(+1),你的盒子上安装的autotools与用于生成tarball的工具不匹配。野外有许多软件包推荐(甚至要求)用户以某种形式运行autoconf来构建软件包;那些包裹坏了。正确构建的软件包应该建立在没有安装任何autotools的机器上,除非你是软件包维护者,否则你应该卸载它们。 IMO,它们不应包含在默认安装中。

如果您使用需要构建autotools的软件包,请将该软件包报告给软件包维护者。如果版本控制系统(例如git,hg,svn)被用作分发机制,那么您将需要运行autotools来构建软件包,或者软件包必须在存储库中包含autotools生成的文件。这就是版本控制系统不应该用作使用autotools的软件包的分发工具的原因。