简体   繁体   English

尝试使用forked gem时Gem :: LoadError

[英]Gem::LoadError when trying to use forked gem

My goal is to use libmspack. 我的目标是使用libmspack。 It depends on ffi-compiler, I've forked ffi-compiler, to add some custom code, and I want libmspack to use my modified version. 这取决于ffi-compiler,我已经分叉ffi-compiler,添加一些自定义代码,我希望libmspack使用我的修改版本。 I have a simple Gemfile: 我有一个简单的Gemfile:

source 'http://rubygems.org'

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

When running 'bundle install', installation of 'ffi-compiler' completes fine, but 'libmspack' install fails with an error that it can't find 'ffi-compiler'.(LoadError: cannot load such file -- ffi-compiler/compile_task) 当运行'bundle install'时,'ffi-compiler'的安装完成得很好,但'libmspack'安装失败,并且找不到'ffi-compiler'的错误。(LoadError:无法加载这样的文件--ffi-compiler / compile_task)

I've noticed that if I remove 'libmspack' from Gemfile, and try to install it using 'bundle exec install libmspack', it works fine. 我注意到如果我从Gemfile中删除'libmspack',并尝试使用'bundle exec install libmspack'安装它,它工作正常。

Can someone explain, what is the correct way to achieve my goal, causing libmspack to use custom ffi-compiler gem ? 有人可以解释一下,实现我的目标的正确方法是什么,导致libmspack使用自定义的ffi-compiler gem?

I've found this SO post, which asks the same, but has no answer: Gem::LoadError when using a git repo in Gemfile 我找到了这个SO帖子,问了同样的问题,但没有答案: 在Gemfile中使用git repo时Gem :: LoadError

Thank you in advance 先感谢您

------ OUTPUT of bundle(empty gemset using RVM) ------- ------ bundle的OUTPUT(使用RVM的空gemset)-------

jackju at macbook-air  ~/tmp/delme1
$ rvm use 2.1.1@stackoverproblem --create
ruby-2.1.1 - #gemset created /home/jackju/.rvm/gems/ruby-2.1.1@stackoverproblem
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
ruby-2.1.1@stackoverproblem
jackju at macbook-air  ~/tmp/delme1
$ vim Gemfile

[1]+  Stopped                 vim Gemfile
jackju at macbook-air  ~/tmp/delme1
$ rvm current
ruby-2.1.1@stackoverproblem
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/ruby-2.1.1@stackoverproblem/gems/rake-10.3.1/bin/rake RUBYARCHDIR=/home/jackju/.rvm/gems/ruby-2.1.1@stackoverproblem/extensions/x86_64-linux/2.1.0/libmspack-0.0.4 RUBYLIBDIR=/home/jackju/.rvm/gems/ruby-2.1.1@stackoverproblem/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/ruby-2.1.1@stackoverproblem/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/ruby-2.1.1@stackoverproblem/gems/libmspack-0.0.4 for inspection.
Results logged to /home/jackju/.rvm/gems/ruby-2.1.1@stackoverproblem/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
$ 

The problem is missing 'rubygems/tasks' which is found in this gem: https://github.com/postmodern/rubygems-tasks . 问题是缺少这个gem中的'rubygems / tasks': https//github.com/postmodern/rubygems-tasks

I was able to install libmspack on my machine following these steps: 我可以按照以下步骤在我的机器上安装libmspack:

  1. gem install rubygems-tasks gem install ruby​​gems-tasks

  2. git clone git@github.com:survili/ffi-compiler.git git clone git@github.com:survili / ffi-compiler.git

  3. cd ffi-compiler cd ffi-compiler

  4. rake build gem 耙建造宝石

  5. gem install pkg/ffi-compiler-0.1.4.gem gem install pkg / ffi-compiler-0.1.4.gem

  6. gem install libmspack -v '0.0.4' gem install libmspack -v'0.0.4'

Successfully installed libmspack-0.0.4 
1 gem installed

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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