For which gems should "--platform=ruby" option be used? All of them?

71 views
Skip to first unread message

Joe Duarte

unread,
Dec 19, 2016, 6:38:18 AM12/19/16
to RubyInstaller
Hi all,

I've never been clear on when exactly we should use the --platform=ruby option when installing or updating gems. I thought it was supposed to be for those rare gems that use native C extensions, like RDiscount.

But the DevKit example applies --platform=ruby to the JSON gem too. So I'm wondering... is it a safe default to just always include --platform=ruby when installing any gem? Would it break gems that don't use native C extensions?

By the way, there are three gems that I'm never able to update, whether I add --platform=ruby or not: io-console, json, and psych. Typical errors start like this:

PS C:\WINDOWS\system32> gem update json
Updating installed gems
Updating json
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR
:  Error installing json:
        ERROR
: Failed to build gem native extension.


    current directory
: C:/Ruby/lib/ruby/gems/2.3.0/gems/json-2.0.2/ext/json/ext/generator
C
:/Ruby/bin/ruby.exe -r ./siteconf20161219-10028-1ppvq3.rb extconf.rb
creating
Makefile


current directory
: C:/Ruby/lib/ruby/gems/2.3.0/gems/json-2.0.2/ext/json/ext/generator
make
"DESTDIR=" clean
     
0 [main] sh 10720 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
make
: [clean] Error 5 (ignored)



Any ideas on what's happening there? I'm running Ruby 2.3.3p222 (2016-11-21 revision 56859), 64-bit, the RubyInstaller version, on Windows 10 64-bit. Note in the above that it goes through the DevKit motions, building native extensions, etc. whether I include --platform=ruby or not.


Cheers,

Joe

Thierry

unread,
Dec 20, 2016, 3:16:39 AM12/20/16
to RubyInstaller
Hi Joe,

I never use --platform when installing/updating gems, and it works fine.
When it does not, it generally means my platform/version is not (yet) supported. For instance, I remember nokogiri could not install on windows in some version, and I had to wait for them to support windows (the issue was on github).
I have one big difference with you: I use ruby 32-bit, even on a 64-bit system, and json updates fine. (ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32])
Do you have the same problem with 32-bit ruby?

Cheers
Thierry
Reply all
Reply to author
Forward
0 new messages