最近配置jekyll博客,需要安装rdiscount,我的环境是ubuntu 13.04,安装时出现错误,复制如下:
root@shawn-GA-880G-UD3H:/home/shawn# gem install rdiscount
Building native extensions. This could take a while...
native extensions. This could take a while...
ERROR: Error installing rdiscount:
ERROR: Failed to build gem native extension./usr/bin/ruby1.9.1 extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:
in `require': cannot load such file -- mkmf (LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:
in 'require' from extconf.rb:1:in '< main >'Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/rdiscount-2.0.7.3 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/rdiscount-2.0.7.3/ext/gem_make.out
解决方案
安装ruby1.9.1-dev,再安装rdiscount:
sudo apt-get install ruby1.9.1-dev
gem install rdiscount
root@shawn-GA-880G-UD3H:/home/shawn# sudo apt-get install ruby1.9.1-dev
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列【新】软件包将被安装:
ruby1.9.1-dev
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 349 个软件包未被升级。
需要下载 1,223 kB 的软件包。
解压缩后会消耗掉 3,486 kB 的额外空间。
获取:1 http://cn.archive.ubuntu.com/ubuntu/ raring/main ruby1.9.1-dev i386 1.9.3.194-8.1ubuntu1 [1,223 kB]
下载 1,223 kB,耗时 1分 11秒 (17.1 kB/s)
Selecting previously unselected package ruby1.9.1-dev.
(正在读取数据库 ... 系统当前共安装有 172590 个文件和目录。)
正在解压缩 ruby1.9.1-dev (从 .../ruby1.9.1-dev_1.9.3.194-8.1ubuntu1_i386.deb) ...
正在设置 ruby1.9.1-dev (1.9.3.194-8.1ubuntu1) ...
root@shawn-GA-880G-UD3H:/home/shawn# gem install rdiscount
Building native extensions. This could take a while...
Successfully installed rdiscount-2.0.7.3
Installing ri documentation for rdiscount-2.0.7.3
1 gem installed