Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate `rb` file by `rake` for `s390x-linux`? #5846

Open
samding01 opened this issue Aug 23, 2019 · 14 comments

Comments

@samding01
Copy link

commented Aug 23, 2019

Environment

Provide at least:

  • JRuby version (jruby -v)
    jruby 9.2.7.0 (2.5.3) 2019-08-01 8a269e3 OpenJDK 64-Bit Server VM 11.0.4+11-post-Ubuntu-1ubuntu218.04.3 on 11.0.4+11-post-Ubuntu-1ubuntu218.04.3 +jit [linux-s390x]
  • Operating system and platform (e.g. uname -a)
    Linux csz25083.canlab.ibm.com 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:14:23 UTC 2018 s390x s390x s390x GNU/Linux

Inquiry

After building, on the generated jar :lib/target/jruby-stdlib-9.2.7.0.jar, there are 10 files under platform x86_64-linux (directory: META-INF/jruby.home/lib/ruby/stdlib/ffi/platform/x86_64-linux):

      errno.rb  etc.rb  fcntl.rb  platform.conf  socket.rb
      stat.rb  sysconf.rb  syslog.rb  types.conf  zlib.rb

But under s390x-linux (directory: META-INF/jruby.home/lib/ruby/stdlib/ffi/platform/s390x-linux), there are only 1 file

       types.conf

The fist line of each rb files has # This file is generated by rake. Do not edit. ( for example sysconf.rb)

The questions here are:

  1. How these rb file are generated by rake for x86_64-linux?
  2. Is there any way to generate the similar files for s390x-linux?

Thanks,

@headius

This comment has been minimized.

Copy link
Member

commented Aug 28, 2019

The rakefile for this lives in a sibling directory, under lib/ruby/stdlib/ffi/tools:

https://github.com/jruby/jruby/tree/2c3147e674967e87cd227ed6afd379cb192008a7/lib/ruby/stdlib/ffi/tools

Can you give that a try?

@samding01

This comment has been minimized.

Copy link
Author

commented Aug 29, 2019

@headius Thank you.
Can you let me know HOW TO run rake to generate those rb files?

# rake -f Rakefile
rake aborted!
LoadError: cannot load such file -- ffi
/home/jruby/lib/ruby/stdlib/ffi/tools/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

Note that those of rb files under x86_64-linux are managed by git ;
When I build jruby by ./mvnw at rjuby home, no new files generated under lib/ruby/stdlib/ffi/platform/s390x-linux folder.

@headius

This comment has been minimized.

Copy link
Member

commented Aug 29, 2019

Did you run that rake command with JRuby? It looks like you ran it with CRuby without FFI installed.

It may work fine with CRuby + FFI, but I have not tried that.

I am testing it now on Mac and making some tweaks to get it to build, but I believe it should work ok on Linux.

@headius

This comment has been minimized.

Copy link
Member

commented Aug 29, 2019

@samding01 Oops, that reply was for you ^

@samding01

This comment has been minimized.

Copy link
Author

commented Aug 29, 2019

@headius
I do not have CRuby installed.
I can git clone jruby and build on s390x-linux. All is fine.

Can you please let me know the steps how to run rake to generate those rb files?

Thanks,

@headius

This comment has been minimized.

Copy link
Member

commented Aug 29, 2019

I believe just running rake from within that ffi/tools directory should work. Can you try that?

You might also stop by our Matrix channel, IRC channel, or Gitter channel if you want to collaborate for a bit;

@samding01

This comment has been minimized.

Copy link
Author

commented Aug 29, 2019

Under directory /home/jruby/lib/ruby/stdlib/ffi/tools, invoke rake and get:

$ rake
rake aborted!
LoadError: cannot load such file -- ffi
/home/jruby/lib/ruby/stdlib/ffi/tools/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

$ rake -V
rake, version 12.3.1
@headius

This comment has been minimized.

Copy link
Member

commented Aug 29, 2019

Can you run this and post the output? FFI is shipped with JRuby, so something's wrong about your environment.

$ ruby -v -e "require 'ffi'; p FFI"
jruby 9.2.6.0-SNAPSHOT (2.5.3) 2019-08-28 a55e357 OpenJDK 64-Bit Server VM 25.202-b08 on 1.8.0_202-b08 +jit [darwin-x86_64]
FFI
@headius

