简体   繁体   中英

Cannot install rails gem on ruby 2.3.1

I am trying to install rails on ruby 2.3.1.

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

Ruby installed.

$ rvm -v
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

RVM exists.

$ gem install rails
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.1/gems/nokogiri-1.7.0.1/ext/nokogiri
/usr/local/rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170227-6774-1l4uc6c.rb extconf.rb
Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170227-6774-1l4uc6c.rb extconf.rb 2>&1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.1/gems/nokogiri-1.7.0.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.1/extensions/x86_64-linux/2.3.0/nokogiri-1.7.0.1/gem_make.out

When I call gem list, I don't see nokogari nor rails. $ gem list

 *** LOCAL GEMS ***
...
minitest (5.8.3)
net-telnet (0.1.1)
pg (0.19.0)
power_assert (0.2.6)
psych (2.0.17)
rack (2.0.1)
rack-test (0.6.3)
raindrops (0.17.0)
rake (10.4.2)
rdoc (4.2.1)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.1.5)
...

I donot know what is wrong.

follow instruction here (ignore the japanes, just use the code! http://qiita.com/riocampos/items/43b55ba06e6c3ec01b82

$ brew update

$ brew install libxml2

$ brew link --force libxml2

$ gem install nokogiri -- --use-system-libraries

in case of problems use sudo:

sudo gem install nokogiri -- --use-system-libraries libxml2

guess System 10.2.3 uses incompatible libxml2, so forced linking to the «outdated» libxml2 installed with homebrew does the job.

The same work around with libxml2 is also needed for sqlite3 byebug ie

$ sudo gem install byebug -- --use-system-libraries libxml2

that means: when ever you meet the error-information: couldn't understand kern.osversion `16.4.0' cc1: error: unrecognized command line option "-Wdivision-by-zero"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM