Forum: Ruby Installing Gems on Windows

C6e61d254fee0cf5f457a794fbce5e22?d=identicon&s=25 Augusto Esteves (rorsch)
on 2009-12-28 04:42
I'm new to Ruby and I was wondering if every gem that works on Ruby
for Linux works on Ruby for Windows. I'm trying to install both the
rake (as a test) and the nfc gems on Windows, but with both I'm
getting:

c:\ruby>gem install nfc
ERROR:  While executing gem ... (Gem::GemNotFoundException)
   Could not find nfc (> 0) in any repository
2a745e2d109928984604d0b573e55855?d=identicon&s=25 Phillip Gawlowski (Guest)
on 2009-12-28 05:10
(Received via mailing list)
On 28.12.2009 04:43, Augusto Esteves wrote:
> I'm new to Ruby and I was wondering if every gem that works on Ruby
> for Linux works on Ruby for Windows.

Short answer: No.

Long answer: It depends.

*If* you use the RubyInstaller from rubyinstaller.org *and* the devkit
offered there (simply extract the .7z into your Ruby installation
folder, by default C:\Ruby), then Gems requiring native extensions
*could* work, if no binary gem is offered.
C6e61d254fee0cf5f457a794fbce5e22?d=identicon&s=25 Augusto Esteves (rorsch)
on 2009-12-28 06:00
Phillip Gawlowski wrote:
> *If* you use the RubyInstaller from rubyinstaller.org *and* the devkit
> offered there (simply extract the .7z into your Ruby installation
> folder, by default C:\Ruby), then Gems requiring native extensions
> *could* work, if no binary gem is offered.

I've followed your instructions and I was able to get somewhere :) After
it starts building the native extensions I get a bunch of errors that
are related to a library I need to run this gem, which is the libnfc.

I have the binaries for this library, is there a way of letting the Gem
installer know how to get the files it needs?
2a745e2d109928984604d0b573e55855?d=identicon&s=25 Phillip Gawlowski (Guest)
on 2009-12-28 06:16
(Received via mailing list)
On 28.12.2009 06:00, Augusto Esteves wrote:

> I've followed your instructions and I was able to get somewhere :) After
> it starts building the native extensions I get a bunch of errors that
> are related to a library I need to run this gem, which is the libnfc.
>
> I have the binaries for this library, is there a way of letting the Gem
> installer know how to get the files it needs?

The MinGW compiler used by ruby needs to know where the *header* files
are to get them.

My guess is that you need the source for libnfc, and add their path to
your your %path% environment variable (if only temporarily), by doing
something like "set path = %path%;C:\Path\To\Header\Files", and then
"gem install".

