2015-08-09 65 views
0

我想在jruby项目中使用SQLite3。优胜美地-SQLite3 gem安装错误 - 不支持C扩展

gem install SQLite3 

命令失败,

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

    /Users/h1k3n/.rvm/rubies/jruby-9.0.0.0/bin/jruby -r ./siteconf20150809-4559-7o84f5.rb extconf.rb 
NotImplementedError: C extensions are not supported 
    <top> at /Users/h1k3n/.rvm/rubies/jruby-9.0.0.0/lib/ruby/stdlib/mkmf.rb:1 
    require at org/jruby/RubyKernel.java:940 
    (root) at /Users/h1k3n/.rvm/rubies/jruby-9.0.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1 
    <top> at extconf.rb:3 

extconf failed, exit code 1 

Gem files will remain installed in /Users/h1k3n/.rvm/gems/jruby-9.0.0.0/gems/sqlite3-1.3.10 for inspection. 
Results logged to /Users/h1k3n/.rvm/gems/jruby-9.0.0.0/extensions/universal-java-1.8/2.2.0/sqlite3-1.3.10/gem_make.out 

gcc版本

which gcc => /usr/bin/gcc 

试图安装SQLite3的

brew instal SQLite3 => Warning: sqlite-3.8.11 already installed 

SQLite3的版本安装

which SQLite3 => ~/Android/sdk/platform-tools/sqlite3 

我认为这是罪魁祸首。它可能指向SQLite3的Android版本而不是系统版本,这就是为什么它无法构建本地扩展。

回答

1

您似乎在使用JRuby,而不是标准的Ruby实现Ruby MRI

SQLite3 gem依赖于Ruby的C扩展,但不同的标准执行,JRuby does not support Ruby C extensions

的JRuby 1.6之前的版本不支持Ruby的C扩展,甚至1.6的支持是“发展”仍然并考虑实验。截至1.7,它已被禁用,并可能会be removed

上面的文章列出了对替代宝石的建议,包括SQLite3。

+0

有时候,Google不幸地让我们失望......我猜这个标记是错误的(Ruby),因为这似乎是一个JRuby的事情,但是在我看来,这并不是什么问题。 TY。 当我有时间时,我会尝试替代,如果是这种情况,我会接受你的答案。 – gemantzu