Failed to build gem native extension when install RedCloth-4.2.9 install Linux
Asked Answered
S

8

20

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.

Savona answered 25/8, 2012 at 4:25 Comment(1)
What GNU have you? Have you build dev package for Ruby.Acromegaly
T
11

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.

Taut answered 28/8, 2012 at 14:8 Comment(0)
S
29

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

Silverts answered 16/1, 2013 at 8:12 Comment(1)
This also just worked on a fresh Terminal.com Debian 7.0 (Wheezy) terminal. Hurray! (Just started playing with Terminal.com. Hurray!)Reprehension
D
20

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
Detain answered 28/9, 2012 at 15:53 Comment(3)
This worked for me, but only after I acquired gcc-4.2 in the first place. To do that: brew tap homebrew/dupes && brew install apple-gcc42. Credit.Frizzly
If apple-gcc42 is missing Install the Command Line Tools (Xcode 4.3). XCode -> Preferences -> Downloads, Click the Components button, and then click Install next to the "Command Line Tools".Banana
Works for Mavericks. OS X 10.9.Binal
M
19

I fixed this issue by running

sudo apt-get install ruby-dev

as described in this blog post.

Magdamagdaia answered 15/5, 2014 at 16:37 Comment(3)
This solved the problem for me on Linux Mint 17 (based on Ubuntu 14.04).Canvas
See also #13768225. Not having the ruby-dev package installed seems to be a common cause for this install error.Presbyterial
Solved the issue for me as wellKorwun
T
11

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.

Taut answered 28/8, 2012 at 14:8 Comment(0)
C
6

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)

Caprifoliaceous answered 3/6, 2014 at 17:47 Comment(2)
I'd do that as install ruby1.9.3. The space in there allows for some confusion.Alisaalisan
@EricAnderson The space has been removed. Thank you.Caprifoliaceous
T
1

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.

Tarboosh answered 28/4, 2013 at 7:33 Comment(0)
A
0

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
Adlare answered 15/10, 2014 at 13:15 Comment(0)
S
0

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.

Saki answered 29/10, 2014 at 2:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.