
我在 CentOS 5.3 上運行 Ruby 1.9.3。我透過從原始碼編譯 Ruby 1.9.3 以及 libyaml 來安裝它。我還使用 rbenv 來管理版本,因此我將編譯的安裝放在 ~/.rbenv/versions/1.9.3-p286 中,這是 rbenv 保存 Ruby 版本的地方。
一切都很順利,我現在正在安裝 Gems。然而,特別是有一個 gem 尚未安裝,這讓我覺得我可能缺少依賴項。它是一個內部 gem,因此未在 RubyGems 上列出,但以下是 gem 安裝的輸出:
Building native extensions. This could take a while...
ERROR: Error installing vmc-helper:
ERROR: Failed to build gem native extension.
/home/fs/.rbenv/versions/1.9.3-p286/bin/ruby extconf.rb
checking for expat.h... no
checking for xmlparse.h... 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.
我是 Debian 人員,所以對 Redhat/RPM 軟體包等方面確實沒有那麼豐富的經驗,所以我不確定我的系統上缺少哪些依賴項來安裝這個 Gem。
誰能幫助我知道我需要為上面缺少的這些缺少的頭檔安裝哪些軟體包?
答案1
尋找遺失的文件:
checking for expat.h... no
checking for xmlparse.h... no
現在使用yum
搜尋提供這些文件的套件:
yum provides */expat.h
您會在這裡看到多個包。您正在尋找的目錄是/usr/include/expat.h
包含標準包含目錄的目錄。因此,安裝指定的套件:
yum install expat-devel
對另一個文件重複此過程:
yum provides */xmlparse.h
在這裡你會失敗並得到錯誤No matches found
。在這種情況下,您需要閱讀 gem 原始程式碼或聯絡其開發人員以找出他/她想要您擁有的套件。它應該作為系統要求列在 gem 的文檔中(如果開發人員費心編寫文件)。