libv8 and mac…

Always… when I setup new rails project with fresh ruby I encouter issues with gems…

$ gem install libv8 -v '3.16.14.11'
Building native extensions. This could take a while...
ERROR: Error installing libv8:
 ERROR: Failed to build gem native extension.

current directory: /Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/ext/libv8
/Volumes/Data/Users/rafath/.rvm/rubies/ruby-2.3.5/bin/ruby -r ./siteconf20171020-50539-1e46ksf.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.10
Using compiler: /usr/bin/c++ (clang version 9.0.0)
../src/bignum.cc:761:7: error: variable 'i' is incremented both in the loop header and in the loop body [-Werror,-Wfor-loop-analysis]
 ++i;
 ^
../src/bignum.cc:756:72: note: incremented here
 for (int i = other.used_digits_ + exponent_diff; i < used_digits_; ++i) {
 ^
1 error generated.
make[1]: *** [/Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o] Error 1
make: *** [x64.release] Error 2
/Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
 from /Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/ext/libv8/location.rb:35:in `each'
 from /Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/ext/libv8/location.rb:35:in `verify_installation!'
 from /Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/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_enable_backtrace=1 -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror=''
 CXX(target) /Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
 CXX(target) /Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
 CXX(target) /Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o

extconf failed, exit code 1

Gem files will remain installed in /Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/gems/libv8-3.16.14.11 for inspection.
Results logged to /Volumes/Data/Users/rafath/.rvm/gems/ruby-2.3.5/extensions/x86_64-darwin-17/2.3.0/libv8-3.16.14.11/gem_make.out

So if you have already needed libs – you can do this

gem install libv8 -v '3.16.14.11' -- --with-system-v8

and than try again bundle install.

 

—– edit —– 21.03.2019…. What I hate in this job…. changes, that you don’t understand wtf….

in mojaveI had problem with installing therubyraces version 0.12.3..

gem uninstall libv8 -a -x
gem install libv8 -v '3.16.14.15' -- --with-system-v8
gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8@3.15/

——- edit —- 23.10.2019… another challenges with therubyracer…

brew tap homebrew/versions
brew install v8-315

brew unlink v8 
brew link --overwrite v8@3.15

gem install libv8 -v '3.16.14.15' -- --with-system-v8
and than: 
install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8@3.15 
bundle install

Rafath Khan

Tu powinien być pean na moją cześć, jaki to wspaniały jestem i jakimi niezwykłymi problemami się zajmuję, ale prawda jest taka, że jak każdy człowiek - mam swoje wady i może jakieś zalety. Są momenty, kiedy mam odpowiednią ilość zasobów psychoenergetycznych i mogę przenosić góry, a są niestety i takie momenty, kiedy mi się nawet z łóżka wstać nie chce... nie może tak źle nie jest, ale chętnie bym sobie pospał dłużej... Niemniej jednak, gdy uda się pokonać siebie - satysfakcja jest, ale potem przychodzą kolejne rzeczy, z którymi trzeba się zmierzyć... a na nie, niestety, energii może nie starczyć i tu właśnie wkracza tzw samodyscyplina - powinieneś usiąść i zrobić to coś, a nie siedzieć na kanapie i zajadać się słodyczami i oglądać jakiś nieciekawy serial czy film dla spalenia swojej najważniejszej waluty świata... czasu, którego nie da się odzyskać. I właśnie o tej samodyscyplinie traktować będę na tym blogu + kilka innych tematów, które są mi potrzebne do pracy

Może Ci się również spodoba