colszowka / phantomjs-gem

Phantomjs via Rubygems: Auto-install phantomjs on demand for current platform. Comes with poltergeist integration.
Other
222 stars 104 forks source link

Linux i486 #16

Open cschramm opened 11 years ago

cschramm commented 11 years ago

The gem fails to find a proper binary for my 32 bit Debian server.

The problem is that RbConfig::CONFIG['host_cpu'] reports i486, while uname -m gives me i686.

I guess that RbConfig::CONFIG['host_cpu'] reports the compile configuration of Ruby, not the actual platform. It also will report a 32 bit architecture if you run a 32 bit ruby binary on a 64 bit platform.

I'm not sure if there's a proper way to detect the architecture of the actual platform ruby is running on instead of what it was compiled for (https://github.com/rdp/os does not do this either). Of course one could invoke a shell and ask e. g. uname, but...

The easiest fix would be to install the i686 version of phantom even if RbConfig::CONFIG['host_cpu'] reports i486. The probability of running on an actual i486 or Pentium should be quite low. You could give a warning in that situation. Would be nicer than just giving up.

I can prepare a PR if we agree on a solution for this.

cschramm commented 11 years ago

Here's a quick implementation: https://github.com/cschramm/phantomjs-gem/commit/5e0115f4b4efa76f6b191a78f20d87f33a29e6aa

(I also removed x86_32 since I'm pretty confident this does not exist :wink: )

cschramm commented 11 years ago

Any feedback?

jabr commented 11 years ago

Perhaps a new UnknownLinux platform that prints a warn and then installs the 32bit version?