Portsでnodejsを導入してみた。

portsでの導入時、エラーが発生してしまう(ビルドフェーズで失敗)。

$ sudo port install nodejs
:info:build make: *** [all] Error 1
:info:build shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_nodejs/work/node-v0.2.6" && /usr/bin/make all " returned error 2
:error:build Target org.macports.build returned: shell command failed (see log for details)
:debug:build Backtrace: shell command failed (see log for details)

少し調べてみると、回避方法が見つかった。

If the c-ares port is installed but is of a different version than c-ares bundled with nodejs, differences in the header files can cause build errors. A work-around is to upgrade the c-ares port to the latest version.
#28066 (nodejs: Headers from the c-ares port conflict with the bundled c-ares headers) – MacPorts

そんじゃあ早速パッケージをインストール。

$ sudo port install c-ares
--->  Fetching c-ares
--->  Attempting to fetch c-ares-1.7.4.tar.gz from http://distfiles.macports.org/c-ares
--->  Verifying checksum(s) for c-ares
--->  Extracting c-ares
--->  Configuring c-ares
--->  Building c-ares
--->  Staging c-ares into destroot
--->  Installing c-ares @1.7.4_0
--->  Deactivating c-ares @1.7.1_0
--->  Activating c-ares @1.7.4_0
--->  Cleaning c-ares
$ sudo port install nodejs
--->  Computing dependencies for nodejs
--->  Building nodejs
--->  Staging nodejs into destroot
--->  Installing nodejs @0.2.6_0+ssl
--->  Activating nodejs @0.2.6_0+ssl
--->  Cleaning nodejs

とりあえず、ビルドエラーは無くなった。