Issue upgrading application to rails 4.2.1 with libv8 & devise & therubyracer - ruby-on-rails

My application was working all fine with the following gemfile:
source 'https://rubygems.org'
#ruby version
ruby "2.1.5"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.10'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
#add bootstrap css
gem "twitter-bootstrap-rails"
gem "therubyracer"
gem "less-rails"
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
#Add paperclip for image uploading - requires imagemagick - need rmagick for heroku?
gem "paperclip", :git => "git://github.com/thoughtbot/paperclip.git"
gem 'rmagick'
#aws-sdk for s3 capability production only
gem 'aws-sdk', group: :production
gem "rake", '10.4.2'
#Adding geoip for our lookup location services
gem 'geoip', '~> 1.4.0'
#Adding a exception notifier for debugging on heroku
gem 'exception_notification'
#annotate model game so models get details of the database contents added as comments to the top of their files
gem 'annotate', '~> 2.6.5'
#for oauth authentication with Stripe api
gem 'omniauth-stripe-connect'
#for stripe checkout
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
#for user management
gem 'devise'
#for devise facebook omni auth
gem 'omniauth-facebook'
#for storing my custom settings
gem 'rails_config'
#HTTParty for easily consuming external web services in the ruby app - used for GDistance class in services
gem 'httparty'
#i need the latest version of fontawesome - the one in bootstrap is too old!
gem "font-awesome-rails"
#google analytics - for production only
gem 'rack-google_analytics', group: :production
#ahoy is for on site analytics - trying it out
gem 'ahoy_matey'
#using socialization gem for user follows
gem 'socialization'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
I want to update my application to use Rails 4.2.1, so I update this line in my gemfile:
gem 'rails', '4.2.1'
When I then run bundle update I get the following error:
Using less 2.6.0
Using less-rails 2.7.0 (was 2.6.0)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/andyarmstrong/.rbenv/versions/2.1.5/bin/ruby -r ./siteconf20150701-17291-17o68o1.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.6
Using compiler: /usr/bin/c++ (clang version 6.1.0)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o has no symbols
In file included from ../src/accessors.cc:28:
In file included from ../src/v8.h:60:
In file included from ../src/objects-inl.h:38:
In file included from ../src/elements.h:33:
In file included from ../src/heap.h:35:
In file included from ../src/incremental-marking.h:33:
In file included from ../src/mark-compact.h:32:
../src/spaces.h:896:26: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to true [-Werror,-Wtautological-undefined-compare]
bool exists() { return this != NULL && code_range_ != NULL; }
^~~~ ~~~~
../src/spaces.h:898:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
if (this == NULL || code_range_ == NULL) return false;
^~~~ ~~~~
2 errors generated.
make[1]: *** [/Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o] Error 1
make: *** [x64.release] Error 2
/Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/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/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/ext/libv8/location.rb:35:in `each'
from /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/ext/libv8/location.rb:35:in `verify_installation!'
from /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/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) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o
LIBTOOL-STATIC /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/libpreparser_lib.a
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser/preparser/preparser-process.o
LINK(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/preparser
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o
extconf failed, exit code 1
Gem files will remain installed in /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8 for inspection.
Results logged to /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/libv8-3.16.14.8/gem_make.out
An error occurred while installing libv8 (3.16.14.8), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.8'` succeeds before bundling.
So I then try the command the error suggests:
gem install libv8 -v '3.16.14.8'
This command fails with this error:
Andys-MacBook-Pro:andyhelloworldruby andyarmstrong$ gem install libv8 -v '3.16.14.8'
Building native extensions. This could take a while...
ERROR: Error installing libv8:
ERROR: Failed to build gem native extension.
/Users/andyarmstrong/.rbenv/versions/2.1.5/bin/ruby -r ./siteconf20150701-18322-ri2u8p.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.6
Using compiler: /usr/bin/c++ (clang version 6.1.0)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o has no symbols
In file included from ../src/accessors.cc:28:
In file included from ../src/v8.h:60:
In file included from ../src/objects-inl.h:38:
In file included from ../src/elements.h:33:
In file included from ../src/heap.h:35:
In file included from ../src/incremental-marking.h:33:
In file included from ../src/mark-compact.h:32:
../src/spaces.h:896:26: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to true [-Werror,-Wtautological-undefined-compare]
bool exists() { return this != NULL && code_range_ != NULL; }
^~~~ ~~~~
../src/spaces.h:898:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
if (this == NULL || code_range_ == NULL) return false;
^~~~ ~~~~
2 errors generated.
make[1]: *** [/Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o] Error 1
make: *** [x64.release] Error 2
/Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '/Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/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/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/ext/libv8/location.rb:35:in `each'
from /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/ext/libv8/location.rb:35:in `verify_installation!'
from /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/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) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/diy-fp.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/dtoa.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fast-dtoa.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/fixed-dtoa.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/once.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparse-data.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/preparser-api.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/scanner.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/strtod.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/token.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/unicode.o
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser_lib/src/utils.o
LIBTOOL-STATIC /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/libpreparser_lib.a
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/preparser/preparser/preparser-process.o
LINK(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/preparser
CXX(target) /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o
extconf failed, exit code 1
Gem files will remain installed in /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/libv8-3.16.14.8 for inspection.
Results logged to /Users/andyarmstrong/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/libv8-3.16.14.8/gem_make.out
Doing some searching I tried the following command:
gem install libv8 -v '3.16.14.8' -- --with-system-v8 - which succeeds, but then when I try bundle update again, therubyracer fails to resolve v8 as I don't think the system has a v8 installed.
How can I resolve this libv8 issue?

The problem was because of a problem in the libv8 source : https://github.com/cowboyd/libv8/issues/174
It was fixed by installing '3.16.14.7' like this:
gem install libv8 -v '3.16.14.7'
And that passed, so then adding this to the gemfile:
gem 'libv8', '3.16.14.7'

Related

Rails Dockerfile no longer building, unable to install racc

I have been working with the same Dockerfile for months on a rails api and suddenly it will no longer build. I am getting an error everytime it tries to install racc :
#11 7.201 Installing racc 1.6.0 with native extensions
#11 7.598 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
#11 7.598
#11 7.598 current directory: /usr/local/bundle/gems/racc-1.6.0/ext/racc/cparse
#11 7.598 /usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r
#11 7.598 ./siteconf20211027-1-1m7t8pg.rb extconf.rb
#11 7.598 checking for rb_block_call()... *** extconf.rb failed ***
#11 7.598 Could not create Makefile due to some reason, probably lack of necessary
#11 7.598 libraries and/or headers. Check the mkmf.log file for more details. You may
#11 7.598 need configuration options.
It's so strange that it was working fine until this afternoon. Here's my dockerfile:
FROM ruby:2.7.4-alpine
ENV APP_PATH /api
ENV RAILS_PORT 3000
# install dependencies for application these are specific to alpine
RUN apk -U add --no-cache --update \
build-base \
git \
vim \
postgresql-dev \
postgresql-client \
ruby-diff-lcs \
libxml2-dev \
libxslt-dev \
linux-headers \
nodejs \
yarn \
imagemagick \
tzdata \
less \
ruby-nokogiri \
&& rm -rf /var/cache/apk/* \
&& mkdir -p $APP_PATH
# navigate to app directory
WORKDIR $APP_PATH
COPY Gemfile ${APP_PATH}/Gemfile
COPY Gemfile.lock ${APP_PATH}/Gemfile.lock
RUN mkdir -p ${APP_PATH}/log && touch ${APP_PATH}/log/development.log
RUN bundle install
COPY . $APP_PATH
RUN gem install foreman
and my Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.4'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.4', '>= 6.1.4.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 1.1'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'rack-cors'
# Devise and Json Web Token deps
gem 'devise'
gem 'devise-jwt'
gem 'fast_jsonapi'
# QR Code Generator
gem "rqrcode", "~> 2.0"
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'faker'
gem 'rspec-rails'
# testing stuff
gem 'factory_bot_rails'
gem 'shoulda-matchers'
gem 'database_cleaner'
end
group :development do
gem 'listen', '~> 3.3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Any help or suggestions appreciated. Thank you!

Issue with "ERROR: Failed to build gem native extension"

I am attempting to run bundle install on a github file for a tutorial about Rails testing. When I attempt to run
bundle install
It installs most of my gems and then gives me this very long error. I've attempted to update both xcode and homebrew and it hasn't helped. Any advice would be very appreciated!
Here is the error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.7.6/ext/json/ext/generator
/Users/johnseabolt/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170209-69149-18f1540.rb extconf.rb
creating Makefile
current directory: /Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.7.6/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.7.6/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:179:47: error: too few arguments provided to function-like macro invocation
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
/Users/johnseabolt/.rbenv/versions/2.3.1/include/ruby-2.3.0/ruby/intern.h:797:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) __extension__ ( \
^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:179:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned
long') with an expression of type 'VALUE (const char *, long)' (aka 'unsigned long (const char *, long)')
[-Wint-conversion]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^ ~~~~~~~~~~
1 warning and 1 error generated.
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.7.6 for
inspection.
Results logged to
/Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/json-1.7.6/gem_make.out
An error occurred while installing json (1.7.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.6'` succeeds before bundling.
Johns-MacBook-Pro:expense_tracker johnseabolt$
Here is the gem file for the app I cloned from Github:
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'pg'
group :development, :test do
gem "rspec-rails", "~> 2.0"
end
group :test do
gem 'factory_girl_rails'
gem 'capybara'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
Try to run following command and then run bundle install
gem system --update

Bundle install failing when installing sqlite3 (1.3.8)

In the setup phase of an app that generates random quotes every few minutes. (Could probably use a motivation quote myself right about now as I've been pulling my hair out on this one for a day!)
Using ruby 2.3.0p0, and upon running bundle install, I get the following error:
bundle install
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies...
Using rake 10.1.1
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.8.2
Using atomic 1.1.14
Using tzinfo 0.3.38
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using mime-types 1.25.1
Using polyglot 0.3.3
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.1
Using bundler 1.12.5
Using chronic 0.10.2
Using coffee-script-source 1.6.3
Using execjs 2.0.2
Using thor 0.18.1
Using flickraw 0.9.7
Using hike 1.2.3
Installing json 1.8.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160803-40268-tnpkzj.rb extconf.rb --use-system-libraries
creating Makefile
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [enabled by default]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/json-1.8.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/json-1.8.1/gem_make.out
Using pg 0.17.1
Using tilt 1.4.1
Using rails_serve_static_assets 0.0.2
Using rails_stdout_logging 0.0.3
Using sass 3.2.13
Installing sqlite3 1.3.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.8/ext/sqlite3
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160803-40268-16a4yjy.rb extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... yes
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.8/mkmf.log
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.8/ext/sqlite3
make "DESTDIR=" clean
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.8/ext/sqlite3
make "DESTDIR="
compiling backup.c
compiling statement.c
statement.c: In function ‘bind_param’:
statement.c:261:7: warning: implicit declaration of function ‘RBIGNUM’ [-Wimplicit-function-declaration]
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
In file included from statement.c:1:0:
./sqlite3_ruby.h:16:34: error: invalid type argument of ‘->’ (have ‘int’)
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
^
statement.c:261:11: note: in expansion of macro ‘RBIGNUM_LEN’
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
statement.c:261:32: error: ‘SIZEOF_BDIGITS’ undeclared (first use in this function)
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
statement.c:261:32: note: each undeclared identifier is reported only once for each function it appears in
statement.c: In function ‘reset_bang’:
statement.c:293:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
int status;
^
statement.c: In function ‘clear_bindings’:
statement.c:313:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
int status;
^
make: *** [statement.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.8 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.8/gem_make.out
Using will_paginate 3.0.5
Using thread_safe 0.1.3
Using rack-test 0.6.2
Using treetop 1.4.15
Using coffee-script 2.2.0
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
I've taken some advice after research on similar issues from others and tried updating json by using 'bundle update json' and am still getting the same issue.
Here is the gemfile:
source 'https://rubygems.org'
#ruby "2.1.0"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'
# Use sqlite3 as the database for Active Record
group :development do
gem 'sqlite3'
end
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails', '~> 3.0.4'
#Gem for Heroku and PostgreSQL
group :production, :staging do
gem 'rails_12factor'
gem 'pg'
end
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
# Used for Flickr
gem 'flickraw'
#Used for writing and deploying cron jobs
gem 'whenever', :require => false
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
#Use will-paginate for pagination
gem 'will_paginate', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
This idea is originally from the following github project (https://github.com/Lieke22/Quotes.git) which I will be modifying to practice creating a rails web app.
I would greatly appreciate any feedback, pointers.
Best,
Brinder
Sounds like you need the tools to build native gems.
Try installing 'ruby-dev' with your package manager.
At First you should try
$ sudo gem install json -v '1.8.1'
In case if that didn't work, you could do this:
$ sudo apt-get install ruby-dev
and then you could install the gem and continue. Hope that can be fixed by:
$ sudo apt-get install libsqlite3-dev

Nokogiri giving me some trouble after adding AWS-SDK gem

I added the aws-sdk to my Gemfile as followed: gem 'aws-sdk', '~> 1.45.0'
and then proceeded to run bundle install in the terminal. However, the bundle did not work correctly and was not able to complete successfully.
command line prompt
Building nokogiri using system libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/cyrusghazanfar/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb --use-system-libraries
Building nokogiri using system libraries.
libxml2 version 2.9.0 and later is not yet supported, but proceeding anyway.
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... yes
checking for exsltFuncRegister() in libexslt/exslt.h... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling html_document.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [html_document.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/cyrusghazanfar/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Users/cyrusghazanfar/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.2.1/gem_make.out
An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
Gemfile
source 'https://rubygems.org'
gem 'rails', '4.1.1'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'bootstrap-sass'
gem 'devise', '~> 3.2.4'
gem 'paperclip', github: 'thoughtbot/paperclip'
gem 'aws-sdk', '~> 1.45.0'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
Nokogiri is giving me some problem here and I can't figure out what exactly.
Could someone help?
The problem is that make can't find /usr/bin/gcc-4.2:
make: /usr/bin/gcc-4.2: No such file or directory
If you have Xcode and Command Line Tools installed, then gcc is in /usr/bin. To fix the issue with make, create a symlink for gcc-4.2 which points to gcc:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

Rails 4: Error when installing tiny_tds gem?

I have developed a rails web project with Ruby v2 and Rails v4. It was perfectly working in my current system and when i tried to run this project in another Linux machine (Ubuntu 12.4 ) i am getting a Tidy_tds error .
This error is showing at the time of bundle install ,
Error Details below
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/action/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for iconv_open() in iconv.h... yes
checking for sybfront.h... no
-----
freetds is missing.
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
--without-opt-dir
--with-opt-include
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/action/.rvm/rubies/ruby-2.1.1/bin/ruby
--enable-lookup
--disable-lookup
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-freetds-dir
--without-freetds-dir
--with-freetds-include
--without-freetds-include=${freetds-dir}/include
--with-freetds-lib
--without-freetds-lib=${freetds-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /home/action/.rvm/gems/ruby-2.1.1/gems/tiny_tds-0.6.1 for inspection.
Results logged to /home/action/.rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/tiny_tds-0.6.1/gem_make.out
An error occurred while installing tiny_tds (0.6.1), and Bundler cannot continue.
Make sure that `gem install tiny_tds -v '0.6.1'` succeeds before bundling.
I have also tried installing tiny_tds seperatly, but still i am getting the same issue
gem install tiny_tds -v '0.6.1'
My gem file,
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
gem 'tiny_tds'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-ui-rails' # jquery ui
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use sqlserver as the database for Active Record
gem 'activerecord-sqlserver-adapter', :git => 'https://github.com/nextgearcapital/activerecord-sqlserver-adapter.git'
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"
gem 'bootstrap-datepicker-rails'
gem 'will_paginate'
gem 'sqlite3'
gem 'formtastic'
Why is this error appearing and how to solve this issue.
Any help is appreciated
Looks like you don't have freetds installed on this machine:
sudo apt-get install freetds-dev
If you see the details of the freetds-dev package you will see it has the missing file sybfront.h
There is no gem that I know for freetds and building the tiny_tds gem requires it to compile. However it should be possible for you build your own version of the gem using MiniPortile.
Rather than using the normal gem install mechanism you need to clone the tiny_tds from GitHub and then build a native gem for your environment. This process will include downloading a specific version of freetds which is used to compile the gem against.
This should get you round the problem of not being able to install freetds-dev package, but does have the disadvantage that if tiny_tds gem is updated in the future you will need to repeat this process each time - you can't simply take advantage of bundle update.
The steps you need to follow are detailed here.
For MacOS you need additional lib installed.
brew install freetds
This worked for me in Ubuntu 17.04
Install wget to download packages from remote URL
$ sudo apt-get install wget
Install dependencies
$ sudo apt-get install build-essential
$ sudo apt-get install libc6-dev
Download remote file
$ wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.21.tar.gz
Unzip
$ tar -xzf freetds-1.00.21.tar.gz
Configure and Run Test for the package in your system
$ cd freetds-1.00.21
$ sudo ./configure --prefix=/usr/local --with-tdsver=7.3
$ sudo make
Now, Install
$ sudo make install
Now install the gem
$ gem install tiny_tds -v '2.0.0'
If still, you cannot install the gem tiny_tds then try using sudo
$ sudo gem install tiny_tds -v '2.0.0'
Output
Building native extensions. This could take a while...
Successfully installed tiny_tds-2.0.0
Parsing documentation for tiny_tds-2.0.0
Installing ri documentation for tiny_tds-2.0.0
Done installing documentation for tiny_tds after 1 seconds
1 gem installed

Resources