This comment has been minimized.

Copy link
Member

commented Aug 29, 2019

We also never print out <top (required)> so I'm pretty sure you're running CRuby.

@samding01

This comment has been minimized.

Copy link
Author

commented Aug 29, 2019

Here is output:

#  ruby -v -e "require 'ffi'; p FFI"
ruby 2.5.1p57 (2018-03-29 revision 63029) [s390x-linux-gnu]
Traceback (most recent call last):
        2: from -e:1:in `<main>'
        1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- ffi (LoadError)
@samding01

This comment has been minimized.

Copy link
Author

commented Aug 29, 2019

on a x86_64 ubuntu 16.04, it got the same output:

 rake
rake aborted!
LoadError: cannot load such file -- ffi
/home/jruby/lib/ruby/stdlib/ffi/tools/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)


 $ ruby -v -e "require 'ffi'; p FFI"
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- ffi (LoadError)
        from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from -e:1:in `<main>'
@headius

This comment has been minimized.

Copy link
Member

commented Aug 29, 2019

Yes, that's not JRuby.

@headius

This comment has been minimized.

Copy link
Member

commented Aug 29, 2019

You may be able to get that to work if you gem install ffi but I have not tried running this code on CRuby.

@samding01

This comment has been minimized.

Copy link
Author

commented Aug 30, 2019

  1. gem install ffi;
  2. build jruby by ./mvnw; then export PATH=/home/jruby/bin:$PATH;
    Then get follows:
# ruby -v -e "require 'ffi'; p FFI"
jruby 9.2.7.0 (2.5.3) 2019-08-01 8a269e3 OpenJDK 64-Bit Server VM 11.0.4+11-post-Ubuntu-1ubuntu218.04.3 on 11.0.4+11-post-Ubuntu-1ubuntu218.04.3 +jit [linux-s390x]

and rake gets:

# rake

rake aborted!
Compilation error generating struct fcntl-flock (struct flock):
        In file included from /home/jruby/lib/ruby/stdlib/ffi/tools/fcntl-flock.struct_generator20190830-27767-cfkp4:3:0:
        /home/jruby/lib/ruby/stdlib/ffi/tools/fcntl-flock.struct_generator20190830-27767-cfkp4: In function ‘main’:
        /home/jruby/lib/ruby/stdlib/ffi/tools/fcntl-flock.struct_generator20190830-27767-cfkp4:17:69: error: ‘struct flock’ has no member named ‘l_sysid’; did you mean ‘l_pid’?
             printf("l_sysid %u %u\n", (unsigned int) offsetof(struct flock, l_sysid),
                                                                             ^
        /home/jruby/lib/ruby/stdlib/ffi/tools/fcntl-flock.struct_generator20190830-27767-cfkp4:18:36: error: ‘struct flock’ has no member named ‘l_sysid’; did you mean ‘l_pid’?
                    (unsigned int) sizeof(s.l_sysid));
                                            ^~~~~~~
                                            l_pid
        In file included from /home/jruby/lib/ruby/stdlib/ffi/tools/fcntl-flock.struct_generator20190830-27767-cfkp4:3:0:
        /home/jruby/lib/ruby/stdlib/ffi/tools/fcntl-flock.struct_generator20190830-27767-cfkp4:21:67: error: ‘struct flock’ has no member named ‘l_pad’; did you mean ‘l_pid’?
             printf("l_pad %u %u\n", (unsigned int) offsetof(struct flock, l_pad),
                                                                           ^
        /home/jruby/lib/ruby/stdlib/ffi/tools/fcntl-flock.struct_generator20190830-27767-cfkp4:22:36: error: ‘struct flock’ has no member named ‘l_pad’; did you mean ‘l_pid’?
                    (unsigned int) sizeof(s.l_pad));
                                            ^~~~~
                                            l_pid
org/jruby/ext/tempfile/Tempfile.java:260:in `open'
(eval):2:in `(eval)'
Tasks: TOP => default => build => s390x => gen_ffi_files_s390x

on x86_64 get the similar errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.