2014-04-22 22 views
4

我的目標是使用libmspack。它依賴於ffi編譯器,我分叉ffi編譯器,添加一些自定義代碼,並且我希望libmspack使用我的修改版本。 我有一個簡單的Gemfile:嘗試使用分叉寶石時Gem :: LoadError

source 'http://rubygems.org' 

gem 'ffi-compiler', :github =>'survili/ffi-compiler' 
gem 'libmspack' 

當運行「捆綁安裝」,安裝「FFI編譯」完成不錯,但「libmspack」安裝失敗,錯誤,它無法找到「FFI編譯'(LoadError:無法加載這樣的文件 - ffi-compiler/compile_task)

我注意到如果我從Gemfile中刪除'libmspack'精細。

有人可以解釋,什麼是實現我的目標,導致libmspack使用自定義ffi編譯器寶石的正確方法?

我發現這個職位的SO,它要求相同,但一直無人接聽:Gem::LoadError when using a git repo in Gemfile

預先感謝您

------束輸出(RVM使用空寶石) -------

jackju at macbook-air ~/tmp/delme1 
$ rvm use [email protected] --create 
ruby-2.1.1 - #gemset created /home/jackju/.rvm/gems/[email protected] 
ruby-2.1.1 - #generating stackoverproblem wrappers........... 
Using /home/jackju/.rvm/gems/ruby-2.1.1 with gemset stackoverproblem 
jackju at macbook-air ~/tmp/delme1 
$ rvm current 
[email protected] 
jackju at macbook-air ~/tmp/delme1 
$ vim Gemfile 

[1]+ Stopped     vim Gemfile 
jackju at macbook-air ~/tmp/delme1 
$ rvm current 
[email protected] 
jackju at macbook-air ~/tmp/delme1 
$ gem list 

*** LOCAL GEMS *** 

bigdecimal (1.2.4) 
bundler (1.5.3) 
bundler-unload (1.0.2) 
executable-hooks (1.3.1) 
gem-wrappers (1.2.4) 
io-console (0.4.2) 
json (1.8.1) 
minitest (4.7.5) 
psych (2.0.3) 
rake (10.1.0) 
rdoc (4.1.0) 
rubygems-bundler (1.4.2) 
rvm (1.11.3.9) 
test-unit (2.1.1.0) 
jackju at macbook-air ~/tmp/delme1 
$ bundle 
Fetching git://github.com/survili/ffi-compiler.git 
remote: Reusing existing pack: 260, done. 
remote: Counting objects: 5, done. 
remote: Compressing objects: 100% (5/5), done. 
remote: Total 265 (delta 2), reused 0 (delta 0) 
Receiving objects: 100% (265/265), 38.59 KiB | 0 bytes/s, done. 
Resolving deltas: 100% (116/116), done. 
Fetching gem metadata from http://rubygems.org/......... 
Fetching additional metadata from http://rubygems.org/.. 
Resolving dependencies... 
Installing rake (10.3.1) 
Installing ffi (1.9.3) 
Using ffi-compiler (0.1.4) from git://github.com/survili/ffi-compiler.git (at master) 

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    /home/jackju/.rvm/rubies/ruby-2.1.1/bin/ruby -rubygems /home/jackju/.rvm/gems/[email protected]/gems/rake-10.3.1/bin/rake RUBYARCHDIR=/home/jackju/.rvm/gems/[email protected]/extensions/x86_64-linux/2.1.0/libmspack-0.0.4 RUBYLIBDIR=/home/jackju/.rvm/gems/[email protected]/extensions/x86_64-linux/2.1.0/libmspack-0.0.4 
rake aborted! 
LoadError: cannot load such file -- ffi-compiler/compile_task 
/home/jackju/.rvm/gems/[email protected]/gems/libmspack-0.0.4/ext/Rakefile:1:in `<top (required)>' 
(See full trace by running task with --trace) 

rake failed, exit code 1 

Gem files will remain installed in /home/jackju/.rvm/gems/[email protected]/gems/libmspack-0.0.4 for inspection. 
Results logged to /home/jackju/.rvm/gems/[email protected]/extensions/x86_64-linux/2.1.0/libmspack-0.0.4/gem_make.out 
An error occurred while installing libmspack (0.0.4), and Bundler cannot 
continue. 
Make sure that `gem install libmspack -v '0.0.4'` succeeds before bundling. 
jackju at macbook-air ~/tmp/delme1 
$ ls 
Gemfile 
jackju at macbook-air ~/tmp/delme1 
$ 
+0

聽起來像的ffi-叉您使用的編譯器可能與libmspack期望的版本不兼容。也許你需要將早期版本的ffi-compiler與libmspack一起使用? –

+0

@GregBurghardt - 不,這不是問題。它是兼容的。 –

+0

也許gem'ffi-compiler',::github =>'manycolors/ffi-compiler',require:「ffi-compiler」 –

回答

2

的問題是缺少這是在此發現的寶石 '的rubygems /任務':https://github.com/postmodern/rubygems-tasks

我能夠按照以下步驟在我的機器上安裝libmspack:

  1. 創業板安裝的rubygems任務

  2. 混帳克隆[email protected]:survili/FFI-compiler.git

  3. CD FFI編譯

  4. Rake構建寶石

  5. 寶石安裝PKG/FFI編譯-0.1.4.gem

  6. 寶石安裝libmspack -v '0.0.4'

Successfully installed libmspack-0.0.4 
1 gem installed 
+0

您上面描述的流程有效,我會接受您的答案。但是我會很高興,如果你可以解釋爲什麼如果我在gemfile中添加gem'rubygems-tasks',在ffi-compiler之前,bundle仍然會失敗。即使我gem安裝'rubygems-tasks'並在我原始的Gemfile上運行bundle(來自問題),它仍然會失敗。就好像它只有在我將本地克隆寶石打包並且逐一安裝時纔會通過 –

+0

這很奇怪。另外,gem列表不會在列表中顯示'ffi-compiler'。我不得不再次手工安裝ffi-compiler:gem install ffi-compiler --source「https://github.com/survili/ffi-compiler.git」在列表中顯示此gem。但是現在,由於ffi-compiler/compile_task#33中的其他問題,libmspack安裝也再次失敗。 –

+0

將很好理解它背後的原因。你目前的答案最終允許安裝寶石,但它並不實際。我想在Gemfile中運行它,然後運行bundle(而不是創建一個很長的README文件..) –