ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:66660] setarch i686 bash -c ' [ $( ruby -e 'print RUBY_PLATFORM' ) == x86_64_linux ] '-> TRUE (0) - would expect platform to be i386_linux
@ 2014-12-03 15:18 Jason Vas Dias
  2014-12-04  0:26 ` [ruby-core:66668] " Tanaka Akira
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Vas Dias @ 2014-12-03 15:18 UTC (permalink / raw
  To: ruby-core

When building an RPM for the i686 or i386 architecture on an x86_64 RHEL
6 / OL6 host that uses SWIG to generate headers, even though both
ruby-devel.i686 and ruby-devel.x86_64 are installed and
I have both /usr/lib/ruby/1.8/i386_linux and /usr/lib64/ruby/1.8/x86_64-linux
directories, and my 'uname -m -i -p' reports 'i686 i686 i686' since I am running
in an 'setarch i686' environment, /usr/bin/ruby (being from
ruby.x86_64 RPM) reports its 'RUBY_PLATFORM' as being x86_64 , making
it impossible to build
the package depending on ruby-devel for i686 on an x86_64 platform without
ruby i686 being installed .
Couldn't ruby use the uname() system call and if i686 is reported as
'machine', then check if /usr/lib/ruby/i386_linux exists, and if so, return
i686 as 'RUBY_PLATFORM' and use that directory as the arch-specific
dependency directory .
In perl, POSIX::uname() correctly reports 'i686' as the machine on
an x86_64 platform in a sub-process of 'setarch i686' . Why can't Ruby
be a bit more intelligent in the platform it reports ?
Is this a bug or new feature request ? Any votes / ideas ?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:66668] Re: setarch i686 bash -c ' [ $( ruby -e 'print RUBY_PLATFORM' ) == x86_64_linux ] '-> TRUE (0) - would expect platform to be i386_linux
  2014-12-03 15:18 [ruby-core:66660] setarch i686 bash -c ' [ $( ruby -e 'print RUBY_PLATFORM' ) == x86_64_linux ] '-> TRUE (0) - would expect platform to be i386_linux Jason Vas Dias
@ 2014-12-04  0:26 ` Tanaka Akira
  0 siblings, 0 replies; 2+ messages in thread
From: Tanaka Akira @ 2014-12-04  0:26 UTC (permalink / raw
  To: Ruby developers

2014-12-04 0:18 GMT+09:00 Jason Vas Dias <jason.vas.dias@gmail.com>:

> Couldn't ruby use the uname() system call and if i686 is reported as
> 'machine', then check if /usr/lib/ruby/i386_linux exists, and if so, return
> i686 as 'RUBY_PLATFORM' and use that directory as the arch-specific
> dependency directory .

Ruby binary uses architecture dependent data types (64 bit ruby uses
64 bit pointers).
So extension libraries, such as socket.so, should be compiled with
same data types.

setarch cannot change data types.
So, Ruby's library search path is not changable using setarch.

> In perl, POSIX::uname() correctly reports 'i686' as the machine on
> an x86_64 platform in a sub-process of 'setarch i686' . Why can't Ruby
> be a bit more intelligent in the platform it reports ?
> Is this a bug or new feature request ? Any votes / ideas ?

setarch doesn't change data types used for perl binary too.
I don't think 64 bit perl can use 32 bit libraries.

Note that Ruby 2.2 will have Etc.uname method.
Of course, it doesn't change library path.

% ./ruby -retc -e 'p Etc.uname[:machine]'
"x86_64"
% setarch i686 ./ruby -retc -e 'p Etc.uname[:machine]'
"i686"
-- 
Tanaka Akira

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-04  0:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-03 15:18 [ruby-core:66660] setarch i686 bash -c ' [ $( ruby -e 'print RUBY_PLATFORM' ) == x86_64_linux ] '-> TRUE (0) - would expect platform to be i386_linux Jason Vas Dias
2014-12-04  0:26 ` [ruby-core:66668] " Tanaka Akira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).