How to install and run ffi on M1 Mac - ruby-on-rails

I'm using 'ffi', '~> 1.9',
I'm getting this error when I try to run my rails project
rake aborted!
LoadError: dlopen(/Users/kanye.west/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/ffi-1.9.25/lib/ffi_c.bundle, 0x0009): tried: '/Users/kanye.west/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/ffi-1.9.25/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))) - /Users/kanye.west/.rbenv/versions/2.6.9/lib/ruby/gems/2.6.0/gems/ffi-1.9.25/lib/ffi_c.bundle
/Users/kanye.west/dev/anenta/config/application.rb:14:in `<top (required)>'
/Users/kanye.west/dev/anenta/Rakefile:5:in `require'
/Users/kanye.west/dev/anenta/Rakefile:5:in `<top (required)>'
/Users/kanye.west/.rbenv/versions/2.6.9/bin/bundle:23:in `load'
/Users/kanye.west/.rbenv/versions/2.6.9/bin/bundle:23:in `<main>'
Caused by:
LoadError: cannot load such file -- 2.6/ffi_c
/Users/kanye.west/dev/anenta/config/application.rb:14:in `<top (required)>'
/Users/kanye.west/dev/anenta/Rakefile:5:in `require'
/Users/kanye.west/dev/anenta/Rakefile:5:in `<top (required)>'
/Users/kanye.west/.rbenv/versions/2.6.9/bin/bundle:23:in `load'
/Users/kanye.west/.rbenv/versions/2.6.9/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)
Approaches tried
gem install --user-install ffi -v '1.9.25' -- --enable-libffi-alloc
gem install ffi -v '1.9.25' -- --with-cflags="-Wno-error=implicit-function-declaration"
gem install ffi -v '1.9.25' --platform=rub
alias gem="arch -x86_64 sudo gem"
CFLAGS="-Wno-error=implicit-function-declaration" RUBY_CONFIGURE_OPTS='--with-readline-dir=/opt/homebrew/opt/readline' gem install ffi -v '1.9.25' -- --with-cflags="-Wno-error=implicit-function-declaration"

You need to install libffi using homebrew:
brew install libffi
Then the installation should succeed with:
gem install ffi
I've tested this on ruby 2.7.2 on my m1.
Also make sure that both libffi and ruby/gem are running on the same architecture. You may have mixed some arm64 and x86 binaries which will lead to lots of compiler errors in the long run. If you encounter "wrong architecture" errors, try to reinstall ruby/homebrew on arm/m1.
For reference:
I'm using chruby installed through homebrew and installed ruby 2.7.2 via ruby-install.
Both homebrew and ruby are not using rosetta emulation and are compiled on arm64. I've installed libffi using brew install and then installed ffi using gem install without problems.
pascal#0xc0fefe ~> which ruby
/Users/pascal/.rubies/ruby-2.7.2/bin/ruby
pascal#0xc0fefe ~> which ruby-install
/opt/homebrew/bin/ruby-install
pascal#0xc0fefe ~> file /Users/pascal/.rubies/ruby-2.7.2/bin/ruby
/Users/pascal/.rubies/ruby-2.7.2/bin/ruby: Mach-O 64-bit executable arm64
pascal#0xc0fefe ~> gem install ffi
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Parsing documentation for ffi-1.15.5
Done installing documentation for ffi after 0 seconds
1 gem installed

Here's the only workaround I found working, download Rosette, https://support.apple.com/en-us/HT211861, and uninstall (you need to do this in order for anything not compatible with the current architecture):
ruby versions
homebrew
rbenv
and select Get Info on Terminal, and check the Open using Rosetta.
Now reinstall
homebrew
rbenv
ruby
Run ruby -v
Check and verify that your version has ... [universal.x86_64-darwin21]

The thing is that official support for M1 was added in ffi v 1.14.0, so try update to that version, should not break anything.
gem uninstall ffi
and change manually in Gemfile.lock to 1.14.0.
gem install ffi -v '1.14.0'
This is what worked for me.

I've been trying to install a demo React Native App that innocently asked to run pod install and the went down this ffi rabbit hole.
On my M2 / Monterey, this article worked well except it was missing the instruction to install the ruby plugin for asdf
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git

Related

gem install mimemagic -v '0.3.10' fails to install on Big Sur

Mac OS Big Sur 11.4
** Rails 6.1.0 **
however, my use case is for a Rails Engine that I am writing that targets Rails 6.1+ applications
xcode-select version 2384.
GCC version
% gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: arm64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
the gem I am trying to install is
mimemagic 0.3.15 installed with bundler
Bundler version 2.2.19
this is in a non-Rails application that uses bundler. in my app mimemagic is resolving (new) to 0.3.5, but won't install on Mac OS Big Sur
gem install mimemagic -v '0.3.10' --source 'https://rubygems.org/'
the result is
Building native extensions. This could take a while... ERROR: Error
installing mimemagic: ERROR: Failed to build gem native extension.
current directory: /Users/jason/.rvm/gems/ruby-2.6.3/gems/mimemagic-0.3.10/ext/mimemagic
/Users/jason/.rvm/rubies/ruby-2.6.3/bin/ruby -rrubygems
/Users/jason/.rvm/gems/ruby-2.6.3/gems/rake-13.0.3/exe/rake
RUBYARCHDIR\=/Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/mimemagic-0.3.10
RUBYLIBDIR\=/Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/mimemagic-0.3.10
rake aborted! Could not find MIME type database in the following
locations: ["/usr/local/share/mime/packages/freedesktop.org.xml",
"/opt/homebrew/share/mime/packages/freedesktop.org.xml",
"/opt/local/share/mime/packages/freedesktop.org.xml",
"/usr/share/mime/packages/freedesktop.org.xml"]
Ensure you have either installed the shared-mime-info package for your
distribution, or obtain a version of freedesktop.org.xml and set
FREEDESKTOP_MIME_TYPES_PATH to the location of that file.
This gem might be installed as a dependency of some bigger package,
such as rails, activestorage, axlsx or cucumber. While most of these
packages use the functionality of this gem, some gems have included
this gem by accident. Set USE_FREEDESKTOP_PLACEHOLDER=true if you are
certain that you do not need this gem, and wish to skip the inclusion
of freedesktop.org.xml.
The FREEDESKTOP_PLACEHOLDER option is meant as a transitional feature,
and will be deprecated in the next release.
/Users/jason/.rvm/gems/ruby-2.6.3/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:15:in
`locate_mime_database'
/Users/jason/.rvm/gems/ruby-2.6.3/gems/mimemagic-0.3.10/ext/mimemagic/Rakefile:39:in
`block in <top (required)>'
/Users/jason/.rvm/gems/ruby-2.6.3/gems/rake-13.0.3/exe/rake:27:in
`<main>' Tasks: TOP => default (See full trace by running task with
--trace)
rake failed, exit code 1
Gem files will remain installed in
/Users/jason/.rvm/gems/ruby-2.6.3/gems/mimemagic-0.3.10 for
inspection. Results logged to
/Users/jason/.rvm/gems/ruby-2.6.3/extensions/-darwin-20/2.6.0/mimemagic-0.3.10/gem_make.out
jason#Rose21 hot-glue % bundler -v Bundler version 2.2.19
--SOLVED--
TO FIX:
brew install shared-mime-info
or
sudo apt-get install shared-mime-info

