2015-08-09 64 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