Gem install therubyracer -v 0.11.4 не работает на OS X 10.10
Следуя шагам здесь "gem install therubyracer -v '0.10.2'" на osx mavericks не устанавливаются, я смог получить therubyracer -v 0.10.2 и 0.12.0, чтобы установить штраф, но не 0.11.4.
gem install therubyracer -v 0.11.4
Возврат:
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/thooper/.rbenv/versions/2.1.2/bin/ruby -r ./siteconf20150102-7132-9ct9a4.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.9
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable]
static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers);
^
1 error generated.
make[1]: *** [/Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o] Error 1
make: *** [x64.release] Error 2
/Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
from /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `each'
from /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/ext/libv8/location.rb:35:in `verify_installation!'
from /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/ext/libv8/location.rb:26:in `install!'
from extconf.rb:7:in `<main>'
GYP_GENERATORS=make \
build/gyp/gyp --generator-output="out" build/all.gyp \
-Ibuild/standalone.gypi --depth=. \
-Dv8_target_arch=x64 \
-S.x64 -Dv8_can_use_vfp_instructions=true
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
CXX(target) /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
extconf failed, exit code 1
Gem files will remain installed in /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/libv8-3.11.8.17 for inspection.
Results logged to /Users/thooper/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/libv8-3.11.8.17/gem_make.out
Ответы
Ответ 1
Наконец-то я получил therubyracer 0.11.4 для установки и работы с использованием Xcode 6.1.1, 6.2 beta или 6.3 beta (я тестировал все 3), а также Xcode 4.6.3 (доступно по адресу: https://developer.apple.com/downloads/index.action), затем выполните:
# rename your current version of Xcode to make it distinguishable
sudo mv /Applications/Xcode.app /Applications/$(xcodebuild -version | head -1 | sed -e 's/ //').app
# Download and install Xcode 4.6.3 and run:
sudo mv /Applications/Xcode.app /Applications/Xcode4.6.3.app
# Switch to your 4.6.3 version of Xcode
sudo xcode-select --switch /Applications/Xcode4.6.3.app
# Install the version of libv8 that tied to your version of TRR:
gem install libv8 -v '3.11.8.17'
# Switch back to you original version of Xcode
sudo xcode-select --switch /Applications/Xcode6.x.app
# Install TRR
gem install therubyracer -v '0.11.4'
Ответ 2
Это именно та проблема, с которой я столкнулся, и решил ее с помощью homebrew-версий.
Проблема
У меня возникли проблемы с установкой gem libv8. Чтобы решить эту проблему, я установил v8 в свою систему через brew, а затем использовал опцию --with-system-v8
.
$ brew install v8
$ gem install libv8 -v '3.11.8.13' -- --with-system-v8
$ gem install therubyracer -v '0.11.4'
Gem libv8 установлен без проблем, однако последняя строка привела к ошибке из исходного вопроса. Затем я попробовал,
$ gem install therubyracer -v '0.11.4' -- --with-system-v8 --with-v8-dir=/usr/local/Cellar/v8/3.30.33.16
указывая его на v8, предоставленный brew. В этом случае ошибка изменилась, и теперь мне сказали, что я не предоставил версию v8, совместимую с 3.11.8.13
.
Для тех, кто отправляет сообщение об ошибке:
Building native extensions with: '--with-v8-dir=/usr/local/Cellar/v8/3.30.33.16/'
This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/zeigfreid/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb --with-v8-dir=/usr/local/Cellar/v8/3.30.33.16/
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/zeigfreid/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-pthreadlib
--without-pthreadlib
--with-objclib
--without-objclib
--enable-debug
--disable-debug
--with-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/Users/zeigfreid/.rvm/gems/[email protected]_rails_3.2.11/gems/libv8-3.11.8.13/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.11.8.13 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
from /Users/zeigfreid/.rvm/gems/[email protected]_rails_3.2.11/gems/libv8-3.11.8.13/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/zeigfreid/.rvm/gems/[email protected]_rails_3.2.11/gems/therubyracer-0.11.4 for inspection.
Results logged to /Users/zeigfreid/.rvm/gems/[email protected]_rails_3.2.11/extensions/x86_64-darwin-13/1.9.1/therubyracer-0.11.4/gem_make.out
Решение
Я решил попробовать установить более раннюю версию v8. Используя brew снова,
$ brew search v8
homebrew/versions/v8-315 v8
$ brew install v8-315
$ brew info v8-315
$ gem install therubyracer -v '0.11.4' -- --with-system-v8 --with-v8-dir=/usr/local/Cellar/v8-315/3.15.11
Это сработало. Версия v8 я закончил установку ~ 3.15, но это было совместимо с 3.11.8
Реальное решение здесь - обновить все до последней версии, и я не сторонник использования старых и устаревших драгоценных камней. Держите свою систему в чистоте и обновленной, даже если это больно!
Ответ 3
Эта строка появляется несколько раз в сообщении об ошибке:
It is recommended to use GCC v4.4 or higher
Ссылка на шаги, которые вы предприняли, означает запустить brew install apple-gcc42
, который предположительно устанавливает GCC 4.2. 4.2 меньше 4.4.
Конкретная ошибка, которую генерирует источник C, выглядит следующим образом:
../src/cached-powers.cc:136:18: error: unused variable 'kCachedPowersLength' [-Werror,-Wunused-const-variable]
Итак, если вы можете каким-то образом отредактировать makefile (или extconf.rb), чтобы удалить эти флаги, это также может работать. Однако я бы рекомендовал установить совместимый компилятор, потому что изменение флагов кажется немного взломанным.