I have the following error during sqlite3-ruby install:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite3-devel'
*** 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=/usr/bin/ruby1.8
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out
sqlite3.h is located in /usr/include/
sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include
doesn't work
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --without-sqlite3-include=/usr/include
Ubuntu 10.04
You need the SQLite3 development headers for the gem’s native extension to compile against. You can install them by running (possibly with sudo):
apt-get install libsqlite3-dev
You just need a -- in there.
sudo gem install sqlite3-ruby -- --with-sqlite3-include=/usr/include
That specifies that the option is not to gem directly, but the specific gem.
In my case I have no basic compilers installed, so
sudo apt-get install build-essential
solved my problem, but for most the people I think https://stackoverflow.com/a/3649005/417267 is the solution.
This is what I did:
wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz
tar xzf sqlite-amalgamation-3.7.2.tar.gz
cd sqlite-3.7.2/
./configure
make
make install
gem install rails sqlite3-ruby
from : http://cuasan.wordpress.com/2010/10/13/rails-3-on-debian-with-sqlite-3/
If you run in ubuntu,and using RVM for ruby on rails,please add FIRST:
sudo apt-get install libxslt-dev libxml2-dev
OR You can check with these commands:
This command will prepare for you two packages : sqllite3 and libsqlite3-dev
sudo apt-get install sqlite3
libsqlite3-dev
-Now,install sqlite gem
[sudo] gem install sqlite3-ruby
-using Ubuntu doesn't need sudo.
Goodluck! Note: i'm using Ubuntu 10.10 and it's working.
This was simply enough to make it work
sudo apt-get install libsqlite3-dev
Thanks to marshluca
Tried ALL of other solutions, none helped.
It turned out that you also need dev package for ruby itself. For me, it helped
sudo apt-get install ruby-full
It has a lot of nasty dependencies though (like emacs, wtf?), just
sudo apt-get install ruby1.8-dev
should be fine. After it's installed (and you have the sqlite and sqlite-dev packages installed)
sudo gem install sqlite3-ruby
works like a charm.
From sqlite3-ruby gem can't find sqlite3.h on ubuntu:
You also need to install gcc itself, so in total it would be:
sudo apt-get install gcc libsqlite3-dev ruby1.8-dev
sudo gem install sqlite3
Apparently you get a wrong error pointing to a missing sqlite3.h when the actual problem is missing gcc itself.
Here's a better answer from HEROKU - cannot run git push heroku master
Since you can't use sqlite3 on heroku add this to your Gemfile:
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
The solution is to add -- to separate configure parameters from gem parameters.
instead of
sudo gem install sqlite3-ruby --without-sqlite3-include=/usr/include
try this, all on one line, make sure to include -- after the last gem parameter and before configure parameters:
sudo gem install sqlite3 --
--with-sqlite3-lib=/somewhere/local/lib
--with-sqlite3-include=/somewhere/local/include
This should get you around this error:
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --without-sqlite3-include=/usr/include
Had this same problem and the following worked for me:
compile sqlite3 as static library, install somewhere in your home directory and then provide that option for the gem install process.
Go to the download page and grab the source. Most recent version at this time is http://www.sqlite.org/sqlite-autoconf-3070400.tar.gz
tar -xf on the file or do whatever you normally do to uncompress; enter directory
./configure --disable-shared --enable-static --prefix=/some/path/in/my/home
compile, install, and when you're installing the gem...
gem install sqlite3-ruby -- --with-sqlite3-dir=/some/path/in/my/home
None of the above mentioned solution worked for me, even after installing ruby2.5-dev and libsqlite3-dev. Then tried using PostgreSql instead of sqlite. That worked fine. To use PostgreSql instead of sqlite use this command when creating rails project.
rails [_VERSION_] new project_name -d postgresql
If you want to use MySql then use mysql instead of postgresql.
rails [_VERSION_] new project_name -d mysql
Else you can try without sqlite.
bundle install --without sqlite
Not --without-sqlite3-include=/usr/include, but --with-sqlite3-include=/usr/include.
This is the exact same problem I had a few weeks ago. I found out I needed to download the most recent headers/libraries from the SQLite Download Page. Try it out, hope this helps!
For me the problem was solved by getting mkmf, which is in ruby1.8-dev.
sudo apt-get install ruby1.8-dev
Thanks to mentalized for that one.
I agree with Danya Vershinin & EnotionZ.
If can't use apt-get:
compile & install sqlite3 from sources by specifying your own "prefix" path.
More information can be found in the README.
Then passed this path to the sqlite3-ruby installer (don't forget the "--").
You have broken version of RVM. Ubuntu does something to RVM that produces lots of errors, the only safe way of fixing for now is to: sudo apt-get --purge remove ruby-rvm sudo rm -rf /usr/share/ruby … , if it does not help then restart your computer. install RVM: \curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles If you find you need some hand-holding, take a look at Installing Ruby on Ubuntu 12.04, which gives a bit more explanat
Forget everything and do this,
run
yum install ruby-devel sqlite sqlite-devel ruby-rdoc
yum install make gcc
gem install sqlite3-ruby
bundle install
That's for rhel, run same for ubuntu.
I just downgraded to sqlite3-ruby '1.2.2'
Related
My Rails is 3.2.1.4, Ruby is 1.9.3p448.
I got an error when I install ruby-debug:
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.
/home/hxh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** 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=/home/hxh/.rvm/rubies/ruby-1.9.3-p448/bin/ruby
Gem files will remain installed in /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46 for inspection.
Results logged to /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46/ext/gem_make.out
Who can tell me where the error is?
The error is in the mkmf.log file. That file should be located at /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46/ext/linecache/mkmf.log.
If not, you can use
sudo find / -name mkmf.log
to find it.
To troubleshoot further, see "How to install Nokogiri Ruby gem with mkmf.log saying libiconv not found?"
I am using Mac El Capitan. In my case it was caused by the missing developer tool. I solved it by installing the developer tool via xcode-select --install. After that bundle install worked fine again.
You're most likely missing some file headers (e.g. zlib or libiconv), so try installing them.
Linux: sudo apt-get install libz-dev libiconv-hook1 libiconv-hook-dev
OS X: brew install libiconv && xcode-select --install
Otherwise check your mkmf.log file for more specific details.
I was facing the same issue running MacOS Big Sur version 11.1 and Xcode Version 12.4 (12D4e). In my case there was no command-line tool selected in Xcode.
I just followed the following steps to fix the problem:
Start Xcode.
Open the preferences using ⌘+,.
Select the Locations tab.
Select command-line tool (Xcode 12.4 12D4E in my case).
Run sudo gem install cocoapods (in my case).
It seems to be a issue with permission of gcc.. however, if you're using OS X, you may encounter this issue if you've updated your XCode but haven't agree to their terms & conditions yet.. try typing gcc in your terminal would show you what if you've agreed.
My mkmf.log showed that gcc (4.8.2 I think) didn't like a specific argument that was being used by atomic on
$ gem install atomic
So I had a very similar situation. The answer for me was to upgrade gcc/gcc-libs and lib tool.
I use Arch linux, and only Arch linux. The proper way to do this is to run
$ sudo pacman -Syu
which upgrades all system packages.
I installed Rails and hadn't run a system update since, which is where the issue came from. In most other *nix distros, you would update to the latest version of these packages by name, i.e. with apt, it would be something along the lines of
$ sudo apt-get update
followed by
$ sudo apt-get upgrade {package-name}
For what it's worth, using Ruby 2.0.0 I was having this problem on OSX 10.10.
I ended up running brew update, which resolved some conflicts, then installed the gem and it was fine.
The answer of kenorb worked for me on Ubuntu 16.04 when I was trying installing rails! Thanks!
I followed these steps below for installing rails:
sudo apt-get install ruby-full
sudo apt-get install libz-dev libiconv-hook1 libiconv-hook-dev
sudo gem install rails
I had the issue because gcc wasn't available on my machine.
Fixed it by installing gcc.
sudo apt install build-essential
This worked for me. Nokogiri was the problem.
Try the following if you are using Alpine-Linux(or equivalent command for your OS):
apk add build-base
And then install Nokogiri using:
gem install nokogiri -- --without-pkg-config --with-libxml-2.0-config
Took me a while to successfully install it.
Install cocoapods with HomeBrew brew install cocoapods && brew link --overwrite cocoapods
Verify your cocoapods version pod --version
This is probably happening because your computer has an older version of Ruby, so first update Ruby. This worked for Ruby 2.6.3+.
Open terminal and enter:
curl -L https://get.rvm.io | bash -s stable
Then:
rvm install ruby-2.6
This will install Ruby for you if it wasn't already installed, then update Ruby to the new version:
rvm use ruby-2.6.3
This will possibly fix your issue. You can now enter:
sudo gem install cocoapods
pod setup
If RVM is not installed in your system, then use:
$HOME/.rvm/scripts/rvm
rvm
The problem is resolved with next command: sudo apt install build-essential
This worked for me:
sudo apt-get install libmysqlclient-dev
Install RVM and use it to install Ruby 2.6.x:
curl -sSL https://get.rvm.io | bash
rvm install 2.6.x
rvm use ruby-2.6.x
Now try and it should work:
sudo gem install cocoapods
I'm installing the Ruby Nokogiri gem and finding the error below.
How to diagnose this and solve it?
# gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
...
/opt/ruby/1.9.3-p194/bin/ruby extconf.rb
checking for libxml/parser.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.
...
/opt/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do':
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/ruby/1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
...
To diagnose and solve, here's what worked for me.
To find out what failed, go to your ruby gems directory.
For example:
$ cd <MY RUBY DIRECTORY>/lib/ruby/gems/2.0.0/gems
If you don't know your gem directory, try this:
$ echo $GEM_HOME
/opt/gems/2.0.0
$ cd /opt/gems/2.0.0/gems
What version of nokogiri am I installing?
$ ls -ladg nokogiri-*
nokogiri-1.5.5
Go to the installer directory:
$ cd nokogiri-1.5.5/ext/nokogiri
Try installing manually:
$ ruby extconf.rb
Result:
checking for libxml/parser.h... *** extconf.rb failed ***
...
I'm using Ubuntu so I search for any similar packages:
$ aptitude search libxml
Results:
p libxml2 - GNOME XML library
p libxml2-dev - Development files for the GNOME XML library
...
I believe that libxml2 will work fine.
$ apt-get install libxml2
Ruby native gems often need the *-dev packages for headers so install them:
$ apt-get install libxml2-dev
Now do I have the parser file?
$ find / | grep libxml/parser.h
Yes, the result shows the parser:
/usr/include/libxml2/libxml/parser.h
Now try installing again, this time providing the libxml2 path:
$ gem install nokogiri -- --with-xml2-dir=/usr/include/libxml2
It still fails, so read the mkmf error log:
$ more mkmf.log
The error log shows what failed and has these lines that look promising:
package configuration for libxslt is not found
Is there a package for it?
$ aptitude search libxslt
Results:
v libxslt-dev
i libxslt-ruby
...
Install the dev package:
$ apt-get install libxslt-dev
Now try installing again, and also put xslt on the path:
$ gem install nokogiri -- \
--with-xml2-dir=/usr/include/libxml2 \
--with-xslt-dir=/usr/include/libxslt
Success!
Installing Nokogiri Website
'Installing Nokogiri' is a website dedicated to installing Nokogiri on the major platforms - Here is an excerpt about Installing Nokogiri on Ubuntu:
Because Nokogiri needs to be compiled and dynamically linked against
both libxml2 and libxslt, it has gained a reputation for being
complicated to install.
As of Nokogiri 1.6, libxml2 and libxslt source code is bundled with
Nokogiri, and compiled at gem-install-time. The instructions in this
document should work for all versions 1.6.4 and later.
Ubuntu / Debian
Installation should Just Work™ on Ubuntu and Debian using Nokogiri’s
vendored libxml2 and libxslt:
gem install nokogiri
[...]
Using Your System Libraries
If, instead of Nokogiri’s vendored libraries, you’d like to use your
system’s libxml2, libxslt and related libraries, please first
understand that you may be asking Nokogiri to work with an unsupported
version of libxml2.
sudo apt-get install pkg-config
gem install nokogiri -- --use-system-libraries
FYI - I am using Nokogiri 1.6.6.2 and it didn't 'just work'. I got it going with the --use-system-libraries.
Mac OS X
The website's advice also covers OS X - this worked for me:
gem update --system
xcode-select --install
gem install nokogiri
Conclusion
If you have a Nokogiri problem on any platform you should check out the website.
On CentOS here is what I needed to do:
gem update --system
yum install libxml2-devel libxslt-devel ruby-devel
gem install nokogiri -- --use-system-libraries
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.
You are probably missing zlib headers which are required for -lz flag in order to compile the sources correctly. Install on Linux by:
sudo apt-get install libz-dev
For missing libiconv, try installing libiconv-hook-dev package which has header files of libiconv-hook, e.g.
sudo apt-get install libiconv-hook1 libiconv-hook-dev
On OS X, try installing development tools via: xcode-select --install.
If there is still problem, check mkmf.log file for more specific details about your error.
On Ubuntu, try the following dependency fix combo:
sudo apt-get install gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev
The 'could not create Makefile' error you're seeing could also be because you haven't agreed to the Xcode license (you have to agree to it after each time you update Xcode). Running sudo xcodebuild -license accept should eliminate this error for you and allow you to then run gem install nokogiri successfully.
I am installing the rmagick gem on OSX 10.6.8, using gem install rmagick, and I am getting the following error
Can't install RMagick 2.13.1. Can't find MagickWand.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
--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/disaacs/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
Gem files will remain installed in /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Looking in the mkmf.log file I see
have_header: checking for wand/MagickWand.h... -------------------- no
"/usr/bin/gcc-4.2 -E -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/backward -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1 -I. conftest.c -o conftest.i"
conftest.c:3:29: error: wand/MagickWand.h: No such file or directory
It's true. The file MagickWand.h is not found in any of the directories specific by the -I directives of the gcc-4.2 command. Why not? And how can I fix this?
ImageMagick is installed, using homebrew. If I search my drive I find MagicWand.h installed in /usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/wand/MagickWand.h.
I've tried all the suggestions in Can't install RMagick 2.13.1. Can't find MagickWand.h., but none of them have worked.
Edit:
Another thing to note: I originally had ImagMagick 6.7.0-7 installed using MacPorts, and RMagick installed just fine. Except that it would not work with the CarrierWave gem. So I uninstalled MacPorts and uninstalled RMagick. Then reinstalled ImageMagick using brew install -f imagemagick --disable-openmp, and attempted to reinstall the rmagick gem (which brings me to my current problem). I restarted all terminals at each step, to ensure that my paths were refreshed.
For Debian-based (e.g., Ubuntu) systems you can try,
sudo apt-get install libmagickcore-dev libmagickwand-dev
gem install rmagick
it works for me.
found solution from ruby-forum
1) install by installer
http://cactuslab.com/imagemagick/
2) try gem install rmagick
if checking for wand/MagickWand.h... no
type
mdfind MagickWand.h
find some thing like
/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/wand/MagickWand.h
and type in terminal
C_INCLUDE_PATH=/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/ gem install rmagick
if, after that you have this error (because a had it) "Package MagickCore was not found in the pkg-config search path."
type
mdfind MagickCore.pc
find some thing like /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
and finally in terminal type:
PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick
Turns out the answer was in Can't install RMagick 2.13.1. Can't find MagickWand.h. after all. I had just followed the suggestion incorrectly.
C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick gem install rmagick
This installed rmagick gem successfully.
Unfortunately, rmagic is still not working with CarrierWave :-(, but that is a different problem altogether.
Here's a solution for OS X Mavericks - at least it worked for me...
First, install Xcode 5 (from the App Store)
Then install development-tools - open Terminal and type:
xcode-select install
Next, grab the ImageMagick package from CatusLab: http://cactuslab.com/imagemagick/
(I opted for the package without Freetype support, that requires XQuarz - but it's really up to you).
You'll need pgkconfg as well - get it here: http://macpkg.sourceforge.net
Once installed, export the pkgconfig binary:
export PATH=/opt/pkgconfig/bin:$PATH
Then find the MagickWand.h
mdfind MagickWand.h
it puts out the path to MagickWand.h, in my case /opt/ImageMagick/include/ImageMagick-6/wand/MagickWand.h
Next find the pkgconfig path:
mdfind MagickCore.pc
For me it put out: /opt/ImageMagick/lib/pkgconfig/MagickCore.pc
I had the problem that rmagick gem couldn't be fetched so I downloaded it from rubygems.org/gems/rmagick
With the rmagick gem downloaded to your Download folder you should now be able to install rmagick:
sudo C_INCLUDE_PATH=/opt/ImageMagick/include/ImageMagick-6/ PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install --local ~/Downloads/rmagick-2.13.2
For me it installed successfully - hope this helps...
I wasted a lot of time on this, ImageMagick versions above 6.7 don't play nicely with the installation of the rmagick gem. It looks like someone made a package to address this issue, try:
brew install imagemagick-ruby186
After uninstalling your previous imagemagick. Afterwards gem install rmagick worked fine for me.
I am on OS X El Capitan.
My app is using ruby 2.1.2 and rmagick 2.13.4.
When using brew install imagemagick I get ImageMagick -v 7.0.4-5.
The solution for me was to use brew install imagemagick#6 which gave me ImageMagick -v 6.9.7-5 which allowed me to successfully install the gem.
here's what i did on 16.04.1,
sudo apt-get install libmagickwand-dev
sudo apt-get install graphicsmagick-imagemagick-compat
and then install gem
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick -v '2.13.2'
I had a similar issue with running
$ gem install rmagick
then check the version by typing
$ convert --version
If you do, you probably either installed it with fink or macports (maybe homebrew?). What is happening is that rvm can't find the imagemagick directory.
After reading https://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install I exported the imagemagick path by adding
$ export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"
to my ~/.bash_profile, sourcing the new profile, then running gem install rmagick again.
this worked for me try
if the above solution doesnt work then try following command
sudo apt-get install libmagickwand-dev
this will help i hope.
The only thing that worked for me on OSX El Capitan (10.11.6) was cloning this repository:
https://github.com/zagros/imagemagick-rmagic-el-captian
And following compile steps for each library described on that github page, but with slight modification.
The imagemagick itself in stuff folder is already compiled and lacks configure script, so I took other image magick from stuff sierra extracted it and compiled, installed and after that gem install rmagick worked.
I want to install Octopress in my computer.
I try to do it like
Octopress document.
When I run
bundle install
I got error message
An error occured while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
So, I run
sudo gem install RedCloth -v '4.2.9'
then, I got a error message again:
ERROR: Error installing RedCloth:
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:1:in `<main>'
I hadn't learn any knowledge about ruby.
My ubuntu 12.04 solution is install the ruby1.9.1-full version, that can resolve this issue.
sudo apt-get install ruby1.9.1-full
you can execute command:
sudo update-alternatives --config ruby
to select the altiernative ruby which you have installed.
and then, execute below commands to finish the octopress deploy:
git clone https://github.com/erizhang/octopress.git octopress
cd octopress/
sudo gem install bundler
sudo gem install RedCloth -v '4.2.9'
bundle install
rake install
below commands you can find from octopress deploy guideline page:
rake setup_github_pages
sudo rake setup_github_pages
sudo rake generate
sudo rake deploy
Hope it's helpful for you, thanks
I was installing Octopress too and got the same problem as yours. After checking the mkmf.log file I figured out that gcc-4.2 had not been found. I Even installed xcode with the command line tools. It worked when I made a symlink like this:
$ sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
$ bundle install
I fixed this issue by running
sudo apt-get install ruby-dev
as described in this blog post.
You've probably upgraded to Mountain Lion and have not rebuilt your ruby-1.9.2 install yet with the new development packages.
rvm --force install 1.9.2
gem install bundle --no-ri --no-rdoc
bundle install
If you don't have the Mountain Lion dev packages installed correctly, use the ThoughtBot instructions.
For Ubuntu 14.04 simply do this:
sudo apt-get install ruby1.9.3
Should work for 13.10 and 13.04 too. (Not tested)
it apears you are not using rvm for managing your ruby installation. I think best would be to try rvm, here's a very good guide, you can stop without installing rails: ruby with rvm
Then simply
$gem install RedCloth
Unmanaged ruby gems are a pain, I try to avoid them.
None of the answers worked on my Ubuntu 14.04.1 LTS. Upgrade to ruby 2.0 fixed the problem for me:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo ln -s /usr/bin/ruby2.0 /usr/bin/ruby
sudo ln -s /usr/bin/gem2.0 /usr/bin/gem
sudo gem install bundler
Make sure you also have the build-essential package installed. You can check using
dpkg -l | grep build-essential
or simply install it without checking
sudo apt-get install build-essential
For me on Ubuntu 14.04.1 LTS, after making sure build-essential is installed, the bundle install command works/builds fine also with Ruby 1.9.3.
I'm trying to install PostgreSQL's pg gem for Ruby.
I issued the following command:
gem install pg
I installed Ruby 1.9.2 using RVM.
The above command shows me the following error.
The error is :
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/User/.rvm/rubies/ruby-1.9.2-preview3/bin/ruby extconf.rb
checking for pg_config... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/home/User/.rvm/rubies/ruby-1.9.2-preview3/bin/ruby
--with-pg
--without-pg
--with-pg-config
--without-pg-config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--enable-static-build
--disable-static-build
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
Gem files will remain installed in /home/user/.rvm/gems/ruby-1.9.2-preview3/gems/pg-0.9.0 for inspection.
Results logged to /home/user/.rvm/gems/ruby-1.9.2-preview3/gems/pg-0.9.0/ext/gem_make.out
I don't know what is the error...
You need install the postgreSQL dev package with header of PostgreSQL
sudo apt-get install libpq-dev
After reading and thrashing around for 2 days, and trying many things found in other notes the following single line was the cure for me on Ubuntu Lucid 10.04 mixed with some Maverick packages and RVM (ruby 1.9.2-p290, rvm 1.10.2 rubygems 1.8.15, rails 3.0.1, postgres 8.4.10) :
gem install pg -- --with-pg-lib=/usr/lib
the result:
Building native extensions. This could take a while...
Successfully installed pg-0.13.1
1 gem installed
Installing ri documentation for pg-0.13.1...
Installing RDoc documentation for pg-0.13.1...
{yea - finally success} !!
!note that the output from running pg_config lacks the item -lpq in the LIBS variable on my Ubuntu / Postresql install!!
and why the switch from pq to pg in certain places -- confusing to newbie ??
the thing I still do not understand is the double set of -- and --with(option
but I'm way beyond my depth anyway
In Ubuntu this works for me, I hope help you:
sudo apt-get install libpq-dev
and
gem install pg -- --with-pg-lib=/usr/lib
I'm on Ubuntu 12.10 and running this command:
apt-get install libpq-dev
helped me - after that ran gem install pg -v "0.14.1", and all good now
Installing libpq-dev did not work for me. I also needed to install build-essential
sudo apt-get install libpq-dev build-essential
Need to add package
sudo apt-get install libpq-dev
to install pg gem in RoR
Simple solution for ubuntu users...
First uninstall all postgres packages, then run these commads...
sudo apt-get install postgresql
sudo apt-get install postgresql-client libpq5 libpq-dev
# for rvm (single user)
mv ~/.rvm/usr/lib ~/.rvm/usr/lib_rvm
# for rvm (multi-user)
mv /usr/local/rvm/usr/lib /usr/local/rvm/usr/lib_rvm
gem install pg -- --with-pg-lib=/usr/lib
Then run 'bundle install'. Every thing will be fine. Have a good day!
sudo apt-get install postgresql-client libpq5 libpq-dev then do gem install pg
For .RVM users it will be better:
rvmsudo gem install pg -- --with-pg-lib=/usr/lib
it worked for me (after i saw jdupont version)
If you have libpq-dev installed and are still having this problem it is likely due to conflicting versions of OpenSSL's libssl and friends - the Ubuntu system version in /usr/lib (which libpq is built against) and a second version RVM installed in $HOME/.rvm/usr/lib (or /usr/local/rvm/usr/lib if it's a system install). You can verify this by temporarily renaming $HOME/.rvm/usr/lib and seeing if "gem install pg" works.
To solve the problem have rvm rebuild using the system OpenSSL libraries (you may need to manually remove libssl.* and libcrypto.* from the rvm/usr/lib dir):
rvm reinstall 1.9.3 --with-openssl-dir=/usr
This finally solved the problem for me on Ubunto 12.04.
Try this
sudo apt-get install postgresql postgresql-contrib libpq-dev
You should install PG Database server in the first place to install clients. Afterwards, you install clients.
See this blog post to know about setting up PostGresSQL for the first time for Ruby on Rails development.
This solved the problem for me on Ubuntu 12.04 after every suggestion here had failed.
rvmsudo gem install pg -v '0.12.2' -- --with-pg-lib=/usr/include/postgresql
I was trying to setup a Rails project in my freshly installed Ubuntu 16.04. I ran into the same issue while running bundle. Running
sudo apt-get install aptitude
followed by
sudo apt-get install libpq-dev
Solved it for me.
For anyone who is still having issues after trying all the answers on this page, the following (finally) worked:
sudo apt-get install libgmp3-dev
gem install pg
This was after doing everything else mentioned on this page.
postgresql 9.5.8
Ubuntu 16.10
Another solution to this problem is to install PostgreSQL using Homebrew/linuxbrew:
brew install postgresql
As a matter of habit I don't like to use sudo unless I have to.
For those trying to install Redmine, I missed sudo apt-get install ruby-all-dev after trying all of the above.
Initial error being mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h.
I had the same problem, and tried a lot of different variants. After some tries I became able to sudo gem install, but still have problem to install it without sudo.
Finally I found a decission - reinstalling of rvm helped me. Probably it can save time somebody else.
apt-get install ruby-dev worked for me.
Another option is to use Homebrew which works on Linux and macOS to install just the supporting libraries:
brew install libpq
then
brew link libpq --force
(the --force option is required because it conflicts with the postgres formula.)