I'm trying to get Rails to work with PostgreSQL. Apparently one thing I need to do along the way is sudo gem install pg. When I do that, I get this:
jason#buster:~/projects$ sudo gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:2:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:2
Gem files will remain installed in /var/lib/gems/1.8/gems/pg-0.10.0 for inspection.
Results logged to /var/lib/gems/1.8/gems/pg-0.10.0/ext/gem_make.out
I've Googled and tried a few things based on what I've found but nothing seems to help. Any advice? I'm on Ubuntu.
You need to install your distro ruby-dev (or devel) package otherwise you won~t be able to build any ruby C extensions.
I'm not on ubuntu, but you package-manager command might be somewhat like this:
$ sudo apt-get install ruby-dev build-essential
On Ubuntu:
$ sudo apt-get install postgresql-client libpq5 libpq-dev
$ sudo gem install pg
Related
I'm trying to install gem nokogiri by:
sudo gem install nokogiri
But I get this error:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/nokogiri-1.8.4/ext/nokogiri
/usr/bin/ruby2.5 -r ./siteconf20181003-5678-1ub6p51.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
I search on google and they said it because there are no ruby-dev. So I install ruby-dev by:
~$ sudo apt-get install ruby-dev
~$ dpkg -l | grep ruby-dev
ii ruby-dev:amd64 2:2.3.0+1bbox1~xenial1
amd64 Header files for compiling extension modules for Ruby (default version)
And it install ruby-dev successfully but still get error before.
Thats the problem you dont have rails installed and also gem bundler.
Can you please install it:
Run in terminal:
gem install bundler
and after that:
gem install rails
install specific version of ruby
sudo apt-get install ruby2.5-dev
gem install nokogiri -v 1.8.4 -- --use-system-libraries
I'm trying to set up dashing.io on my raspberry pi using this guide: https://github.com/mivok/squirrelpouch/wiki/dashing-pi
I install ruby-dev using sudo apt-get install ruby ruby-dev and than dashing using echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc
sudo gem install bundler dashing
During the installastion of dashing I get the following error:
ERROR: Error installing dashing:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
Gem files will remain installed in /var/lib/gems/1.9.1/gems/eventmachine-1.0.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/eventmachine-1.0.3/ext/gem_make.out`
I've found several similar posts about this error, but every solution to those is to install ruby-dev, which I have done already. I have also tried to run sudo apt-get install ruby1.9.1-dev. This command tells me that this version of ruby-dev is already installed. I've also tried to run rails -v, but get -bash: rails: command not found
What else can I do to fix this?
Thanks!
RoR is nice, but sometimes makes me want to bang my head against the wall (and it's probably my fault anyway). I'm simply trying to install the Thin web-client gem, and when I run sudo gem install thin, I get the following error (it requires the installation of the eventmachine gem first):
sudo gem install thin
Fetching: eventmachine-1.0.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing thin:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:2:in `<main>'
I've searched for the "cannot load such file -- mkmf" error, but most issues seem to be surrounding the fact that it was available in 1.8-dev but not 1.8, but as I'm running 1.9.3 I figured I had mkmf - which I verified with locate mkmf:
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb
The directory that mkmf is located in is obviously not under the /usr/lib/ruby/... directory - I'm not sure if this is my problem or not, but it maybe enough to jumpstart one of you experts out there as to what's going on and what the solution could be.
Also, I've used RVM to install ruby 1.9.3 rather than just a gem install...
Thanks in advance!
if you're using RVM, you shouldn't ever be using 'sudo'. Using sudo calls libs and such out of the rvm path. Try just a flat
gem install thin
and see if that helps.
~Kevin
I had a similar error to this outside of rvm, I found that i needed to install ruby-devel
I have same problem in Ubuntu 12.04 . Solved by:
sudo apt-get install build-essential
sudo apt-get install curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev
Try below command it will helps to resolve the problem
sudo gem install thin -- --with-cflags=\"-O2 -pipe -march=native -w\"
This did it for me:
sudo apt-get install ruby-dev
Cheers
I'm setting up servers. I'm installing rails on an Amazon Linux
Installed List: ruby, development tools, gems, zlib-devel, readline-devel.
I'm trying to install rails and now I'm stuck here
$ sudo gem install rails Building native extensions. This could take
a while... ERROR: Error installing rails: ERROR: Failed to build gem
native extension.
/usr/bin/ruby extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in
/usr/lib64/ruby/gems/1.8/gems/json-1.6.3 for inspection. Results
logged to
/usr/lib64/ruby/gems/1.8/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
Is there a problem with this json library?
You need to install the following
yum install ruby-devel
yum install make
yum install gcc
You should be using Ruby 1.9.x, to upgrade Ruby:
sudo yum install ruby19
and also
sudo yum install ruby19-devel
sudo yum install make
sudo yum install gcc
If you've installed rvm, make sure to use rvm gem install rails
THe problem has nothing to do with RVM. The problem is you need ruby source header files. Compile ruby from source(RVM does that) or install the appropiate headers for your ruby version.
What is amazon linux(there is not such thing) ? is it ubuntu or what ?
How did you installed ruby ? what does ruby -v says ?
I'm setting up mod_rails on a Debian server but somehow something got screwed up (it wasn't me :P ).
gem install passenger
Building native extensions. This could take a while...
ERROR: Error installing passenger:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.7/ext/fastthread/gem_make.out
gem is installed:
gem -v
1.3.5
ruby also fine:
ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
Are you sure you have make, gcc et al?
$ sudo apt-get install build-essential
Does "which make" point to anything?
apt-get install build-essential zlib1g-dev libssl-dev libreadline5-dev
This should be everything you need to get passenger to build