cosmo0920 / win32-api

A different, better variant of the Win32API Ruby library
61 stars 10 forks source link

Feature request to publish x86 and x64 versions #9

Closed joshcooper closed 10 years ago

joshcooper commented 10 years ago

Hi @djberg96, I've been trying to use bundler for a project that has dependencies on ffi and windows-api. The Gemfile is:

source "https://rubygems.org"

gem 'ffi'
gem 'windows-api'

When run on ruby 1.9.3 (x86) everything works:

C:\work\foo>ruby --version
ruby 1.9.3p374 (2013-01-15) [i386-mingw32]
C:\work\foo>bundle install --path .bundle
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Installing ffi (1.9.3)
Installing win32-api (1.5.1)
Installing windows-api (0.4.2)
Using bundler (1.2.4)
Your bundle is complete! It was installed into ./.bundle

When run on ruby 2.0 (x64) the ffi gem installs, but for some reason bundler resolves dependency info, and tries to install win32-api version 1.4.8, which is the pre-ffi version:

C:\work\foo>ruby --version
ruby 2.0.0p451 (2014-02-24) [x64-mingw32]
C:\work\foo>bundle install --path .bundle
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing ffi (1.9.3)

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
...
Gem files will remain installed in C:/work/foo/.bundle/ruby/2.0.0/gems/win32-api-1.4.8 for inspection.
Results logged to C:/work/foo/.bundle/ruby/2.0.0/gems/win32-api-1.4.8/ext/gem_make.out

Note I'm trying to do this without relying on the DevKit, since it won't necessarily be installed.

However, if I manually install the gems, using ruby's gem command, it works, I get the universal win32-api version as expected:

C:\work\foo>gem install windows-api
Fetching: win32-api-1.5.1-universal-mingw32.gem (100%)
Successfully installed win32-api-1.5.1-universal-mingw32
Fetching: windows-api-0.4.2.gem (100%)
Successfully installed windows-api-0.4.2
2 gems installed

I've even tried explicitly specify win32-api in my Gemfile:

gem 'win32-api'

But it appears bundler doesn't match on universal gems, and is likely a bug. I am guessing the same issue doesn't trigger with ffi, because version 1.9.3 is published as x86 and x64.

Would you be willing to publish win32-api as both x86 and x64?

djberg96 commented 10 years ago

Oh, man, I really don't want to maintain two separate gems for win32-api, especially since I'm trying to wean people off of it. Any chance you could report this as a bug in Bundler?

djberg96 commented 10 years ago

Looks like you reported it, thanks:

https://github.com/bundler/bundler/issues/3066

joshcooper commented 10 years ago

Sure thing, I'll close this for now.