• このエントリーをはてなブックマークに追加

恥ずかしながら,これまでこういうことをしたことがなかったのでメモ.

Linux で,あるコマンドがどのライブラリに依存しているかを確認するには, ldd コマンドを使うとよいみたい.Mac OSX では otool というのがその役目を果たすみたい.

ldd コマンド:

% ldd ~/local/bin/convert
	linux-vdso.so.1 =>  (0x00007fff83ec3000)
	libMagickCore.so.5 => /home/www/local/lib/libMagickCore.so.5 (0x00007fd46c9b0000)
	libMagickWand.so.5 => /home/www/local/lib/libMagickWand.so.5 (0x00007fd46c6c0000)
	libtiff.so.4 => /usr/lib/libtiff.so.4 (0x00007fd46c456000)
	libc.so.6 => /lib/libc.so.6 (0x00007fd46c0d3000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007fd46be4d000)
	libjpeg.so.62 => /home/www/local/lib/libjpeg.so.62 (0x00007fd46bbeb000)
	libgs.so.8 => /usr/lib/libgs.so.8 (0x00007fd46b02a000)
	libpng12.so.0 => /lib/libpng12.so.0 (0x00007fd46ae03000)
	libfftw3.so.3 => /usr/lib/libfftw3.so.3 (0x00007fd46ab07000)
	libz.so.1 => /lib/libz.so.1 (0x00007fd46a8f0000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007fd46a6d3000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007fd46a4ce000)
	libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007fd46a2c0000)
	libm.so.6 => /lib/libm.so.6 (0x00007fd46a03d000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd46cf44000)
	libpaper.so.1 => /usr/lib/libpaper.so.1 (0x00007fd469e38000)
	libcupsimage.so.2 => /usr/lib/libcupsimage.so.2 (0x00007fd469c1f000)
	libcups.so.2 => /usr/lib/libcups.so.2 (0x00007fd4699d3000)
	libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007fd46979e000)
	libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0x00007fd4694fc000)
	libcrypt.so.1 => /lib/libcrypt.so.1 (0x00007fd4692c3000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fd468fae000)
	libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007fd468d79000)
	librt.so.1 => /lib/librt.so.1 (0x00007fd468b70000)
	libavahi-common.so.3 => /usr/lib/libavahi-common.so.3 (0x00007fd468963000)
	libavahi-client.so.3 => /usr/lib/libavahi-client.so.3 (0x00007fd468752000)
	libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007fd46848d000)
	libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007fd468267000)
	libcom_err.so.2 => /lib/libcom_err.so.2 (0x00007fd468063000)
	libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007fd467e5a000)
	libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00007fd467c57000)
	libresolv.so.2 => /lib/libresolv.so.2 (0x00007fd467a3e000)
	libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0x00007fd46782c000)
	libgcrypt.so.11 => /lib/libgcrypt.so.11 (0x00007fd4675b4000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fd46739d000)
	libexpat.so.1 => /lib/libexpat.so.1 (0x00007fd467173000)
	libdbus-1.so.3 => /lib/libdbus-1.so.3 (0x00007fd466f34000)
	libgpg-error.so.0 => /lib/libgpg-error.so.0 (0x00007fd466d2f000)

otool コマンド:

% otool -L ~/local/bin/convert
/Users/issm/local/bin/convert:
	/Users/issm/local/lib/libMagickCore.5.dylib (compatibility version 6.0.0, current version 6.0.0)
	/Users/issm/local/lib/libMagickWand.5.dylib (compatibility version 6.0.0, current version 6.0.0)
	/usr/local/lib/liblcms2.2.dylib (compatibility version 3.0.0, current version 3.3.0)
	/usr/local/lib/libtiff.5.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/local/opt/freetype/lib/libfreetype.6.dylib (compatibility version 16.0.0, current version 16.0.0)
	/usr/local/lib/libjasper.1.0.0.dylib (compatibility version 2.0.0, current version 2.0.0)
	/usr/local/opt/jpeg-turbo/lib/libjpeg.62.0.0.dylib (compatibility version 63.0.0, current version 63.0.0)
	/usr/local/opt/libpng/lib/libpng15.15.dylib (compatibility version 29.0.0, current version 29.0.0)
	/usr/local/lib/liblzma.5.dylib (compatibility version 6.0.0, current version 6.4.0)
	/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
	/usr/lib/libltdl.7.dylib (compatibility version 10.0.0, current version 10.2.0)

参考: