11

I have installed ruby 1.9.3p327 & rails 3.2.8 using rvm on centos 6.3. But while doing bundle install for a particular project folder, the process fails in between when it tries to install gem unf_ext 0.0.5 and throws following error,

Installing unf_ext (0.0.5) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/home/rradmin/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb -fPIC
checking for main() in -lstdc++... yes
checking for ruby/encoding.h... yes
creating Makefile

make
compiling unf.cc
cc1plus: warning: command line option "-Wdeclaration-after-statement" is valid for C/ObjC but not for C++
cc1plus: warning: command line option "-Wimplicit-function-declaration" is valid for C/ObjC but not for C++
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/vector:61,
from unf/normalizer.hh:4,
from unf.cc:1:
.....
....
...

Gem files will remain installed in /home/rradmin/.rvm/gems/ruby-1.9.3-p327@r32/gems/unf_ext-0.0.5 for inspection. Results logged to /home/rradmin/.rvm/gems/ruby-1.9.3-p327@r32/gems/unf_ext-0.0.5/ext/unf_ext/gem_make.out

An error occurred while installing unf_ext (0.0.5), and Bundler cannot continue. Make sure that gem install unf_ext -v '0.0.5' succeeds before bundling.

I also tried to install unf_ext separately as mentioned above, but got the same error. I have referred https://github.com/cowboyd/therubyracer/issues/135, but still not able to solve the problem. Please let me know proper way to solve this problem.

Thank you.

fancyPants
  • 50,732
  • 33
  • 89
  • 96
Sachin Kadam
  • 265
  • 2
  • 12

4 Answers4

21

On Ubuntu I only needed to do

sudo apt-get install build-essential

to fix this.

(for the record I'm on a freshly-built Ubuntu 12.10 Server X64)

Dominic Sayers
  • 1,783
  • 2
  • 20
  • 26
1

This error comes when you don't have supporting libraries to compile the gem try to install the following packages

sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core     zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison

then do a bundle install

yednamus
  • 582
  • 1
  • 4
  • 22
  • Thanks Suman. I am using centos 6.3 and i have already used rvmsudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel for getting the supporting libraries. Still i tried your command using yum but lot of libraries are missing. Does this command differs based on OS ? – Sachin Kadam Dec 12 '12 at 09:22
  • yes it differs you need to find appropriate packages in centos 6.3 try to install libreadline6 libreadline6-dev packages it may fix your problem – yednamus Dec 12 '12 at 10:21
1

I resolved the issue by installing libstdc++-devel using yum install gcc-c++ libstdc++-devel

user3194532
  • 687
  • 7
  • 7
0

Thanks Suman. But I resolved the issue by installing libstdc++-devel using yum install gcc-g++ libstdc++-devel.

Sachin Kadam
  • 265
  • 2
  • 12