2011年10月18日火曜日

MacPorts vs. Xcode 4.2

As all whom upgrade Xcode on Lion to version 4.2 suffered a devastating problem, the dramatical change of new Xcode 4.2 is not compatible with past-installed MacPorts binary.

If you meet the problem of MacPorts in configuring, or building, then please try

port upgrade --force installed

first before "port selfupdate".

This command let the MacPorts recompile everything already installed in your Mac.

You may remember when you upgraded your OS to Lion, the MacPorts recompile everything with Xcode 4.1.  This is the same as that time because the compiler configurations are dramatically changed between Xcode 4.1 and 4.2.

Then, you may do "port selfupdate && port upgrade outdated".  Everything must be OK.

----Japanese below:

MacPorts利用者で、Lion 10.7.2とともにXcode 4.2に変更した方は、MacPortsが奇妙な挙動をするのにお困りと思います。

  • upgradeの際、configureが文句を言う
  • 新たにinstallするものがコンパイルできない
  • その他

これは、Xcode 4.2で標準コンパイラが完全にLLVMに移行したことによるものです。

既存のバイナリはXcode 4.2でコンパイルしたバイナリとの互換性がないので、上記のようないろいろなトラブルが発生します。

そこで、まず最初にすべてをリコンパイルしましょう。これは、Snow LeopardからLionにアップグレードしたときに、Xcode 4.1がMacPortsのバイナリをリコンパイルしてくれたのと同じです。

コマンドは、
port upgrade --force installed
です。selfupdateしてしまった人は、outdateなものをいったんuninstallする必要があります。

いったんすべてリコンパイルすれば、問題は解消するはずです。