error occurred while installing rice gem-Collection of common programming errors

I’m trying to install rice gem via ruby 1.9.3 in ubuntu 12.4 but I get:

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

I tried to install libs below but it didn’t worke for me:

sudo apt-get install libmapnik libmapnik-dev mapnik-utils python-mapnik

this is the complete exception that I get:

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

    /home/vagrant/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb 
extconf.rb:20:in `': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:20:in `': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:20:in `': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:25:in `': Use RbConfig instead of obsolete and deprecated Config.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
-e:1:in `': Use RbConfig instead of obsolete and deprecated Config.
...
-e:1:in `': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `': Use RbConfig instead of obsolete and deprecated Config.
-e:1:in `': uninitialized constant CONFIG (NameError)
checking for ruby.h... yes
checking for node.h... no
checking for ruby/node.h... no
checking for version.h... no
checking for env.h... no
checking host system type... (cached) x86_64-unknown-linux-gnu
checking for doxygen... no
configure: WARNING: doxygen not found - will not generate any doxygen documentation
checking for perl... /usr/bin/perl
configure: creating ./config.status
config.status: creating Makefile
config.status: creating rice/Makefile
config.status: creating test/Makefile
config.status: creating sample/Makefile
config.status: creating ruby/Makefile
config.status: creating ruby/lib/Makefile
config.status: creating test/ext/Makefile
config.status: creating ruby/lib/mkmf-rice.rb
config.status: creating rice/detail/ruby_version_code.hpp
config.status: creating rice/config.hpp
config.status: rice/config.hpp is unchanged
config.status: executing depfiles commands

make "DESTDIR=" clean
Making clean in ruby
make[1]: Entering directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/ruby'
Making clean in lib
make[2]: Entering directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/ruby/lib'
make[2]: Nothing to be done for `clean'.
make[2]: Leaving directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/ruby/lib'
Making clean in .
make[2]: Entering directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/ruby'
make[2]: Nothing to be done for `clean-am'.
make[2]: Leaving directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/ruby'
make[1]: Leaving directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/ruby'
Making clean in sample
make[1]: Entering directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/sample'
/home/vagrant/.rvm/rubies/ruby-2.1.0/bin/ruby -I/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/ruby/lib -C enum extconf.rb --with-cppflags="-I/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2" --with-libpath="/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/rice"
checking for main() in -lrice... no
*** 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/vagrant/.rvm/rubies/ruby-2.1.0/bin/ruby
    --with-libpath
    --with-libpath
    --with-ricelib
    --without-ricelib
/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/ruby/lib/mkmf-rice.rb:79:in `init_mkmf_rice': unhandled exception
    from /home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/ruby/lib/mkmf-rice.rb:215:in `'
    from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from extconf.rb:1:in `'
make[1]: *** [enum/Makefile] Error 1
make[1]: Leaving directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/sample'
make: *** [clean-recursive] Error 1

make "DESTDIR="
Making all in rice
make[1]: Entering directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/rice'
make  all-am
make[2]: Entering directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/rice'
g++ -DHAVE_CONFIG_H -I.  -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -fPIC -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -MT Class.o -MD -MP -MF .deps/Class.Tpo -c -o Class.o Class.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
mv -f .deps/Class.Tpo .deps/Class.Po
g++ -DHAVE_CONFIG_H -I.  -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -fPIC -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -MT Data_Type.o -MD -MP -MF .deps/Data_Type.Tpo -c -o Data_Type.o Data_Type.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
mv -f .deps/Data_Type.Tpo .deps/Data_Type.Po
g++ -DHAVE_CONFIG_H -I.  -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -fPIC -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -MT Director.o -MD -MP -MF .deps/Director.Tpo -c -o Director.o Director.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
mv -f .deps/Director.Tpo .deps/Director.Po
g++ -DHAVE_CONFIG_H -I.  -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -fPIC -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -MT Exception.o -MD -MP -MF .deps/Exception.Tpo -c -o Exception.o Exception.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
mv -f .deps/Exception.Tpo .deps/Exception.Po
g++ -DHAVE_CONFIG_H -I.  -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -fPIC -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -MT Identifier.o -MD -MP -MF .deps/Identifier.Tpo -c -o Identifier.o Identifier.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
mv -f .deps/Identifier.Tpo .deps/Identifier.Po
g++ -DHAVE_CONFIG_H -I.  -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -fPIC -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -MT Module.o -MD -MP -MF .deps/Module.Tpo -c -o Module.o Module.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
mv -f .deps/Module.Tpo .deps/Module.Po
g++ -DHAVE_CONFIG_H -I.  -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -fPIC -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -MT Object.o -MD -MP -MF .deps/Object.Tpo -c -o Object.o Object.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
mv -f .deps/Object.Tpo .deps/Object.Po
g++ -DHAVE_CONFIG_H -I.  -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -fPIC -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -MT String.o -MD -MP -MF .deps/String.Tpo -c -o String.o String.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
mv -f .deps/String.Tpo .deps/String.Po
g++ -DHAVE_CONFIG_H -I.  -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -fPIC -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0 -I/home/vagrant/.rvm/rubies/ruby-2.1.0/include/ruby-2.1.0/x86_64-linux -MT Struct.o -MD -MP -MF .deps/Struct.Tpo -c -o Struct.o Struct.cpp
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from Hash.hpp:207:0,
                 from Struct.hpp:5,
                 from Struct.cpp:1:
Hash.ipp: In member function ‘Rice::Hash::Iterator& Rice::Hash::Iterator::operator++()’:
Hash.ipp:221:18: error: ‘st_table’ has no member named ‘bins’
Hash.ipp: In member function ‘Rice::Hash::iterator Rice::Hash::begin()’:
Hash.ipp:289:34: error: ‘st_table’ has no member named ‘bins’
Hash.ipp: In member function ‘Rice::Hash::const_iterator Rice::Hash::begin() const’:
Hash.ipp:296:40: error: ‘st_table’ has no member named ‘bins’
make[2]: *** [Struct.o] Error 1
make[2]: Leaving directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/rice'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2/rice'
make: *** [all-recursive] Error 1

make failed, exit code 2

Gem files will remain installed in /home/vagrant/.rvm/gems/ruby-2.1.0/gems/rice-1.4.2 for inspection.
Results logged to /home/vagrant/.rvm/gems/ruby-2.1.0/extensions/x86_64-linux/2.1.0/rice-1.4.2/gem_make.out

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

Any help?