Using gem --platform

260 vues
Accéder directement au premier message non lu

etd

non lue,
14 oct. 2010, 15:30:1014/10/2010
à ruby-b...@googlegroups.com

Hi,

I'm trying to get Bundler to install RedCloth under Windows. If in my
Gemfile I use:

gem 'RedCloth', :require => 'redcloth'

bundle fails to install (it tries to compile the gem). This is the same
error that happens if I try "gem install RedCloth" from the command line.

However, from the command line I can run "gem install RedCloth
--platform=x86-mswin32-60" it works.

Can I make it work through Bundler? I have tried this unsuccessfully:

platforms :mswin do
gem 'RedCloth', :require => 'redcloth'
end

If I add that, RedCloth is ignored and Bundler reports everything is Ok.

Regards,

Daniel

Andre Arko

non lue,
14 oct. 2010, 16:06:3814/10/2010
à ruby-b...@googlegroups.com
On Oct 14, 2010, at 12:30 PM, etd wrote:

> However, from the command line I can run "gem install RedCloth
> --platform=x86-mswin32-60" it works.
>
> Can I make it work through Bundler?

http://gembundler.com/man/bundle-config.1.html

etd

non lue,
14 oct. 2010, 16:43:5514/10/2010
à ruby-b...@googlegroups.com
Hi Andre,

Thanks for the pointer did read that before posting, but I'm not sure I
understand how it works. From the example:

bundle config build.mysql
--with-mysql-config=/usr/local/mysql/bin/mysql_config

I take this is useful when you need to compile a gem. However I'm just
trying to install a binary gem. The gem line would be:

gem install RedCloth --platform=x86-mswin32-60

I've tried:

bundle config build.RedCloth --platform=x86-mswin32-60

and (just in case)

bundle config install.RedCloth --platform=x86-mswin32-60

But bundle keeps trying to download the wrong version of the gem.

Where can I read a bit more about how to use this config?

Thanks!

Daniel

Andre Arko

non lue,
14 oct. 2010, 19:02:1014/10/2010
à ruby-b...@googlegroups.com
On Oct 14, 2010, at 1:43 PM, etd wrote:

> I take this is useful when you need to compile a gem. However I'm just
> trying to install a binary gem. The gem line would be:
>
> gem install RedCloth --platform=x86-mswin32-60

Oops! I am sorry, I didn't understand your original message. You are right, and I believe this is not currently working. I have been trying to improve the Windows support in Bundler, but it is hard since I do not personally use Windows, so I am not sure what needs to be done. Would you be willing to work with me to try to make this work? If so, please email me privately or come to the #bundler channel on Freenode.

Thanks,
Andre

spa...@gmail.com

non lue,
15 oct. 2010, 13:24:3415/10/2010
à ruby-bundler
The fact that you need to specify "--platform=x86-mswin32-60" in the
absence of using Bundler is highly suspicious, and it reminds me of a
problem that wasted an hour of my time just yesterday.

I'm curious. What is the output when you run the following command:
ruby -e "puts RUBY_PLATFORM"

Yesterday I installed the Ruby 1.8.7 one-click installer from ruby-
lang.org. The issue with that installer is that its binaries were
built using MinGW and its RUBY_PLATFORM is reported as "i386-mingw" or
something similar.

There are good reasons for doing this, but there is a HUGE gotcha:
RubyGems fails to realize that it's running on a Windows system and
doesn't know how to search for an "mswin" variant of the gems you
install. It tries to fetch the "ruby" variant of every gem and then
attempts to invoke the gcc toolchain to compile its native extensions!
(In the unix world, gems with native extensions typically compile them
at install-time, hence installing a gem will cause compilation.)

You have already discovered the workaround for the "gem" command;
however, you might want to exercise caution because I don't know
whether the MingGW-built ruby.exe will be compatible with MSVC-built
DLLs that were linked against an MSVC-built native interface lib.

I'm not sure if there is a suitable workaround for Bundler, since the
problem is one of dependency resolution and not of install-time or
build-time options. Maybe overwrite the RUBY_PLATFORM constant?
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message