gem install rails -v 4.2.4 Failed to install

I receive the following error message when running this command:
gem install rails -v 4.2.4
This is the error:
/Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/yaml.rb:5:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
Referenced from: /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/psych.bundle
Reason: image not found - /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/psych.bundle
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/psych.rb:7:in `<top (required)>'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/yaml.rb:6:in `<top (required)>'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems.rb:628:in `load_yaml'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/config_file.rb:326:in `load_file'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/config_file.rb:198:in `initialize'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/gem_runner.rb:75:in `new'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/gem_runner.rb:75:in `do_configuration'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/gem_runner.rb:40:in `run'
from /Users/adamgoldberg/.rvm/rubies/ruby-2.3.0/bin/gem:21:in `<main>'
Please Help - this is causing me nightmares
It seems your ruby installation is missing psych (for YAML output).
Install libyaml with Homebrew: http://brew.sh; then try gem install rails -v 4.2.4
$ brew info libyaml
libyaml: stable 0.1.6 (bottled)
YAML Parser
http://pyyaml.org/wiki/LibYAML
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libyaml.rb
==> Options
--universal
Build a universal binary
$ brew install libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.1.6_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libyaml-0.1.6_1.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/libyaml/0.1.6_1: 8 files, 312.8K
REINSTALL RUBY
If the above solution doesn't work for you, reinstall Ruby from scratch with rvm or rbenv,
1) Try the instructions on this accepted answer: https://stackoverflow.com/a/38194139/1076207
—OR—
2) Remove all rvm files, then reinstall rvm: https://stackoverflow.com/a/38158619/1076207
—OR—
3) Remove all rvm files, then install rbenv: https://stackoverflow.com/a/38194231/1076207
After using one of the three options above, use http://bundler.io to install Rails:
$ mkdir ~/Documents/Repo
$ cd ~/Documents/Repo
$ gem install bundler
[…]
$ bundle init
Writing new Gemfile to /Users/username/Documents/Repo/Gemfile
$ echo "gem 'rails', '4.2.4'" >> Gemfile
$ bundle install
[…]
$ bundle exec rails new project_name
[…]
$ cd project_name
Personally, I recommend 3) switch to rbenv—I did.
The error itself clearly says that you should install libyaml first and then re-install your ruby. You can do it by running following commands.
sudo apt-get install libtool
rvm package install libyaml
rvm reinstall ruby-2.3.0
for more reference please see this answer

How to fix the Cocoapods installation setup error?

I am trying to install cocoapods in my mac, but I can't get it installed. It shows the following error:
$ sudo gem update --system*
Latest version currently installed.
Aborting.
$ sudo gem install cocoapods**
Successfully installed cocoapods-0.34.4
Parsing documentation for cocoapods-0.34.4
1 gem installed
$ pod setup
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'cocoapods' (>= 0) among 200 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/(user name)/.rvm/gems/ruby-1.9.3-p374:/Users/vamshiraghu/.rvm/gems/ruby-1.9.3-p374#global', execute `gem env` for more information
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:324:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:58:in `gem'
from /usr/bin/pod:22:in `<main>'
So does anybody know about this error to sort it out?
I have same problem. I got different kinds of error when try different combination of install and uninstall. like
[!] The `master` repo requires CocoaPods 0.32.1 -
or
.rvm/gems/ruby-2.0.0-p598/gems/claide-0.4.0/lib/claide/command.rb:217:in `rescue in run': undefined method `verbose?' for nil:NilClass (NoMethodError)
or
.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require': cannot load such file -- colored (LoadError)
from /Users/riverhuang/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /Users/riverhuang/.rvm/gems/ruby-2.1.5#global/gems/cocoapods-0.36.2/lib/cocoapods/user_interface.rb:8:in `<module:UserInterface>'
from /Users/riverhuang/.rvm/gems/ruby-2.1.5#global/gems/cocoapods-0.36.2/lib/cocoapods/user_interface.rb:7:in `<module:Pod>'
.
.
.
from /Users/riverhuang/.rvm/gems/ruby-2.1.5/bin/pod:23:in `load'
from /Users/riverhuang/.rvm/gems/ruby-2.1.5/bin/pod:23:in `<main>'
Could not find proper version of cocoapods (0.29.0) in any of the sources
Run `bundle install` to install missing gems.
After clear all gem in my computer I finally fixed it. Here is my steps to clear all gems.
gem uninstall --all
sudo gem uninstall --all
After uninstall all gems I reinstall the cocoapods.
sudo gem install cocoapods
Then restart the Terminal and run:
pod setup
I guess it has conflict in dependency gems (wrong version or not in right path). Like once I run "bundle install" it always install cocoapods 0.29.0 and all its dependency. With and without "sodu" install gems and its dependency to different places with version 0.36.2 when I did it.

Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib

