oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
https://www.graalvm.org/ruby/
Other
3.02k stars 185 forks source link

ruby-tree-sitter not working #2360

Open fniephaus opened 3 years ago

fniephaus commented 3 years ago

ruby-tree-sitter is a binding for tree-sitter, a parser generator tool and an incremental parsing library written in C.

Steps to reproduce (works on macOS):

git clone https://github.com/tree-sitter/ruby-tree-sitter
cd ruby-tree-sitter
script/bootstrap
script/test

Errors:

Run options: --seed 1245

# Running:

.E..E.EFEEEEE

Finished in 0.084257s, 154.2893 runs/s, 59.3420 assertions/s.

  1) Error:
TreeSitter::DocumentTest#test_that_it_accepts_string_languages:
RuntimeError: Invalid native function pointer (com.oracle.truffle.llvm.runtime.except.LLVMNativePointerException)
Translated to internal error
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:79:in `rb_document_set_language'
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:37:in `rb_document_new'
    /Users/fniephaus/bin/graalvm-ce-java11-21.1.0/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `initialize'
    /Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_document.rb:31:in `test_that_it_accepts_string_languages'

  2) Error:
TreeSitter::DocumentTest#test_that_it_creates_documents:
RuntimeError: Invalid native function pointer (com.oracle.truffle.llvm.runtime.except.LLVMNativePointerException)
Translated to internal error
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:79:in `rb_document_set_language'
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:37:in `rb_document_new'
    /Users/fniephaus/bin/graalvm-ce-java11-21.1.0/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `initialize'
    /Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_document.rb:7:in `test_that_it_creates_documents'

  3) Error:
TreeSitter::DocumentTest#test_that_it_parses_valid_input:
RuntimeError: Invalid native function pointer (com.oracle.truffle.llvm.runtime.except.LLVMNativePointerException)
Translated to internal error
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:79:in `rb_document_set_language'
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:37:in `rb_document_new'
    /Users/fniephaus/bin/graalvm-ce-java11-21.1.0/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `initialize'
    /Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_document.rb:68:in `test_that_it_parses_valid_input'

  4) Failure:
TreeSitter::DocumentTest#test_that_unknown_languages_error [/Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_document.rb:40]:
[TreeSitter::DocumentError] exception expected, not
Class: <RuntimeError>
Message: <"Invalid native function pointer (com.oracle.truffle.llvm.runtime.except.LLVMNativePointerException)\nTranslated to internal error">
---Backtrace---
/Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:79:in `rb_document_set_language'
/Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:37:in `rb_document_new'
/Users/fniephaus/bin/graalvm-ce-java11-21.1.0/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `initialize'
/Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_document.rb:41:in `block in test_that_unknown_languages_error'
---------------

  5) Error:
TreeSitter::DocumentTest#test_that_it_accepts_string_inputs:
RuntimeError: Invalid native function pointer (com.oracle.truffle.llvm.runtime.except.LLVMNativePointerException)
Translated to internal error
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:79:in `rb_document_set_language'
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:37:in `rb_document_new'
    /Users/fniephaus/bin/graalvm-ce-java11-21.1.0/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `initialize'
    /Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_document.rb:46:in `test_that_it_accepts_string_inputs'

  6) Error:
TreeSitter::NodeTest#test_gets_children_node_type:
RuntimeError: Invalid native function pointer (com.oracle.truffle.llvm.runtime.except.LLVMNativePointerException)
Translated to internal error
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:79:in `rb_document_set_language'
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:37:in `rb_document_new'
    /Users/fniephaus/bin/graalvm-ce-java11-21.1.0/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `initialize'
    /Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_node.rb:20:in `setup'

  7) Error:
TreeSitter::NodeTest#test_gets_children:
RuntimeError: Invalid native function pointer (com.oracle.truffle.llvm.runtime.except.LLVMNativePointerException)
Translated to internal error
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:79:in `rb_document_set_language'
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:37:in `rb_document_new'
    /Users/fniephaus/bin/graalvm-ce-java11-21.1.0/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `initialize'
    /Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_node.rb:20:in `setup'

  8) Error:
TreeSitter::NodeTest#test_gets_node_text:
RuntimeError: Invalid native function pointer (com.oracle.truffle.llvm.runtime.except.LLVMNativePointerException)
Translated to internal error
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:79:in `rb_document_set_language'
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:37:in `rb_document_new'
    /Users/fniephaus/bin/graalvm-ce-java11-21.1.0/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `initialize'
    /Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_node.rb:20:in `setup'

  9) Error:
TreeSitter::NodeTest#test_gets_node_type:
RuntimeError: Invalid native function pointer (com.oracle.truffle.llvm.runtime.except.LLVMNativePointerException)
Translated to internal error
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:79:in `rb_document_set_language'
    /Users/fniephaus/dev/ruby-tree-sitter/ext/tree-sitter/document.c:37:in `rb_document_new'
    /Users/fniephaus/bin/graalvm-ce-java11-21.1.0/Contents/Home/languages/ruby/lib/truffle/truffle/cext_ruby.rb:41:in `initialize'
    /Users/fniephaus/dev/ruby-tree-sitter/test/tree-sitter/test_node.rb:20:in `setup'

