LoginSignup
2
2

More than 5 years have passed since last update.

FreeBSDにnode.jsをtarballからインストール

Posted at

執筆時点(2015/07/29)での最新バージョン0.12.7をインストール
Python2.7はインストール済み

% tar xfvz node-v0.12.7.tar.gz
% cd node-v0.12.7
% ./configure
% gmake

一部ソースを修正しないと途中でコンパイルエラーが発生する。
https://github.com/joyent/node/issues/9175

deps/v8/src/base/platform/platform-freebsd.cc
--- deps/v8/src/base/platform/platform-freebsd.cc.bak   2015-07-10 07:41:19.000000000 +0900
+++ deps/v8/src/base/platform/platform-freebsd.cc       2015-07-29 12:10:41.000000000 +0900
@@ -122,10 +122,10 @@


 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
-  std::vector<SharedLibraryAddress> result;
+  std::vector<SharedLibraryAddress> address_result;
   static const int MAP_LENGTH = 1024;
   int fd = open("/proc/self/maps", O_RDONLY);
-  if (fd < 0) return result;
+  if (fd < 0) return address_result;
   while (true) {
     char addr_buffer[11];
     addr_buffer[0] = '0';
@@ -156,10 +156,10 @@
     // There may be no filename in this line.  Skip to next.
     if (start_of_path == NULL) continue;
     buffer[bytes_read] = 0;
-    result.push_back(SharedLibraryAddress(start_of_path, start, end));
+    address_result.push_back(SharedLibraryAddress(start_of_path, start, end));
   }
   close(fd);
-  return result;
+  return address_result;
 }
deps/v8/src/base/platform/platform-posix.cc
--- deps/v8/src/base/platform/platform-posix.cc.bak     2015-07-10 07:41:19.000000000 +0900
+++ deps/v8/src/base/platform/platform-posix.cc 2015-07-29 12:12:22.000000000 +0900
@@ -327,7 +327,7 @@
 #elif V8_OS_ANDROID
   return static_cast<int>(gettid());
 #else
-  return static_cast<int>(pthread_self());
+  return static_cast<int> ((int64_t) (void *) pthread_self());
 #endif
 }

ソースを修正後、インストールして完了

% gmake
% sudo gmake install
% node
> console.log('hoge');
hoge
undefined
> .exit
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2