BeagleBone BlackにNode.jsをインストールする2(セルフビルド)

前回のおさらい

見事にビルドに失敗・・・ググってみたら、傘のお肉はどこにあるの?知り合いの@iwata_nのブログに引っ掛かったw

つまりは

./configure --without-snapshot

が必要ということなので、nodebrewのソースを修正して対応します。

nodebrew本体のコード(~./nodebrew/nodebrew)の「sub _cmd_install」にあるConfigureに--without-snapshotを追加します

system qq[
    cd "$src_dir/$target_name" &&
    ./configure --without-snapshot --prefix="$self->{node_dir}/$version" &&
    make &&
    make install
];

これでもう一度インストールしてみます。一旦さっきのバージョンをuninstallしておいてから再度インストール。

ubuntu@ubuntu-armhf:~$ nodebrew uninstall v0.10.21
v0.10.21 uninstalled
ubuntu@ubuntu-armhf:~$ nodebrew ls
not installed

current: none
ubuntu@ubuntu-armhf:~$ nodebrew install v0.10.21
fetch: http://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz
######################################################################## 100.0%
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'arm_fpu': 'vfpv3',
                 'arm_neon': 0,
                 'armv7': 1,
                 'clang': 0,
                 'gcc_version': 46,
                 'host_arch': 'arm',
                 'node_install_npm': 'true',
                 'node_prefix': '/home/ubuntu/.nodebrew/node/v0.10.21',
                 'node_shared_cares': 'false',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_unsafe_optimizations': 0,
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'node_use_systemtap': 'false',
                 'python': '/usr/bin/python',
                 'target_arch': 'arm',
                 'v8_enable_gdbjit': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_use_arm_eabi_hardfloat': 'true',
                 'v8_use_snapshot': 'false'}}

「'v8_use_snapshot': 'false'」になっています。失敗した時のログを見てみると

fetch: http://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz
######################################################################## 100.0%
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'arm_fpu': 'vfpv3',
                 'arm_neon': 0,
                 'armv7': 1,
                 'clang': 0,
                 'gcc_version': 46,
                 'host_arch': 'arm',
                 'node_install_npm': 'true',
                 'node_prefix': '/home/ubuntu/.nodebrew/node/v0.10.21',
                 'node_shared_cares': 'false',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_unsafe_optimizations': 0,
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'node_use_systemtap': 'false',
                 'python': '/usr/bin/python',
                 'target_arch': 'arm',
                 'v8_enable_gdbjit': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_use_arm_eabi_hardfloat': 'true',
                 'v8_use_snapshot': 'true'}}

こちらはtrueになっていました。

さてまたしても1時間経過・・・ビルド完了

symlinking ../lib/node_modules/npm/bin/npm-cli.js -> /home/ubuntu/.nodebrew/node/v0.10.21/bin/npm
updating shebang of /home/ubuntu/.nodebrew/node/v0.10.21/bin/npm to /home/ubuntu/.nodebrew/node/v0.10.21/bin/node
ubuntu@ubuntu-armhf:~$ nodebrew ls
v0.10.21

current: none
ubuntu@ubuntu-armhf:~$ nodebrew use v0.10.21
use v0.10.21
ubuntu@ubuntu-armhf:~$ node
>

というわけで、無事Node.jsが起動できるようになりました。