13 runs, 5 assertions, 1 failures, 8 errors, 0 skips
eregon commented 3 years ago

When I run it I get different errors:

  1) Error:
TreeSitter::NodeTest#test_gets_children:
RuntimeError: External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)
Translated to internal error
    /home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
    /home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
    /home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_node.rb:20:in `setup'

  2) Error:
TreeSitter::NodeTest#test_gets_children_node_type:
RuntimeError: External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)
Translated to internal error
    /home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
    /home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
    /home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_node.rb:20:in `setup'

  3) Error:
TreeSitter::NodeTest#test_gets_node_text:
RuntimeError: External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)
Translated to internal error
    /home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
    /home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
    /home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_node.rb:20:in `setup'

  4) Error:
TreeSitter::NodeTest#test_gets_node_type:
RuntimeError: External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)
Translated to internal error
    /home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
    /home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
    /home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_node.rb:20:in `setup'

  5) Error:
TreeSitter::DocumentTest#test_that_it_accepts_string_inputs:
RuntimeError: External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)
Translated to internal error
    /home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
    /home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
    /home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:46:in `test_that_it_accepts_string_inputs'

  6) Failure:
TreeSitter::DocumentTest#test_that_it_does_not_accept_non_string_languages [/home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:25]:
[TypeError] exception expected, not
Class: <RuntimeError>
Message: <"External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)\nTranslated to internal error">
---Backtrace---
/home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
/home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
/home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:26:in `block in test_that_it_does_not_accept_non_string_languages'
---------------

  7) Error:
TreeSitter::DocumentTest#test_that_it_accepts_string_languages:
RuntimeError: External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)
Translated to internal error
    /home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
    /home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
    /home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:31:in `test_that_it_accepts_string_languages'

  8) Error:
TreeSitter::DocumentTest#test_that_it_creates_documents:
RuntimeError: External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)
Translated to internal error
    /home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
    /home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
    /home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:7:in `test_that_it_creates_documents'

  9) Failure:
TreeSitter::DocumentTest#test_that_unknown_languages_error [/home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:40]:
[TreeSitter::DocumentError] exception expected, not
Class: <RuntimeError>
Message: <"External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)\nTranslated to internal error">
---Backtrace---
/home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
/home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
/home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:41:in `block in test_that_unknown_languages_error'
---------------

 10) Error:
TreeSitter::DocumentTest#test_that_it_parses_valid_input:
RuntimeError: External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)
Translated to internal error
    /home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
    /home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
    /home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:68:in `test_that_it_parses_valid_input'

 11) Failure:
TreeSitter::DocumentTest#test_that_it_requires_language_key [/home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:13]:
[TypeError] exception expected, not
Class: <RuntimeError>
Message: <"External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)\nTranslated to internal error">
---Backtrace---
/home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
/home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
/home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:14:in `block in test_that_it_requires_language_key'
---------------

 12) Failure:
TreeSitter::DocumentTest#test_that_it_does_not_accept_non_string_inputs [/home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:19]:
[TypeError] exception expected, not
Class: <RuntimeError>
Message: <"External LLVMFunction ts_document_new cannot be found. (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)\nTranslated to internal error">
---Backtrace---
/home/eregon/code/ruby-tree-sitter/ext/tree-sitter/document.c:11:in `rb_document_alloc'
/home/eregon/.rubies/truffleruby-dev/lib/truffle/truffle/cext.rb:1235:in `__allocate__'
/home/eregon/code/ruby-tree-sitter/test/tree-sitter/test_document.rb:20:in `block in test_that_it_does_not_accept_non_string_inputs'
---------------
$ nm tmp/x86_64-linux/stage/lib/tree-sitter/treesitter.so | grep ts_document_new
                 U ts_document_new

BTW I needed to apply this:

diff --git a/script/bootstrap b/script/bootstrap
index edde4bf..dbc26f5 100755
--- a/script/bootstrap
+++ b/script/bootstrap
@@ -8,4 +8,4 @@ git submodule update --init --recursive

 echo "==> Installing gem dependencies…"

-bundle install --path vendor/gems --local --standalone --clean "$@"
+bundle install --path vendor/gems --standalone --clean "$@"
diff --git a/tree-sitter.gemspec b/tree-sitter.gemspec
index 89bb7dd..8ca06e3 100644
--- a/tree-sitter.gemspec
+++ b/tree-sitter.gemspec
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
   spec.require_paths = %w(lib ext)

   spec.add_development_dependency 'awesome_print'
-  spec.add_development_dependency 'bundler', '~> 1.14'
+  # spec.add_development_dependency 'bundler', '~> 1.14'
   spec.add_development_dependency 'minitest', '~> 5.0'
   spec.add_development_dependency 'minitest-focus', '~> 1.1'
   spec.add_development_dependency 'pry-byebug', '~> 3.6'