Ruby 1.9.3-p0 + Cygwin 1.7.9-1 + posix-spawn-0.3.6: Can't set RUBY_PLATFORM = cygwin

Hi there,

I’ve been trying to get jekyll installed within the Cygwin 1.7.9-1
environment using Ruby 1.9.3-p0 on WinXP. Ruby and RubyGems are working
fine. However, I continually run into an issue with posix-spawn being
unable to compile when trying to install Jekyll.

The posix-spawn developers created a patch to keep posix-spawn from
compiling, as it’s unnecessary. However, there are a couple of issues
I’m having:

  • I can’t get this gem (posix-spawn-0.3.6.gem) with the patch
    applied. Installing with ‘gem install posix-spawn’ after removing from
    cache and gems doesn’t pull the fresh code; and
  • The patch assumes RUBY_PLATFORM ~= “cygwin” (among others).
    However, ruby 1.9.3-p0 sets RUBY_PLATFORM to “i386-cygwin” so the
    comparison won’t work.

I’m new to Ruby, and am admittedly only using it for Jekyll (at the
moment). I realize that some of the issue likely resides within Cygwin,
but seems I should be able to address each issue within Ruby itself. Can
I just set RUBY_PLATFORM in the Makefile and rebuild? How can I get the
updated posix-spawn code? Hand-editing the two changed .rb files in
posix-spawn to add the comparison doesn’t help, as each time I run “gem
install *” posix-spawn is installed over any changes I’ve made.

Thank you for your patience and any help you can provide.

Cheers,

Daniel

Daniel Black wrote in post #1036381:

Hi there,

I’ve been trying to get jekyll installed within the Cygwin 1.7.9-1
environment using Ruby 1.9.3-p0 on WinXP. Ruby and RubyGems are working
fine. However, I continually run into an issue with posix-spawn being
unable to compile when trying to install Jekyll.

The posix-spawn developers created a patch to keep posix-spawn from
compiling, as it’s unnecessary. However, there are a couple of issues
I’m having:

  • I can’t get this gem (posix-spawn-0.3.6.gem) with the patch
    applied. Installing with ‘gem install posix-spawn’ after removing from
    cache and gems doesn’t pull the fresh code; and

Go here:

http://rubygems.org/gems/posix-spawn

Click download, place posix-spawn-0.3.6.gem somewhere accessible by
cygwin.

Then:

gem install --local /path/to/posix-spawn-0.3.6.gem

That will install the local copy.

  • The patch assumes RUBY_PLATFORM ~= “cygwin” (among others).
    However, ruby 1.9.3-p0 sets RUBY_PLATFORM to “i386-cygwin” so the
    comparison won’t work.

Where you see that?

This commit:

Introduces:

RUBY_PLATFORM =~ /(mswin|mingw|cygwin|bccwin)/

Which is a valid regular expression and will be true if RUBY_PLATFORM ==
“i386-cygwin”:

platform = “i386-cygwin”
=> “i386-cygwin”
platform =~ /(mswin|mingw|cygwin|bccwin)/
=> 5

I’m new to Ruby, and am admittedly only using it for Jekyll (at the
moment). I realize that some of the issue likely resides within Cygwin,
but seems I should be able to address each issue within Ruby itself. Can
I just set RUBY_PLATFORM in the Makefile and rebuild? How can I get the
updated posix-spawn code? Hand-editing the two changed .rb files in
posix-spawn to add the comparison doesn’t help, as each time I run “gem
install *” posix-spawn is installed over any changes I’ve made.

  1. You can build the gem your self
    1.1) Clone posix-spawn repository,
    1.2) introduce the modifications
    1.3) generate the gem with “rake gem”

  2. report the issue to the gem authors:
    Issues · rtomayko/posix-spawn · GitHub

  3. You can’t force RUBY_PLATFORM, that is actually not the problem
    you’re experiencing.


Luis L.

Hi, Luis,

Exceedingly helpful. I didn’t recognize the platform condition as a
regular expression. In irb, “print RUBY_PLATFORM” results in
“1386-cygwin.” This is also specified in
/local/include/ruby-1.9.1/i386-cygwin/ruby/config.h.

I first tried to install the posix-spawn gem from rubygems.org, and hit
the same error. I unpacked it only to find that it doesn’t include the
commit which adds “cygwin” to the condition regex. I further cloned the
repo and attempted to build the gem myself, but hit upon an issue that
aborts the rake.

Rake can’t find rake/extensiontask. I’ve reinstalled the rake gem just
to be sure nothing was clobbered or installed incorrectly to begin with,
to no avail.

It shouldn’t be necessary, but I’m going to reinstall Ruby 1.9.3. It may
be that the fact I installed Ruby 1.8 via the Cygwin installer and then
later compiled and installed 1.9.3 has created a conflict. That feels of
a piece with “Just reinstall Windows” in its ignorant paranoia, but I
tried. This also did not mitigate the issue.

I’ll keep pecking away at the issue. How frequently is the rubygems.org
repository updated?

Thank you for the very thoughtful help.

Cheers,

Daniel

The issue was that I didn’t have rake-compiler installed. I have now
built the posix-spawn gem, installed it, and installed jekyll (the
original impetus). All seems well for the moment.

Thank you again, Luis.