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

skylight: lib/mri/mkmf.rb:1299:in `find_type': wrong number of arguments (given 1, expected 2+) (ArgumentError) #1896

Closed
deepj opened this issue Feb 8, 2020 · 3 comments
Assignees
Milestone

Comments

@deepj
Copy link

deepj commented Feb 8, 2020

To reproduce:

gem install skylight

Error:

ERROR:  Error installing skylight:
	ERROR: Failed to build gem native extension.

    current directory: ~/.gem/truffleruby/2.6.5/gems/skylight-4.2.1/ext
~/.rubies/truffleruby-20.1.0-dev/bin/truffleruby -I ~/.rubies/truffleruby-20.1.0-dev/lib/mri -r ./siteconf20200208-39800-1h6f77a.rb extconf.rb
~/.rubies/truffleruby-20.1.0-dev/lib/mri/mkmf.rb:1299:in `find_type': wrong number of arguments (given 1, expected 2+) (ArgumentError)
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/ffi/struct.rb:272:in `find_type'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/ffi/struct.rb:266:in `find_field_type'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/ffi/struct.rb:306:in `array_layout'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/ffi/struct.rb:218:in `layout'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/socket/truffle.rb:63:in `config'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/socket/truffle/foreign/addrinfo.rb:31:in `Addrinfo'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/socket/truffle/foreign/addrinfo.rb:30:in `Foreign'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/socket/truffle/foreign/addrinfo.rb:29:in `Socket'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/socket/truffle/foreign/addrinfo.rb:28:in `Truffle'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/socket/truffle/foreign/addrinfo.rb:27:in `<top (required)>'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/truffle/socket.rb:38:in `<top (required)>'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/net/protocol.rb:22:in `<top (required)>'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/net/http.rb:23:in `require_relative'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/net/http.rb:23:in `<top (required)>'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from ~/.gem/truffleruby/2.6.5/gems/skylight-4.2.1/lib/skylight/native_ext_fetcher.rb:3:in `<top (required)>'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from ~/.rubies/truffleruby-20.1.0-dev/lib/mri/rubygems/core_ext/kernel_require.rb:54:in `require'
	from extconf.rb:9:in `<main>'
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=~/.rubies/truffleruby-20.1.0-dev/bin/truffleruby
log file does not exist

extconf failed, exit code 1

Gem files will remain installed in ~/.gem/truffleruby/2.6.5/gems/skylight-4.2.1 for inspection.
Results logged to ~/.gem/truffleruby/2.6.5/extensions/x86_64-darwin/20.1.0-dev-9e0b0468/skylight-4.2.1/gem_make.out

@eregon eregon self-assigned this Feb 10, 2020
@eregon
Copy link
Member

eregon commented Feb 10, 2020

Interesting case where code in FFI ends up conflicting with code in mkmf.rb.
I'll need to find out why it doesn't happen on MRI.

@eregon
Copy link
Member

eregon commented May 15, 2020

ruby -rmkmf -rffi -e 'module A; class A < FFI::Struct; layout :a, :int; end; end'

reproduces and also fails in MRI.

So basically it's an issue of FFI: ffi/ffi#776
Because mkmf defines a public find_type on every object by include MakeMakefile.

The only reason it doesn't fail on MRI for the extconf.rb is that MRI doesn't use FFI internally for the socket stdlib.

The require chain here is extconf.rb -> net/http -> socket -> ffi and in #2010 it's extconf.rb -> openssl -> ipaddr -> socket -> ffi.

@eregon eregon added this to the 20.2.0 milestone May 15, 2020
graalvmbot pushed a commit that referenced this issue May 15, 2020
…find_type from mkmf (#1896, #2010).

PullRequest: truffleruby/1622
@eregon
Copy link
Member

eregon commented May 15, 2020

Fixed by a54e85b.
gem install skylight works for me locally now.

@eregon eregon closed this as completed May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants