Comments (11)
Hey all, after a quick investigation I don't have a good answer here.
The error is caused by the RubyGems runtime not being able to find a dependency in the local domain
Unable to resolve dependency: user requested 'ffi (~> 1.0, >= 1.0.11)'
I tried modifying the mkrf_conf.rb
file to specify the local domain explicitly to see if that resolved it, but we get the same error.
installer_options = {}
installer_options[:domain] = :local
inst = Gem::DependencyInstaller.new(installer_options)
Here are the options we have:
- Dig into RubyGems internals to understand if there's a way to get this to work using only locally-installed gems.
- Vendor the gems you're installing so you don't need to run
gem install
in the first place and thus avoid this issue. - Remove this native extension installation workaround entirely and clearly document that Windows users need to explicitly include
ffi
as a gem dependency in their projects in order to usechildprocess
.
I'm coming around to 3 given the fact that conditional installation does seem a little bit deceptive. Developers should be able to see clearly what their gems are installing without having to look at custom extensions code.
@DavidS Any thoughts on removing the extension code since you implemented this in #132?
from childprocess.
Since Gem::Installer#install always tries to reinstall, I guess a simple way to fix this is to check whether a satisfied version of ffi
exists (see PR #159).
from childprocess.
We are also getting an error with Windows installations via gemfile. An update of the selenium-webdriver in our Rails app has bumped childprocess from version from 1.0.1
to 2.0.0
. This has worked fine for those of the team using Linux and Mac development platforms. But a Windows user now gets this error on running bundle:
Fetching childprocess 2.0.0
Installing childprocess 2.0.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/childprocess-2.0.0/ext
C:/Ruby26-x64/bin/ruby.exe mkrf_conf.rb
rake failed, exit code 1
Gem files will remain installed in
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/childprocess-2.0.0 for inspection.
Results logged to
C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/childprocess-2.0.0/gem_make.out
An error occurred while installing childprocess (2.0.0), and Bundler cannot
continue.
Make sure that `gem install childprocess -v '2.0.0' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
webdrivers was resolved to 4.1.2, which depends on
selenium-webdriver was resolved to 3.142.4, which depends on
childprocess
from childprocess.
Hey @aidistan and @reggieb, thanks for the reports.
Can you provide the output of gem_make.out
from your respective environments (the Results logged to
line)? This could help us better understand what's happening in this case.
Thanks!
from childprocess.
I'm afraid it's not very helpful:
current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/childprocess-2.0.0/ext
C:/Ruby26-x64/bin/ruby.exe mkrf_conf.rb
rake failed, exit code 1
from childprocess.
Mine is the same as reggieb's.
Here I've tried gem install childprocess -v '2.0.0' --source 'https://rubygems.org/'
and succeeded, though gem install --local childprocess-2.0.0.gem
without network access still got failed.
from childprocess.
The original reason for me having that has vanished, so I have no objections to revert all of that. :(
from childprocess.
Hey @aidistan, thanks for opening #159.
I still believe the answer here is to remove this logic, and clearly document that Windows users need to explicitly install ffi
themselves. This is for the following reasons:
- Regardless of platform, you always see a
Building native extensions. This could take a while...
message when this is not actually the case. ChildProcess is just piggybacking off of the RubyGems extension facilities to conditionally install a gem. This is confusing. - When installing
ffi
via this workaround, it isn't clear to the user that it is happening. You see the aforementionedBuilding native extensions
message, but aren't told that theffi
gem was installed. Again, this is potentially confusing, but also deceptive in that it hides the dependency. - The workaround requires us to specify a dependency constraint that doesn't respect the constraints defined in the user's own gem dependencies. Users then need to align their dependency constraints with what we've defined in
mkrf_conf.rb
, duplicating them in theirGemfile
/etc. See #150 for an example where this confusion occurs. - It introduces a dependency on the
rake
gem (see #144), unnecessarily coupling us to Rake's release cycle. See #147 for an example where we had to cut a new release when Rake issued a new release.
We (specifically, myself) originally merged this in #132 without truly understanding the consequences of that pull request. For this reason and those mentioned above, we're removing this logic in #160.
from childprocess.
Hey @sds, thanks for the comments and opening #160.
Since we had no further progress under this issue for several days, I opened #159 and left the logic untouched 😄
I completely agree with your first and second points. However, besides the document, I suggest to raise a LoadError when running without ffi
gem on Windows platform (refer to this discussion).
from childprocess.
Thanks for the suggestion. Added a more descriptive error message in c0cc6f2.
from childprocess.
Fixed in #160. Shipped in ChildProcess 3.0.0. Thanks again for the report!
from childprocess.
Related Issues (20)
- Redirect to IO.pipe on Windows causes inability to start a process HOT 6
- Security Question: Is there a reason childprocess is released as an unsigned gem? HOT 2
- FFI is a required pre-requisite HOT 4
- Pipe i/o example in documentation is incorrect HOT 2
- Erro ao rodar o comando rspec -fd HOT 1
- childprocess kills detached windows process on exit HOT 4
- FFI is a required pre-requisite for Windows or posix_spawn support in the ChildProcess gem. HOT 1
- A backend based on Process.spawn HOT 12
- Ruby 3.0 support HOT 10
- code hanging attempting to @thread.join HOT 1
- Should work for the M1 chip, but needs to be mapped or smth
- `host_cpu` changes between Ruby 2.7.2 and 2.7.3 HOT 2
- FFI installes but rake test get error HOT 4
- cannot load such file -- ffi (LoadError) HOT 2
- Use with StringIO HOT 1
- posix_spawn is not yet supported on aarch64-linux (aarch64-linux), HOT 2
- posix_spawn is not yet supported on sparc-solaris (sparc-solaris2.11) HOT 1
- I happen to be having this error after even having all both ruby, gem, and even chocolatey handy HOT 2
- Test suite is going to be broken with Ruby 3.3 HOT 1
- differences between macos and linux HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from childprocess.