安装ruby-netcdf时出现问题

时间:2014-04-13 00:29:26

标签: ruby netcdf

在Mavericks上,我无法使用ruby-netcdf来安装和使用我的机器。一直关注这些博文:

https://andrewsturges.blogspot.com/2011/03/how-to-use-rubynetcdf-to-read-netcdf.html

https://andrewsturges.blogspot.com/2011/03/how-to-install-rubynetcdf-on-ubuntu_24.html

RailsApps $ gem install ruby-netcdf
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-netcdf:
ERROR: Failed to build gem native extension.

/Users/blanecordes/.rvm/rubies/ruby-1.9.3-p545/bin/ruby extconf.rb 
*** 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
--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=/Users/blanecordes/.rvm/rubies/ruby-1.9.3-p545/bin/ruby
extconf.rb:4:in `<main>': uninitialized constant Gem::GemPathSearcher (NameError)

extconf failed, exit code 1

Gem files will remain installed in /Users/blanecordes/.rvm/gems/ruby-1.9.3-p545/gems/ruby-    netcdf-0.6.6.1 for inspection.
Results logged to /Users/blanecordes/.rvm/gems/ruby-1.9.3-p545/extensions/x86_64-darwin-13/1.9.1/ruby-netcdf-0.6.6.1/gem_make.out

2 个答案:

答案 0 :(得分:1)

与ruby 2.2.0相同的问题(使用rvm) 它不仅适用于MacOS,也适用于Fedora

$ gem install ruby-netcdf

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-netcdf:
    ERROR: Failed to build gem native extension.


 /home/user/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150128-5543-74d90a.rb extconf.rb
*** 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/user/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
extconf.rb:4:in `<main>': uninitialized constant Gem::GemPathSearcher (NameError)

extconf failed, exit code 1

Gem files will remain installed in /home/user/.rvm/gems/ruby-2.2.0@testnetcdf/gems/ruby-netcdf-0.6.6.1 for inspection.
Results logged to /home/user/.rvm/gems/ruby-2.2.0@testnetcdf/extensions/x86_64-linux/2.2.0/ruby-netcdf-0.6.6.1/gem_make.out

答案 1 :(得分:0)

在Ubuntu上,您需要安装libnetcdf-dev

sudo apt install libnetcdf-dev
gem install ruby-netcdf