Skip to content

cld: No enum constant com.oracle.truffle.nfi.spi.types.NativeSimpleType.STRUCT_BY_VALUE #2069

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

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

Comments

@deepj
Copy link

deepj commented Aug 8, 2020

truffleruby 20.3.0-dev-a1514d37, like ruby 2.6.6, GraalVM CE Native [x86_64-darwin]

To reproduce:

gem install cld
ruby -rcld -e 'puts CLD.detect_language("The rose is red, the violet's blue")'

Error:

~/.rubies/truffleruby-dev/lib/truffle/truffle/ffi_backend/function.rb:50:in `initialize': No enum constant com.oracle.truffle.nfi.spi.types.NativeSimpleType.STRUCT_BY_VALUE (ArgumentError)
	from ~/.gem/truffleruby/2.6.6/gems/ffi-1.13.1/lib/ffi/library.rb:265:in `new'
	from ~/.gem/truffleruby/2.6.6/gems/ffi-1.13.1/lib/ffi/library.rb:265:in `block in attach_function'
	from ~/.gem/truffleruby/2.6.6/gems/ffi-1.13.1/lib/ffi/library.rb:252:in `each'
	from ~/.gem/truffleruby/2.6.6/gems/ffi-1.13.1/lib/ffi/library.rb:252:in `attach_function'
	from ~/.gem/truffleruby/2.6.6/gems/cld-0.8.0/lib/cld.rb:20:in `<module:CLD>'
	from ~/.gem/truffleruby/2.6.6/gems/cld-0.8.0/lib/cld.rb:4:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from ~/.rubies/truffleruby-dev/lib/mri/rubygems/core_ext/kernel_require.rb:130:in `require'
	from <internal:core> core/unbound_method.rb:20:in `call'
	from <internal:core> core/unbound_method.rb:20:in `bind_call'
	from <internal:core> core/kernel.rb:267:in `require'
@eregon eregon added the ffi label Aug 10, 2020
@eregon
Copy link
Member

eregon commented Aug 10, 2020

Thanks for the report.

I think this is the same source issue as in #1827 (comment) that is,
Truffle NFI does not support passing struct-by-value yet (internal issue: GR-13304).
And so our FFI implementation which uses Truffle NFI cannot yet either.

The usage of struct-by-value is in:
https://github.com/jtoy/cld/blob/bd4e4a19691c642c52fba8589dada50e3f1365e7/lib/cld.rb#L20

@alextwoods
Copy link

I'm also running into this - I'm developing a new gem based on FFI and wanted to ensure compatibility with Truffle Ruby, but all of my CI tests started failing when using Struct.by_value.

@eregon
Copy link
Member

eregon commented May 5, 2025

Closing as duplicate of #3835 since that one is clearer.

@eregon eregon closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2025
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

4 participants