如何安装 libv8 gem?我无法安装 libv8 gem。当我尝试时,我收到以下错误。
$ gem install libv8
Building native extensions. This could take a while...
ERROR: Error installing libv8:
ERROR: Failed to build gem native extension.
/usr/bin/ruby.exe extconf.rb
creating Makefile
Using compiler: /usr/bin/g++
which: no gmake in (/usr/local/bin:/usr/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/system32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft SQL Server/100/Tools/Binn/VSShell/Common7/IDE:/cygdrive/c/Program Files/Microsoft SQL Server/100/Tools/Binn:/cygdrive/c/Program Files/Microsoft SQL Server/100/DTS/Binn:/cygdrive/c/Program Files/Heroku/bin:/cygdrive/c/Program Files/ruby-1.9.2/bin:/cygdrive/c/Program Files/git/bin:/cygdrive/c/Program Files/git/cmd:/cygdrive/c/Program Files/DTN/IQFeed:/cygdrive/c/Program Files/OpenVPN/bin:/cygdrive/c/Program Files/Java/apache-ant-1.8.3/bin:/usr/lib/lapack:/cygdrive/c/Program Files/Notepad++:.:/cygdrive/c/Program Files/Java/android-sdk/platform-tools/:/cygdrive/c/Program Files/Java/android-sdk/tools/:/cygdrive/c/Program Files/Java/jdk1.7.0_03/bin)
In file included from ../src/conversions-inl.h:42:0,
from ../src/conversions.cc:32:
../src/platform.h:77:12: error: new declaration ‘int random()’
/usr/include/cygwin/stdlib.h:29:6: error: ambiguates old declaration ‘long int random()’
make[1]: *** [/usr/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.13/vendor/v8/out/ia32.release/obj.target/preparser_lib/src/conversions.o] Error 1
我试着用
$ gem install libv8 --pre
Fetching: libv8-3.5.10.beta1.gem (100%)
Building native extensions. This could take a while...
Successfully installed libv8-3.5.10.beta1
1 gem installed
但bundle install
还是不会跑。它仍然尝试安装版本 3.11.8.13。
Installing libv8 (3.11.8.13) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
libv8 gem 不在我的 Gemfile 中。我不知道如何找出试图使用它的东西,但是在搜索时我看到 rubyracer 使用 libv8,我确实有
group :assets do
gem 'therubyracer', :platform => :ruby
我什至尝试编辑/usr/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.13/src/platform.h
文件并注释掉第 77 行:
//int random();
但是当我运行时gem install libv8
,它覆盖了我的更改并且仍然给出了错误。我在 中看到了一个技巧gem install libv8 --help
,所以我再次编辑了文件并注释掉了第 77 行,并尝试了
cd /usr/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.13/vendor/v8
make
但是,这只是给出了不同的错误:
In file included from /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/winsock2.h:56:0,
from ../src/win32-headers.h:77,
from ../src/platform-win32.cc:31:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/psdk_inc/_fd_types.h:100:2: warning: #warning "fd_set and associated macros have been defined in sys/types. This can cause runtime problems with W32 sockets"
In file included from ../src/win32-headers.h:80:0,
from ../src/platform-win32.cc:31:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/wspiapi.h:26:41: error: expected ‘>’ before numeric constant
../src/platform-win32.cc: In function ‘int random()’:
../src/platform-win32.cc:122:12: error: new declaration ‘int random()’
/usr/include/cygwin/stdlib.h:29:6: error: ambiguates old declaration ‘long int random()’