MacにGNUMP3dを入れようとしたらMacPortsのperl5が邪魔する件について
GNUMP3d [GNU MP3/Media Streamer] - About GNUMP3d - GNU Project - Free Software Foundation(FSF)
をMacに入れようとしたら、MacPortsのperl5が邪魔で失敗しました。
環境
Mac | Mac OS X Leopard 10.5.8 |
GNUMP3d | gnump3d-3.0.tar.gz |
MacPorts perl | This is perl, v5.8.9 built for darwin-2level |
インストールして失敗するまでの流れ
$ cd /usr/local $ sudo mkdir src Password:
自分の /usr/local は root:wheel 所有*1なので何をするにも sudo が必要です。
$ cd src $ sudo curl -LO http://savannah.gnu.org/download/gnump3d/gnump3d-3.0.tar.gz $ sudo tar xzfvo gnump3d-3.0.tar.gz $ cd gnump3d-3.0
tarコマンドはrootで実行すると、自動的に --same-owner 付きの動作をします。
それは嫌なので -o*2 を指定してます。
GNUMP3dはperlで出来てて、インストールは簡単です。
ソースコードをダウンロードして、解凍して make install すれば /usr/bin/ に実行ファイルが、/etc/gnump3d/に設定ファイルが入ったりして出来上がりのはずです。
が・・・
$ sudo make install install -d //etc/gnump3d install -d //usr/bin install -d //usr/share/gnump3d install -d //usr/local/man/man1 install -d /`perl bin/getlibdir`/gnump3d/plugins Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. install -d /`perl bin/getlibdir`/gnump3d/lang Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. install -d //var/log/gnump3d install -d //var/cache/gnump3d chmod 777 //var/cache/gnump3d install -d //var/cache/gnump3d/serving chmod 777 //var/cache/gnump3d/serving chmod a+rx /`perl bin/getlibdir`/gnump3d/ Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. chmod a+rx /`perl bin/getlibdir`/gnump3d/plugins Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. chmod a+rx /`perl bin/getlibdir`/gnump3d/lang Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. cp lib/gnump3d/*.pm /`perl bin/getlibdir`/gnump3d Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. cp lib/gnump3d/plugins/*.pm /`perl bin/getlibdir`/gnump3d/plugins Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. rm /`perl bin/getlibdir`/gnump3d/plugins/bug.pm Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. rm: //gnump3d/plugins/bug.pm: No such file or directory make: [install] Error 1 (ignored) cp lib/gnump3d/lang/*.pm /`perl bin/getlibdir`/gnump3d/lang Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. cp bin/gnump3d2 //usr/bin chmod 755 //usr/bin/gnump3d2 ln -sf //usr/bin/gnump3d2 //usr/bin/gnump3d cp bin/gnump3d-top //usr/bin chmod 755 //usr/bin/gnump3d-top cp bin/gnump3d-index //usr/bin chmod 755 //usr/bin/gnump3d-index cp man/gnump3d-top.1 //usr/local/man/man1 cp man/gnump3d-index.1 //usr/local/man/man1 cp man/gnump3d.1 //usr/local/man/man1 cp man/gnump3d.conf.1 //usr/local/man/man1 cp -R templates/* //usr/share/gnump3d chmod -R a+r //usr/share/gnump3d chmod +rx //usr/share/gnump3d/*/ if [ -e //etc/gnump3d/gnump3d.conf ]; then cp //etc/gnump3d/gnump3d.conf //etc/gnump3d/gnump3d.conf-orig ; fi sed "s#PLUGINDIR#`perl bin/getlibdir`#g" etc/gnump3d.conf > //etc/gnump3d/gnump3d.conf Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. cp etc/mime.types //etc/gnump3d cp etc/file.types //etc/gnump3d rm -f /`perl bin/getlibdir`/gnump3d/FreezeThaw.pm Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. rm -f /`perl bin/getlibdir`/gnump3d/playlist.pm Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67.
Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63.
Use of uninitialized value in print at bin/getlibdir line 67.
make install してみると、何度もこのエラーメッセージが出てきます。
$ sudo gnump3d Can't locate gnump3d/config.pm in @INC (@INC contains: /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at /usr/bin/gnump3d line 73. BEGIN failed--compilation aborted at /usr/bin/gnump3d line 73.
試しに起動してみても、エラーで起動しません。
$ ls /gnump3d/ IP.pm WMA.pm files.pm mp3info.pm plugins tagcache.pm MD5.pm base64.pm filetypes.pm mp4info.pm readtags.pm url.pm Request.pm config.pm lang ogginfo.pm sorting.pm
なぜか /gnump3d/*3 というディレクトリが出来てしまっています。
$ sudo make uninstall rm -f /usr/bin/gnump3d-top rm -f /usr/bin/gnump3d-index rm -f /usr/bin/gnump3d2 rm -f /usr/bin/gnump3d rm -f /usr/local/man/man1/gnump3d-top.1 rm -f /usr/local/man/man1/gnump3d-index.1 rm -f /usr/local/man/man1/gnump3d.1 rm -f /usr/local/man/man1/gnump3d.conf.1 rm -rf `perl bin/getlibdir`/gnump3d/ Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. rm -rf /usr/share/gnump3d rm -f /etc/gnump3d/gnump3d.conf rm -rf /etc/gnump3d rm -rf /var/log/gnump3d rm -rf /var/cache/gnump3d rm -rf /var/cache/gnump3d/serving
失敗なのでとりあえずアンインストール。
同じエラーメッセージが出てます。
原因
$ pwd /usr/local/src/gnump3d-3.0 $ less bin/getlibdir #!/usr/bin/perl -w # # getlibdir - Determine an appropriate library directory. # # GNU MP3D - A portable(ish) MP3 server.
省略
use strict; # # Only examine directories beneath /usr or /Library # (The latter is for Mac OS X). # my @dirs = grep( /^\/usr|^\/Library/, @INC ); # # we prefer /share/ to /lib/ since this is arch-indep # if ( grep(m|/share/|, @dirs) ) { @dirs = grep(m|/share/|, @dirs); } # # Find the shortest one. # @dirs = sort { length( $a ) <=> length( $ b ) } @dirs ; # # Print it out - stripping the trailing '/' if present # if ( $dirs[0] =~ /(.*)\/$/ ) { $dirs[0] = $1; } print $dirs[0];
bin/getlibdir を見てみると、perlスクリプトである事が分かります。
$ pwd /usr/local/src/gnump3d-3.0 $ less Makefile # # Installation Directories. # BINDIR = /usr/bin TEMPDIR = /usr/share/gnump3d CONFDIR = /etc/gnump3d CACHEDIR = /var/cache/gnump3d SERVEDIR = /var/cache/gnump3d/serving MANDIR = /usr/local/man/man1 LOGDIR = /var/log/gnump3d LIBDIR = `perl bin/getlibdir` PLUGDIR = $(LIBDIR)/gnump3d/plugins LANGDIR = $(LIBDIR)/gnump3d/lang
bin/getlibdir は Makefile の26行目で使われてLIBDIRに値を入れてます。
$ which perl /opt/local/bin/perl $ perl --version This is perl, v5.8.9 built for darwin-2level $ /usr/bin/perl --version This is perl, v5.8.8 built for darwin-thread-multi-2level (with 4 registered patches, see perl -V for more detail) $ perl bin/getlibdir Use of uninitialized value in pattern match (m//) at bin/getlibdir line 63. Use of uninitialized value in print at bin/getlibdir line 67. $ /usr/bin/perl bin/getlibdir /Library/Perl $ port info perl5 perl5 @5.8.9 (lang) Variants: perl5_10, perl5_12 Description: Wrapper port for perl 5.x Homepage: http://www.perl.org/ Library Dependencies: perl5.8 Platforms: darwin, freebsd, linux License: unknown Maintainers: ricci@macports.org, mcalhoun@macports.org
自分の環境では、MacPorts で入れた perl5 にパスが通ってます。
どういうわけか、MacPortsの perl だと bin/getlibdir がちゃんと動かないようです。
bin/getlibdir がちゃんと動けば、LIBDIR = /Library/Perl になるんですね。
解決策
$ pwd /usr/local/src/gnump3d-3.0 $ sudo cp Makefile Makefile.before $ sudo vi Makefile $ diff -u Makefile.before Makefile --- Makefile.before 2010-06-18 23:25:31.000000000 +0900 +++ Makefile 2010-06-18 23:25:47.000000000 +0900 @@ -23,7 +23,7 @@ SERVEDIR = /var/cache/gnump3d/serving MANDIR = /usr/local/man/man1 LOGDIR = /var/log/gnump3d -LIBDIR = `perl bin/getlibdir` +LIBDIR = `/usr/bin/perl bin/getlibdir` PLUGDIR = $(LIBDIR)/gnump3d/plugins LANGDIR = $(LIBDIR)/gnump3d/lang $ sudo rm Makefile.before $ sudo make install $ ls /Library/Perl/gnump3d/ IP.pm WMA.pm files.pm mp3info.pm plugins tagcache.pm MD5.pm base64.pm filetypes.pm mp4info.pm readtags.pm url.pm Request.pm config.pm lang ogginfo.pm sorting.pm
これでちゃんとインストールが出来ました。
/gnump3d/ に出来ちゃってたディレクトリも、ちゃんと /Library/Perl/gnump3d/ に出来てます。
やっぱり MacPorts の /opt/local/bin を /usr/bin より優先するのはだめなんだろうか・・・。
しかし、無駄に長いなこのエントリー。