2012-01-19 85 views
17

可能重複安裝Ruby 1.9.3:
Ruby 1.9.2 and Rails 3 cannot open rails console使用RVM在Ubuntu

我已經安裝了RVM和Ruby 1.9.2,無論是正常工作。使用rvm版本1.10.2。我之前安裝了rvm軟件包readline/zlib,但現在我在使用readline時遇到了很大的麻煩。我試圖在rvm中安裝ruby 1.9.3,但我總是最終沒有找到readline。

我試圖按照不同的解決方案:

rvm remove 1.9.3 
rvm pkg install readline 
rvm install 1.9.3 --with-readline-dir=$rvm_path/usr/ \ 
    --with-zlib-dir=$rvm_path/usr/ 

rvm use 1.9.3 
rvmsudo gem install bundler 
bundle install (all gems installed fine) 
rails c/rails s 
.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/completion.rb:9:in `require': \ 
    cannot load such file -- readline (LoadError) 

我有libreadline-DEV(第6版,當前的)安裝(一切由那些包非常需要)

我也試過以下:當然不是產生

.rvm/src/ruby-1.9.3-p0/ext/readline]$ ruby extconf.rb 
checking for tgetnum() in -lncurses... yes 
checking for readline/readline.h... yes 
checking for readline/history.h... yes 
checking for readline() in -lreadline... no 
checking for readline() in -ledit... no 
checking for editline/readline.h... no 

.rvm/src/ruby-1.9.3-p0/ext/readline]$ ruby extconf.rb \ 
    --with-readline-dir=/home/claudiocontin/.rvm/usr/ 
checking for tgetnum() in -lncurses... yes 
checking for readline/readline.h... yes 
checking for readline/history.h... yes 
checking for readline() in -lreadline... no 
checking for readline() in -ledit... no 
checking for editline/readline.h... no 

.rvm/src/ruby-1.9.3-p0/ext/readline]$ ruby extconf.rb \ 
    --with-readline-lib=/home/claudiocontin/.rvm/usr/ 
checking for tgetnum() in -lncurses... yes 
checking for readline/readline.h... yes 
checking for readline/history.h... yes 
checking for readline() in -lreadline... no 
checking for readline() in -ledit... no 
checking for editline/readline.h... no 

的Makefile ...

apt-get install libreadline-dev 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
libreadline-dev is already the newest version. 

想法?

回答

12

我最終什麼事做的是從RVM USR刪除所有libreadline/lib /路徑。

已安裝libreadline5-dev軟件包(本例中是.deb)手動下載,因爲新的ubuntu發行版只有libreadline6-dev作爲候選軟件。

去RVM紅寶石1.9.3 src和:

ruby extconf.rb --with-editline-dir=/usr/ --with-readline-dir=/usr/ 
make 
sudo make install 

現在就像一個魅力。

很痛苦的東西:)

編輯:

也請記住,現在的ReadLine還採用libeditline-dev的,你可以手動禁用時配置紅寶石的readline,路過:--disable-libedit

ruby extconf --disable-libedit 
+0

如何在ubuntu 12.04上手動安裝libreadline5-dev?網上沒有太多關於這個。 – user938363

+0

@ user938363 apt-get install就像這樣:'sudo apt-get install libreadline5-dev'然後按照上圖所示進行編譯。 –

5

我一直髮現讓​​RVM能很好地與軟件包一起玩,成爲一種巫術。很多時候,它是關於醒目的依賴 - 我放在一起,我已經在過去有運氣的腳本,試試這個:

sudo apt-get install zlib1g-dev libssl-dev libsqlite3-dev libmysqlclient-dev imagemagick librmagick-ruby libxml2-dev libxslt1-dev build-essential openssl libreadline6 libreadline6-dev zlib1g libyaml-dev libsqlite3-0 sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison libpq-dev libpq5 libmysql-ruby libmysqlclient-dev 

rvm pkg install autoconf 
rvm pkg install zlib 
rvm pkg install readline 
rvm pkg install openssl 
rvm pkg install iconv 
rvm install 1.9.3 
rvm use 1.9.3 --default 
+0

沒有運氣。仍然一樣... – CLod

+0

爲我工作,bur爲[rbenv](https://github.com/sstephenson/rbenv) – fluxsaas

+0

嘗試運行'rvm requirements'以獲取應該出現的包列表。 –

45

我試圖做rvm pkg readline,安裝ubuntu pkgs等沒有任何成功。什麼工作對我來說:

gem install rb-readline 

和下面的行添加到您的Gemfile:

gem 'rb-readline' 
+1

這也適用於我 –

+0

非常感謝!我在這裏嘗試了每個解決方案,並且在rvm頁面中嘗試了每個解決方案,但沒有運氣一直試圖讓這個工作幾個小時吧!這很好。再次感謝! – AyJay

+0

+1非常適合建立readline。我之前已經安裝了數百個來自源代碼庫的庫,但無法獲得在特定機器上構建的readline擴展。 – Kelvin