I'm getting this error when trying to run rspec in Hartl's tutorial. I googled the error, but it's never for the specific version and the fixes don't actually fix my problem.
/Users/Jimbo/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/lib/nokogiri.rb:28:in `require': dlopen(/Users/Jimbo/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri- 1.6.0/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /Users/Jimbo/.bundler/tmp/22862/gems/nokogiri-1.6.0/ports/i686-apple- darwin11/libxml2/2.8.0/lib/libxml2.2.dylib (LoadError)
Referenced from: /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri- 1.6.0/lib/nokogiri/nokogiri.bundle
Reason: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0 - /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.0/lib/nokogiri.rb:28:in `<top (required)>'
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247/gems/capybara-2.1.0/lib/capybara.rb:2:in `require'
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247/gems/capybara-2.1.0/lib/capybara.rb:2:in `<top (required)>'
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /Users/Jimbo/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
I suggest you first uninstall Nokogiri using:
sudo gem uninstall nokogiri
Then install Nokogiri using rubygems:
gem install nokogiri
If that doesn't work, there's an open issue on Nokogiri to support libxml 2.9.0 and later. There's a libxml2-2.9.1 branch that was started in preparation for the next release of libxml2.
Then try pulling from that branch in your Gemfile like this:
gem "nokogiri", github: "sparklemotion/nokogiri", branch: "libxml2-2.9.1"
or install an older version of libxml2.
If that still doesn't work you may also want to try the suggestions here: What to do if libxml2 is being a jerk.
Not sure if it helps anyone, but I could just get nokogiri installed by using system libs
gem install nokogiri -- --use-system-libraries
If you have Homebrew installed, try this. It solves the issue with the "Parsing documentation for nokogiri-1.6.1" hang. This worked for me.
gem uninstall nokogiri libxml-ruby
It'll ask you a series of questions based on how much of it you want to uninstall, answer "yes" or "[y]" to all.
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew link --force libxml2
brew install libxslt
brew link --force libxslt
gem install nokogiri --no-rdoc --no-ri
Then, in your project file:
bundle install
Your error message says:
nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib
provides version 10.0.0
This makes me think that your gem actually requires a version of libxml that is newer than your system version. How have you installed libxml2? If you have homebrew installed, you might want to try upgrading it with
brew update
brew upgrade
I was able to install Nokogiri 1.6.0 with Ruby 2.0.0p247 on OS X 10.9, and then require it in IRb. I double checked with Homebrew, and it is actually keg-only. However, Nokogiri seems to install its own version into gems/nokogiri-1.6.0/ports. On my machine, it is under x86_64-apple-darwin13.0.0.
First gem uninstall nokogiri
Second install nokogiri
third restart terminal
be happy
Try the following inside your project directory.
gem uninstall nokogiri
If there are more than one versions installed, a prompt will appear asking which version to remove. use the last option that reads "All versions".
Next, run bundle install inside your project directory. once it finishes installing the needed gems you should be good to go.
In my case, I hit the last option "All versions" as it doesn't hurt my project but it is possible that you might need the other versions based on different projects.
First, check your version of libxml:
otool -L /usr/lib/libxml2.2.dylib
It can return
/usr/local/opt/libxml2/lib/libxml2.2.dylib (compatibility version 11.0.0, current version 11.0.0)
or
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
Then you can try reinstalling libxml to upgrade it:
brew uninstall libxml2 libxslt
brew install libxml2 libxslt
After that, try to recompile your package:
make clean
./configure
make
sudo make install
Reinstalling the gem didn't work for me, nor did pulling the particular branch.
It's not ideal, but I found that rolling back to 1.5.9 solved the issue.
Nokogiri generally uses system libraries. So, your ruby has it installed already just make sure that you've run below command before start bundle install.
rvm use ruby-2.2.4 (your current ruby-version)
Sometimes, you also need to run first
/bin/bash --login
rvm use ruby-2.2.4
Note: Only if you're using rvm

