安装了libtool但找不到libtoolize

时间:2013-03-16 11:17:15

标签: macos libxml2 autotools autoconf libtool

我试图在我的mac上从源代码构建libxml2。

所以我使用macport安装了autoconf libtool和automake

autoconf和automake似乎按预期正常工作。

我首先尝试运行autogen.sh。

不幸的是,libtoolize --version提供了

-bash: libtoolize: command not found

我尝试再次跑步

sudo port install libtool

--->  Cleaning libtool
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.

我试试

locate libtool

似乎安装得很好

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man/man1/libtool.1
/Applications/Xcode.app/Contents/Developer/usr/bin/libtool
/Applications/Xcode.app/Contents/Developer/usr/share/man/man1/libtool.1
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/cross/mipsel-linux-binutils/files/110-uclibc-libtool-conf.patch
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/libtool
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/libtool/Portfile
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/libtool/files
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/libtool/files/ltmain.m4sh-allow-clang-stdlib.diff
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/libtool-devel
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/libtool-devel/Portfile
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/openslp/files/libtool-tags.patch
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/t1lib/files/patch-libtool-tag.diff
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/print/pdflib/files/patch-libtool.diff
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/security/steghide/files/libtool-tag.diff
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/www/apache2/files/libtool-tag.diff
/usr/bin/libtool
/usr/lib/php/build/libtool.m4
/usr/share/apr-1/build-1/libtool
/usr/share/man/man1/libtool.1

如何让libtoolize工作?

4 个答案:

答案 0 :(得分:38)

您通常需要使用glibtoolglibtoolize,因为在OS X上已经存在libtool作为创建Mach-O动态库的二进制工具。所以,这就是MacPorts如何使用程序名称转换来安装它,尽管端口本身仍然被命名为“libtool”。

某些autogen.sh脚本(或其等效脚本)将尊重LIBTOOL / LIBTOOLIZE个环境变量。我在自己的autogen.sh脚本中有一行:

case `uname` in Darwin*) glibtoolize --copy ;;
  *) libtoolize --copy ;; esac

您可能想要也可能不想要--copy标志。


注意:如果您使用MacPorts安装了自动工具,则正确编写的configure.ac文件Makefile.am只需要autoreconf -fvi。它应按预期调用glibtoolize等。否则,某些包将分发autogen.sh或类似的脚本。

答案 1 :(得分:22)

我希望我的答案不是太天真。我是OSX的小伙子。

brew安装libtool为我解决了类似的问题。

答案 2 :(得分:1)

要汇集一些线程,请在使用 brew 安装libtoolize时将glibtoolize安装为libtool。这可以通过以下方式实现:安装它,然后为libtoolize创建一个软链接:

brew install libtool
ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize

答案 3 :(得分:0)

Brew的替代方法是使用macports。例如:

$ port info libtool
libtool @2.4.6_5 (devel, sysutils)
Variants:             universal

Description:          GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface.
Homepage:             https://www.gnu.org/software/libtool

Build Dependencies:   xattr
Platforms:            darwin, freebsd
License:              libtool
Maintainers:          Email: larryv@macports.org, GitHub: larryv

然后像Brew一样,您这样做:

$ sudo port install libtool
Password:
--->  Fetching archive for libtool
--->  Attempting to fetch libtool-2.4.6_5.darwin_15.x86_64.tbz2 from https://packages.macports.org/libtool
--->  Attempting to fetch libtool-2.4.6_5.darwin_15.x86_64.tbz2.rmd160 from https://packages.macports.org/libtool
--->  Installing libtool @2.4.6_5
--->  Activating libtool @2.4.6_5
--->  Cleaning libtool
--->  Updating database of binaries
--->  Updating database of C++ stdlib usage
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  No broken ports found.

然后,您可以检查它的位置...顺便说一句,您可以将glibtoolize软链接到libtoolize。对于我的需求来说还可以

$ which glibtoolize
/opt/local/bin/glibtoolize