Mind, this doesn't guarantee, at all, that your gem will work. Or even
that the libnfc you have works (the lib has to be compiled for windows,
with a compiler compatible to MinGW32's gcc3.4 to be usable by Ruby),
*and* the header files have to be usable for Windows, too.

Linux and Windows platforms are *not* compatible to each other, so
unless you know your way around C, and can fix the errors gcc/gem hands
you, you'll either have to fix the errors yourself, or lobby the
libnfc/nfc-gem maintainers to fix the issue (if, indeed, this is an
issue for them in the first place).
B078cb4f4fb473c7a54d1fc36d10c70e?d=identicon&s=25 Regis d'Aubarede (raubarede)
on 2009-12-28 13:44
Augusto Esteves wrote:

> c:\ruby>gem install nfc
> ERROR:  While executing gem ... (Gem::GemNotFoundException)
>    Could not find nfc (> 0) in any repository

that resolve the first issue  :
>gem install os

then you will get second issue :
....        ERROR: Failed to build gem native extension. ....

I have not found solution for this one !
by
C6e61d254fee0cf5f457a794fbce5e22?d=identicon&s=25 Augusto Esteves (rorsch)
on 2009-12-29 03:00
Phillip Gawlowski wrote:

> The MinGW compiler used by ruby needs to know where the *header* files
> are to get them.
>
> My guess is that you need the source for libnfc, and add their path to
> your your %path% environment variable (if only temporarily), by doing
> something like "set path = %path%;C:\Path\To\Header\Files", and then
> "gem install".
>
> Mind, this doesn't guarantee, at all, that your gem will work. Or even
> that the libnfc you have works (the lib has to be compiled for windows,
> with a compiler compatible to MinGW32's gcc3.4 to be usable by Ruby),
> *and* the header files have to be usable for Windows, too.
>
> Linux and Windows platforms are *not* compatible to each other, so
> unless you know your way around C, and can fix the errors gcc/gem hands
> you, you'll either have to fix the errors yourself, or lobby the
> libnfc/nfc-gem maintainers to fix the issue (if, indeed, this is an
> issue for them in the first place).

I do have the binaries for Windows, the problem is where to put them in
order for the RubyGem installer to detect them. By running c:\gem
install nfc I get, amongst other things:

checking for libnfc/libnfc.h in
/opt/local/include,/opt/local/include,/usr/local
/include,C:/Ruby19/include,/usr/include... no

libnfc is missing.  please install libnfc: http://libnfc.org/

I can trick this process by creating a folder libnfc inside
C:/Ruby19/include, and then put the libnfc.h there (as the rest of the
files). Doing that I get:

checking for libnfc/libnfc.h in
/opt/local/include,/opt/local/include,/usr/local
/include,C:/Ruby19/include,/usr/include... yes

checking for nfc_connect() in -lnfc... no

libnfc is missing.  please install libnfc: http://libnfc.org/

So basically I need to figure out where everything goes, regarding the
libnfc binary files.
2a745e2d109928984604d0b573e55855?d=identicon&s=25 Phillip Gawlowski (Guest)
on 2009-12-29 03:23
(Received via mailing list)
On 29.12.2009 03:00, Augusto Esteves wrote:

> checking for nfc_connect() in -lnfc... no
>
> libnfc is missing.  please install libnfc: http://libnfc.org/
>
> So basically I need to figure out where everything goes, regarding the
> libnfc binary files.

I'd try putting the libnfc-binary into your %PATH% somewhere, or at
least c:\Ruby\lib\.. since that is, probably, where the compiler is
looking.

It's pretty much trial and error for both of us here. :|
4a8e3193f5ee05186a3cda8cb1070af4?d=identicon&s=25 Arrumaco (Guest)
on 2009-12-29 20:32
(Received via mailing list)
On Dec 28, 10:00 pm, Augusto Esteves <augusto...@gmail.com> wrote:
> > that the libnfc you have works (the lib has to be compiled for windows,
> order for the RubyGem installer to detect them. By running c:\gem
> files). Doing that I get:
> libnfc binary files.
>
> --
> Posted viahttp://www.ruby-forum.com/.- Hide quoted text -
>
> - Show quoted text -

Try install the Windows components connected as "Administrator". Is
useless a user with the administrator role.
C6e61d254fee0cf5f457a794fbce5e22?d=identicon&s=25 Augusto Esteves (rorsch)
on 2009-12-30 00:08
Arrumaco wrote:
> On Dec 28, 10:00�pm, Augusto Esteves <augusto...@gmail.com> wrote:
>> > that the libnfc you have works (the lib has to be compiled for windows,
>> order for the RubyGem installer to detect them. By running c:\gem
>> files). Doing that I get:
>> libnfc binary files.
>>
>> --
>> Posted viahttp://www.ruby-forum.com/.- Hide quoted text -
>>
>> - Show quoted text -
>
> Try install the Windows components connected as "Administrator". Is
> useless a user with the administrator role.

I'm using Windows XP SP3 :/
2a745e2d109928984604d0b573e55855?d=identicon&s=25 Phillip Gawlowski (Guest)
on 2009-12-30 07:40
(Received via mailing list)
On 30.12.2009 00:09, Augusto Esteves wrote:

>> Try install the Windows components connected as "Administrator". Is
>> useless a user with the administrator role.
>
> I'm using Windows XP SP3 :/

Ruby and the devkit need admin rights only on installation, anyway.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.