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

simdjson: `padded_string': External LLVMFunction _ZN8simdjson22allocate_padded_bufferEm cannot be found #1931

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

Comments

@deepj
Copy link

deepj commented Feb 25, 2020

truffleruby 20.1.0-dev-d6e1b291, like ruby 2.6.5, GraalVM CE Native [x86_64-darwin]

To reproduce:

gem install simdjson
ruby -rsimdjson -e 'p Simdjson.parse %|{"a": 12345}| # => {"a"=>12345}'

Error:

~/.gem/truffleruby/2.6.5/gems/simdjson-0.2.0/vendor/simdjson/singleheader/simdjson.h:527:in `padded_string': External LLVMFunction _ZN8simdjson22allocate_padded_bufferEm cannot be found. (LLVMLinkerException) (RuntimeError)
Translated to internal error
	from ~/.gem/truffleruby/2.6.5/gems/simdjson-0.2.0/vendor/simdjson/singleheader/simdjson.h:527:in `padded_string'
	from ~/.gem/truffleruby/2.6.5/gems/simdjson-0.2.0/ext/simdjson/simdjson.cpp:60:in `rb_simdjson_parse'
	from ~/.rubies/truffleruby-dev/lib/truffle/truffle/cext_ruby.rb:39:in `parse'
	from -e:1:in `<main>'
@eregon eregon added the cexts label Feb 26, 2020
@eregon
Copy link
Member

eregon commented Feb 26, 2020

That seems to happen because libsimdjson is compiled as native without bitcode:
https://github.com/saka1/simdjson_ruby/blob/93189b84d744c46d7f7cef381f497669e04f05bc/ext/simdjson/extconf.rb#L13-L18

@eregon
Copy link
Member

eregon commented Feb 27, 2020

One idea here is to compile libsimdjson with the toolchain as well, which seems to work by adding the toolchain's bin to the PATH. That leads to some parse error though at runtime:

The processor is not supported by simdjson.
lib/truffle/truffle/cext.rb:1268:in `rb_exc_raise': parse error (Simdjson::ParseError)
	from src/main/c/cext/ruby.c:2114:in `rb_exc_raise'
	from lib/gems/gems/simdjson-0.2.0/ext/simdjson/simdjson.cpp:63:in `rb_simdjson_parse'
	from lib/truffle/truffle/cext_ruby.rb:39:in `parse'
	from -e:1:in `<main>'

@deepj deepj closed this as completed Jun 8, 2020
@eregon eregon reopened this Jun 19, 2020
@eregon eregon added this to the 21.1.0 milestone Mar 1, 2021
@eregon
Copy link
Member

eregon commented Mar 1, 2021

It works now, with 5f33393:

$ ruby -v -rsimdjson -e 'p Simdjson.parse %|{"a": 12345}| # => {"a"=>12345}'
truffleruby 21.1.0-dev-c03738b2, like ruby 2.7.2, GraalVM CE Native [x86_64-linux]
{"a"=>12345}

@eregon eregon closed this as completed Mar 1, 2021
@eregon eregon self-assigned this Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants