MacPorts
ライブラリはパッケージマネージャ使った方が管理もアップデートも楽でいい。
という理由でDarwinPortsを使いはじめ、今ではMacPortsを使っているのだが、先週末から以下のようなエラーが発生してリポジトリの更新ができなくなってしまった。
port -d sync DEBUG:Synchronizing ports tree(s) Synchronizing local ports tree from rsync:/rsync.macports.org/release/ports/ DEBUG:/usr/bin/rsync -rtzv --delete-after rsync:/rsync.macports.org/release/ports/ /opt/local/var/macports/sources/rsync.macports.org/release/ports dyld:lazy symbol binding failed:Symbol not found:_locale_charset Referenced from:/usr/bin/rsync Expected in:/opt/local/lib/libiconv.2.dylib dyld:Symbol not found:_locale_charset Referenced from:/usr/bin/rsync Expected in:/opt/local/lib/libiconv.2.dylib DEBUG:Synchronization the local ports tree failed doing rsync while executing "mportsync" port sync failed:Synchronization the local ports tree failed doing rsync
週末にでも処理しようと思っていたのだが、すっかり忘れていた。
文字コード関連の処理で転けているのか、macports入れたlibiconvとrsyncが問題を起こしているようだ。細かく調べたいところだが、今は別の部分に力を注ぎたいため、/optごと削除し、再度MacPortsのインストールを試みる。
#port installed //現在インストールされているパッケージの情報を取得 #find /Library/LaunchDaemons/org.macports.* -print0 //MacPortsで導入されたデーモンがあるかを確認 #find /Library/LaunchDaemons/org.macports.* -print0 | sudo xargs -0 -L1 launchctl unload -w //あった場合はそれを停止 #port deactivate active //アクティブなパッケージを非アクティブに #rm -rf /opt //パッケージマネージャでインストールしたもの全削除
http://www.macports.org/から最新のdisk imageを取得しインストール。
# port selfupdate MacPorts base version 1.600 installed Downloaded MacPorts base version 1.600 The MacPorts installation is not outdated and so was not updated selfupdate done!
無事に復活した。
その後、問題のパッケージlibiconv @1.12_0をインストールしてみる。
インストール完了。selfupdateを試みる。
結果、失敗。
調べてみるとrsyncのバージョンが2.6.9と少し古い。コンパイルオプションも不明であるため、rsyncとiconvのバージョンの関係で何らかの問題が起きているのかもしれない。
macportでrsyncを探してみるとバージョン3.0.3がある。たしか2.xと3.xはかなりCPU使用率が違うという話を聞いたので、インストールし、乗り換えてみる事にする。
#port install rsync
無事にインストールが終わり、selfupdateを実行するが、結果はかわらない。
whereで確認するとパスは通っており、デフォルトの/usr/bin/rsyncより上に来ている。
/opt/local/etcや/opt/local/shareのファイルを見ても、rsyncのパスが見当たらなかったため、もしかしたら/usr/bin/rsyncを使うようハードコードされているのではないだろうか。
そんな事を考えながら、findで/opt/local全体を検索してみる。/usr/bin/rsyncを検索すれば、どこかの階層に設定ファイルがあるかもしれない。
#find /opt/local -exec grep "/usr/bin/rsync" '{}' /dev/null \; -print
しばらく待つ・・・。
見つけた!
が、sourcesの中ってことは結局ハードコードされているんじゃないか?
コンパイルし直すより、/usr/bin直下のrsyncをリネームし、/opt/local/binのrsyncのリンボリックリンクを張ったほうが現実的だろう。
これで問題が起こったら、コンパイルするとしよう。
# mv /usr/bin/rsync /usr/bin/_rsync # ln -s /opt/local/bin/rsync /usr/bin