2

我正在使用一种可以简化基于 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,它会构建得很好:

$ 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”在做什么,为什么会导致构建失败?

4

2 回答 2

4

我认为问题出在这里:

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 上的自动工具还不足以真正为系统重新配置任何东西。因此,如果我需要重新配置,我通常会从 GNU 镜像中获取最新的自动工具并制作它们的本地版本。

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

于 2011-10-11T19:42:57.557 回答
0

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

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

于 2011-10-13T12:52:18.747 回答