I am getting this error while installing blacklight project in ruby on rails for the bundle install in ubuntu 16.04 - blacklight

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20170529-7305-1ybn2iijson-1.8.6/gems/json-1.8.6/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20170529-7305-1qu2mp6.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /tmp/bundler20170529-7305-1ybn2iijson-1.8.6/gems/json-1.8.6 for inspection.
Results logged to /tmp/bundler20170529-7305-1ybn2iijson-1.8.6/extensions/x86_64-linux/2.3.0/json-1.8.6/gem_make.out

Thanks for asking! Do you have the ruby-dev package installed? You can get it with:
sudo apt-get install ruby-dev

Related

cocoa pods error failed to build gem native extension on Mac

ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200728-45926-1h0nq8i.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/includ.e/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.18 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.9.18/gem_make.out
I'm just trying to install it and it doesn't work.
PS: I also already have cocoa pods. I am simply following the instructions on react native setting up your environment
The below steps would fix that issue:
Ensure ruby is installed and up to date: ruby -v
Update gem's sudo gem update --system
xcode-select --install
sudo gem install -n /usr/local/bin cocoapods
Solved it by updating the repo
sudo gem repo update

React-Native init stuck when installing required cocoapods

I am trying to create a new project by using
react-native init <projectName>
But it's been stuck at this for 10min:
info Installing required CocoaPods dependencies
Before creating my project, I installed cocoapods using
sudo gem install cocoapods
Why is it getting stuck?
Installation
$ sudo gem install cocoapods
Sudo-less installation
If you do not want to grant RubyGems admin privileges for this process, you can tell RubyGems to install into your user directory by passing either the --user-install flag to gem install or by configuring the RubyGems environment. The latter is in our opinion the best solution. To do this open up terminal and create or edit your .bash_profile with your preferred editor. Then enter these lines into the file:
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
Note that if you choose to use the --user-install option, you will still have to configure your .bash_profile file to set the PATH or use the command prepended by the full path. You can find out where a gem is installed with gem which cocoapods. E.g.
$ gem install cocoapods --user-install
$ gem which cocoapods
/Users/eloy/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods.rb
$ /Users/eloy/.gem/ruby/2.0.0/bin/pod install
Updating CocoaPods
To update CocoaPods you simply install the gem again
$ [sudo] gem install cocoapods
Or for a pre-release version
$ [sudo] gem install cocoapods --pre
This command will get stuck if your internet connection is unstable. Make sure you have stable wifi when you create a react native project.

mysql2 Gem::Ext::BuildError: ERROR: Failed to build gem native extension

When I download the rails application from github
https://github.com/ari/jobsworth
An then give bundle install it throws error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
An error occurred while installing mysql2 (0.4.4), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.4'` succeeds before bundling.
After I give the sudo gem install mysql2 -v '0.4.4' and it displays like:
Fetching: mysql2-0.4.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.4.0/gems/mysql2-0.4.4/ext/mysql2
/usr/bin/ruby2.4 -r ./siteconf20180212-10708-v1q8lj.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.4.0/gems/mysql2-0.4.4 for inspection.
Results logged to /var/lib/gems/2.4.0/extensions/x86_64-linux/2.4.0/mysql2-0.4.4/gem_make.out
After run bundle install it throws same error.
Running these commands worked for me.
brew install openssl
bundle config --global build.mysql2 --with-opt-dir="$(brew --prefix openssl)"
bundle
You can refer to this link for further help https://github.com/brianmario/mysql2/issues/1005

Can't install rmagick gem on Mountain Lion

Note: my situation is almost identical to this: Can't install pg gem on Mountain Lion.
I just upgraded from Snow Leopard to Mountain Lion and Rails is giving me all kinds of problems, especially trying to install the 'rmagick' gem. I'm running Ruby 1.9.3-p362 and Rails 3.2.11.
➜ git:(master) ✗ sudo gem install rmagick -v 2.13.1
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/opt/local/bin/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
/OPT/LOCAL/BIN/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
/USR/LOCAL/BIN/Magick-config reports version 6.8.0 Q16 is installed in /USR/LOCAL/Cellar/imagemagick/6.8.0-10
Using 6.6.6 Q8 from /opt/local.
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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
--without-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/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
/Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from extconf.rb:193:in `<main>'
Gem files will remain installed in /Users/sscirrus/.rvm/gems/ruby-1.9.2-p320/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/sscirrus/.rvm/gems/ruby-1.9.2-p320/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
➜ applyco git:(master) ✗ brew install imagemagick --disable-openmp
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Error: imagemagick-6.8.0-10 already installed
➜ applyco git:(master) ✗ apt-get install libmagick9-dev
zsh: command not found: apt-get
I have tried:
Installing Xcode with command line tools
Reinstalling homebrew
Clearing out all my repo's gems (including Gemfile.lock) and running bundle install
Reinstalling the bundler gem
Reinstalling ImageMagick
Nothing, including answers elsewhere on SO, have been of any use. Can you point me in the right direction?
I had the same problem as you setting up my dev environment on Mountain Lion for RoR 3.2.11. Apparently the last version of RMagick (2.13.1 ) doesn't play nice compiling with the last version of ImageMagick (6.8.2-0). Disabling openmp and building from source worked like, ahem.. Magick.
brew uninstall imagemagick
brew install imagemagick --disable-openmp --build-from-source
gem install rmagick
I didn't need to edit the brew formula described in http://blog.paulopoiati.com/2013/01/28/installing-rmagick-in-mac-os-x-mountain-lion-with-homebrew/, but that would be the next step to try.
I am going through the same issue here...
But one difference, maybe your homebrew its linked to another version of Imagemagick.
So even though imagemagick-6.8.0-10 is installed is not being found.
Try something like
brew unlink imagemagick
then brew link imagemagick
and see what happens.
This fixed my problem
http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion
It may be a permissions issue try running
sudo chown -R `whoami` /usr/local
and then try again.
I had the same issue while trying to use Paperclip with Rails 3 for the first time.
Just to sum up previous answers, what worked for me was the following:
sudo chown -R `whoami` /usr/local
brew link --overwrite imagemagick
Thanks!

Ubuntu 11.04 Ruby on Rails install write permissions error

I am trying to install rails and have installed rvm and am trying to install rails but it is saying I do not have write permissions.
$ gem install rails --version 3.0.7
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /var/lib/gems/1.8 directory.
When I try sudo it give me this error, I know that you can use --no-ri --no-r-doc but even when I did this rails was not installed properly. Does anyone have any ideas?
$ sudo gem install rails --version 3.0.7
Successfully installed rails-3.0.7
1 gem installed
Installing ri documentation for rails-3.0.7...
file 'lib' not found
Installing RDoc documentation for rails-3.0.7...
file 'lib' not found
from my experience with rvm, gems should't stay in /var/lib/
if you didn't specifically asked for this, there might be a problem with your rvm installation
if so, i would definetly recommend a clean rvm install by following ryan bigg's guide of installing rvm. i followed it every time and never ever had the slightest problem after.
hope this helps!