44

i'm trying to build libxml2 from source on my mac.

so i have autoconf, libtool, and automake installed using macports

autoconf and automake seem to be working fine as expected.

i try running autogen.sh first.

libtoolize --version unfortunately gives

-bash: libtoolize: command not found

i try running (again)

sudo port install libtool

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

i try

locate libtool

and it seems to be installed fine

/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

how do i get libtoolize to work?

TallTed
  • 9,069
  • 2
  • 22
  • 37
tzl
  • 1,540
  • 2
  • 20
  • 31

4 Answers4

42

You typically need to use glibtool and glibtoolize, since libtool already exists on OS X as a binary tool for creating Mach-O dynamic libraries. So, that's how MacPorts installs it, using a program name transform, though the port itself is still named 'libtool'.

Some autogen.sh scripts (or their equivalent) will honor the LIBTOOL / LIBTOOLIZE environment variables. I have a line in my own autogen.sh scripts:

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

You may or may not want the --copy flag.


Note: If you've installed the autotools using MacPorts, a correctly written configure.ac with Makefile.am files should only require autoreconf -fvi. It should call glibtoolize, etc., as expected. Otherwise, some packages will distribute an autogen.sh or similar script.

Brett Hale
  • 21,653
  • 2
  • 61
  • 90
  • where is autogen.sh located typically? – Erik Jan 15 '14 at 18:22
  • @Erik - usually in the top-level directory, and included in the distribution by adding `EXTRA_DIST = autogen.sh` in the top-level `Makefile.am`. Sometimes it has a name like `bootstrap.sh`. Often, developers are happy with the defaults provided by `autoreconf`. – Brett Hale Jan 30 '14 at 11:46
  • 3
    simply replacing `libtoolize` with `glibtoolize` worked for me – domoarigato Feb 14 '15 at 10:36
25

I hope my answer is not too naive. I am a noob to OSX.

brew install libtool solved a similar issue for me.

natersoz
  • 1,674
  • 2
  • 19
  • 29
  • 1
    The formula (for those who may not want to use Homebrew but wouldn't mind some pointers) is [here](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/libtool.rb) – ian Feb 18 '16 at 23:21
  • 4
    If you've installed other tools like `imagemagick` you may discover the brew caveat: `In order to prevent conflicts with Apple's own libtool we have prepended a "g" so, you have instead: ` **glibtool** `and` **glibtoolize** – pzrq Dec 10 '16 at 04:03
  • 1
    There's an issue when installing libtool with brew: you may get an error like "/usr/local/bin/glibtoolize: line 406: /usr/local/Library/ENV/4.3/sed: No such file or directory". The solution that worked for me was 'brew unlink libtool' (this may not be necessary) and then 'brew uninstall libtool && brew install libtool' (ebothmann's comment at https://github.com/Homebrew/legacy-homebrew/issues/43874). – Elise van Looij Jan 18 '18 at 08:38
18

To bring together a few threads libtoolize is installed as glibtoolize when you install libtool using brew. This can be achieved as follows; install it and then create a softlink for libtoolize:

brew install libtool
ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
Pierz
  • 7,064
  • 52
  • 59
0

An alternative to Brew is to use macports. For example:

$ 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

Then like Brew, you do:

$ 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.

Then you can check where it lives ... btw, you can soft-link glibtoolize to libtoolize. For my needs either was okay

$ which glibtoolize
/opt/local/bin/glibtoolize
ruoho ruotsi
  • 1,283
  • 14
  • 13