Error : 'incompatible library version' sqlite3-1.3.11 in rails

I working on Ubuntu system(16.04).
My problem is whenever i setup any rails project and try to run rails s then i got 'incompatible library version' error for sqlite3 something like below.
/home/jiggs/.rvm/gems/ruby-2.3.1#albumriver/gems/activesupport-4.0.0/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
/home/jiggs/.rvm/gems/ruby-2.3.1#albumriver/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `require': incompatible library version - /home/jiggs/.rvm/gems/ruby-2.3.1#albumriver/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.so (LoadError)
from /home/jiggs/.rvm/gems/ruby-2.3.1#albumriver/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /home/jiggs/.rvm/gems/ruby-2.3.1#albumriver/gems/sqlite3-1.3.11/lib/sqlite3.rb:2:in `<top (required)>'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:77:in `require'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:77:in `block (2 levels) in require'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `each'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:72:in `block in require'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:61:in `each'
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:61:in `require'
from /usr/lib/ruby/vendor_ruby/bundler.rb:99:in `require'
from /home/jiggs/sites/albumriverfinal/config/application.rb:7:in `<top (required)>'
from /home/jiggs/.rvm/gems/ruby-2.3.1#albumriver/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /home/jiggs/.rvm/gems/ruby-2.3.1#albumriver/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/jiggs/.rvm/gems/ruby-2.3.1#albumriver/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /home/jiggs/.rvm/gems/ruby-2.3.1#albumriver/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Rails version : 4.0.0
ruby version i tried with rails 4.0.0 :
ruby-2.0.0-p247 [ x86_64 ]
ruby-2.2.5 [ x86_64 ]
ruby-2.3.0 [ x86_64 ]
ruby-2.3.0-preview1 [ x86_64 ]
ruby-2.3.1 [ x86_64 ]
I trying to uninstall sqlite3 using gem uninstall sqlite3 and trying to run bundle install but got this error :
An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
Then i run gem install sqlite3 -v '1.3.11' and run rails server and got same error again incompatible library version.
Output of sqlite3 gem install :
gem install sqlite3 -v '1.3.11'
Fetching: sqlite3-1.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed sqlite3-1.3.11
Parsing documentation for sqlite3-1.3.11
Installing ri documentation for sqlite3-1.3.11
Done installing documentation for sqlite3 after 1 seconds
1 gem installed
The SQLite library is likely to be corrupted. Try reinstalling the gem by running the following from a command pronpt:
gem uninstall sqlite3
Then run:
bundle install
I've rolled back ruby version to 2.3.0 and all worked .It seems to be an issue
#Jiggs: The same issue I got when my system updated to 16.04. After that all previous applications were difficult to configure as throwing so many dependency errors, in which your error was one of them.
After lots of finding only conclusion I got the problem is on RVM,
If you are using RVM then please install Rails 5.0 in yous default gemset
rvm gemset use default
gem install rails -v=5.0
After installing rails 5 all the compatible dependencies get installed.
Now move to your any project CREATE New GEMSET (please don't use previous).
rvm gemset create my_new_gemset
rvm gemset use my_new_gemset
Finally do bundle install
In my case after doing this resolved all the errors as you mentioned.
I know it is bit strange that installing Rails-5 in default gemset and using new gemset resolved this issue. But somehow it works.
Hope this will help you.
For me going back to ruby 2.2.5p319 helped. I just realize the version of the Ruby that comes with Rails has to match to the one installed even though the RubyInstaller release gets ahead.
I came here looking for answer, didn't help me, but I found a solution here, (it appears to be an issue with 1.3.11, downgrade to 1.3.10 did the trick)

Resources