ruby-tree-sitter.old icon indicating copy to clipboard operation
ruby-tree-sitter.old copied to clipboard

Fails to build

Open akimd opened this issue 2 years ago • 2 comments

There are many warnings for repeated typedefs, and eventually the build fails. The file runtime/document.h does exist, so I guess this is only a matter of a missing -I. However I am not familiar with our the Makefiles etc. are generated, so I have no clue about where the fix should be applied. This is unfortunately, and is kind of a show-stopper, although tree-sitter is particularly interesting.

Installing tree-sitter 0.1.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter
/opt/local/bin/ruby3.1 -I /opt/local/lib/ruby3.1/3.1.0 -r ./siteconf20220521-14674-qvnfq6.rb extconf.rb
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/document.o tree-sitter/src/runtime/document.c -fPIC -std=c99
-Wall -O2
In file included from tree-sitter/src/runtime/document.c:2:
In file included from tree-sitter/src/runtime/node.h:4:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:14:24: warning: redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
tree-sitter/src/../include/tree_sitter/parser.h:12:18: note: previous definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from tree-sitter/src/runtime/document.c:2:
In file included from tree-sitter/src/runtime/node.h:4:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:15:27: warning: redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
tree-sitter/src/../include/tree_sitter/parser.h:94:3: note: previous definition is here
} TSLanguage;
  ^
2 warnings generated.
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/get_changed_ranges.o
tree-sitter/src/runtime/get_changed_ranges.c -fPIC -std=c99 -Wall -O2
In file included from tree-sitter/src/runtime/get_changed_ranges.c:1:
In file included from tree-sitter/src/runtime/get_changed_ranges.h:4:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:14:24: warning: redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
tree-sitter/src/../include/tree_sitter/parser.h:12:18: note: previous definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from tree-sitter/src/runtime/get_changed_ranges.c:1:
In file included from tree-sitter/src/runtime/get_changed_ranges.h:4:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:15:27: warning: redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
tree-sitter/src/../include/tree_sitter/parser.h:94:3: note: previous definition is here
} TSLanguage;
  ^
2 warnings generated.
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/language.o tree-sitter/src/runtime/language.c -fPIC -std=c99
-Wall -O2
In file included from tree-sitter/src/runtime/language.c:1:
In file included from tree-sitter/src/runtime/language.h:9:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:14:24: warning: redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
tree-sitter/src/../include/tree_sitter/parser.h:12:18: note: previous definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from tree-sitter/src/runtime/language.c:1:
In file included from tree-sitter/src/runtime/language.h:9:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:15:27: warning: redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
tree-sitter/src/../include/tree_sitter/parser.h:94:3: note: previous definition is here
} TSLanguage;
  ^
2 warnings generated.
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/lexer.o tree-sitter/src/runtime/lexer.c -fPIC -std=c99 -Wall
-O2
In file included from tree-sitter/src/runtime/lexer.c:2:
In file included from tree-sitter/src/runtime/lexer.h:9:
tree-sitter/src/../include/tree_sitter/runtime.h:14:24: warning: redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
tree-sitter/src/../include/tree_sitter/parser.h:12:18: note: previous definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from tree-sitter/src/runtime/lexer.c:2:
In file included from tree-sitter/src/runtime/lexer.h:9:
tree-sitter/src/../include/tree_sitter/runtime.h:15:27: warning: redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
tree-sitter/src/../include/tree_sitter/parser.h:94:3: note: previous definition is here
} TSLanguage;
  ^
2 warnings generated.
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/node.o tree-sitter/src/runtime/node.c -fPIC -std=c99 -Wall -O2
In file included from tree-sitter/src/runtime/node.c:2:
In file included from tree-sitter/src/runtime/node.h:4:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:14:24: warning: redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
tree-sitter/src/../include/tree_sitter/parser.h:12:18: note: previous definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from tree-sitter/src/runtime/node.c:2:
In file included from tree-sitter/src/runtime/node.h:4:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:15:27: warning: redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
tree-sitter/src/../include/tree_sitter/parser.h:94:3: note: previous definition is here
} TSLanguage;
  ^
2 warnings generated.
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/parser.o tree-sitter/src/runtime/parser.c -fPIC -std=c99 -Wall
-O2
In file included from tree-sitter/src/runtime/parser.c:1:
In file included from tree-sitter/src/runtime/parser.h:8:
In file included from tree-sitter/src/runtime/stack.h:9:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:14:24: warning: redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
tree-sitter/src/../include/tree_sitter/parser.h:12:18: note: previous definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from tree-sitter/src/runtime/parser.c:1:
In file included from tree-sitter/src/runtime/parser.h:8:
In file included from tree-sitter/src/runtime/stack.h:9:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:15:27: warning: redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
tree-sitter/src/../include/tree_sitter/parser.h:94:3: note: previous definition is here
} TSLanguage;
  ^
2 warnings generated.
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/stack.o tree-sitter/src/runtime/stack.c -fPIC -std=c99 -Wall
-O2
In file included from tree-sitter/src/runtime/stack.c:2:
In file included from tree-sitter/src/runtime/language.h:9:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:14:24: warning: redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
tree-sitter/src/../include/tree_sitter/parser.h:12:18: note: previous definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from tree-sitter/src/runtime/stack.c:2:
In file included from tree-sitter/src/runtime/language.h:9:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:15:27: warning: redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
tree-sitter/src/../include/tree_sitter/parser.h:94:3: note: previous definition is here
} TSLanguage;
  ^
2 warnings generated.
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/string_input.o tree-sitter/src/runtime/string_input.c -fPIC
-std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/tree.o tree-sitter/src/runtime/tree.c -fPIC -std=c99 -Wall -O2
In file included from tree-sitter/src/runtime/tree.c:8:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:14:24: warning: redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
tree-sitter/src/../include/tree_sitter/parser.h:12:18: note: previous definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from tree-sitter/src/runtime/tree.c:8:
In file included from tree-sitter/src/runtime/tree.h:10:
tree-sitter/src/../include/tree_sitter/runtime.h:15:27: warning: redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
tree-sitter/src/../include/tree_sitter/parser.h:94:3: note: previous definition is here
} TSLanguage;
  ^
2 warnings generated.
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/utf16.o tree-sitter/src/runtime/utf16.c -fPIC -std=c99 -Wall
-O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/utf8proc.o tree-sitter/externals/utf8proc/utf8proc.c -fPIC
-std=c99 -Wall -O2
[Link (Static)]
creating Makefile

current directory: /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter
make DESTDIR\= clean

current directory: /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter
make DESTDIR\=
compiling document.c
In file included from document.c:1:
In file included from ./document.h:6:
In file included from ./tree-sitter.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/document.h:4:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/parser.h:8:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/stack.h:8:
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/array.h:98:40: warning: implicit conversion
loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
    array__reserve(self, element_size, new_capacity);
    ~~~~~~~~~~~~~~                     ^~~~~~~~~~~~
In file included from document.c:1:
In file included from ./document.h:6:
In file included from ./tree-sitter.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/document.h:4:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/parser.h:8:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/stack.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/tree.h:10:
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/runtime.h:14:24: warning:
redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/parser.h:12:18: note: previous
definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from document.c:1:
In file included from ./document.h:6:
In file included from ./tree-sitter.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/document.h:4:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/parser.h:8:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/stack.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/tree.h:10:
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/runtime.h:15:27: warning:
redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/parser.h:94:3: note: previous
definition is here
} TSLanguage;
  ^
In file included from document.c:1:
In file included from ./document.h:6:
In file included from ./tree-sitter.h:13:
./node.h:18:13: warning: unused function 'rb_node_free' [-Wunused-function]
static void rb_node_free(void *n);
            ^
4 warnings generated.
compiling node.c
In file included from node.c:1:
In file included from ./node.h:5:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/document.h:4:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/parser.h:8:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/stack.h:8:
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/array.h:98:40: warning: implicit conversion
loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
    array__reserve(self, element_size, new_capacity);
    ~~~~~~~~~~~~~~                     ^~~~~~~~~~~~
In file included from node.c:1:
In file included from ./node.h:5:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/document.h:4:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/parser.h:8:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/stack.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/tree.h:10:
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/runtime.h:14:24: warning:
redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/parser.h:12:18: note: previous
definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from node.c:1:
In file included from ./node.h:5:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/document.h:4:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/parser.h:8:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/stack.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/tree.h:10:
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/runtime.h:15:27: warning:
redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/parser.h:94:3: note: previous
definition is here
} TSLanguage;
  ^
In file included from node.c:1:
In file included from ./node.h:6:
In file included from ./tree-sitter.h:12:
./document.h:11:14: warning: unused function 'rb_document_alloc' [-Wunused-function]
static VALUE rb_document_alloc(VALUE self);
             ^
4 warnings generated.
compiling tree-sitter.c
In file included from tree-sitter.c:1:
In file included from ./tree-sitter.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/document.h:4:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/parser.h:8:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/stack.h:8:
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/array.h:98:40: warning: implicit conversion
loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
    array__reserve(self, element_size, new_capacity);
    ~~~~~~~~~~~~~~                     ^~~~~~~~~~~~
In file included from tree-sitter.c:1:
In file included from ./tree-sitter.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/document.h:4:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/parser.h:8:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/stack.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/tree.h:10:
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/runtime.h:14:24: warning:
redefinition of typedef 'TSSymbol' is a C11 feature [-Wtypedef-redefinition]
typedef unsigned short TSSymbol;
                       ^
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/parser.h:12:18: note: previous
definition is here
typedef uint16_t TSSymbol;
                 ^
In file included from tree-sitter.c:1:
In file included from ./tree-sitter.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/document.h:4:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/parser.h:8:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/stack.h:9:
In file included from /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/src/runtime/tree.h:10:
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/runtime.h:15:27: warning:
redefinition of typedef 'TSLanguage' is a C11 feature [-Wtypedef-redefinition]
typedef struct TSLanguage TSLanguage;
                          ^
/Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter/tree-sitter/include/tree_sitter/parser.h:94:3: note: previous
definition is here
} TSLanguage;
  ^
tree-sitter.c:5:9: warning: unused variable 'tree_sitter' [-Wunused-variable]
  VALUE tree_sitter = rb_define_module("TreeSitter");
        ^
In file included from tree-sitter.c:1:
In file included from ./tree-sitter.h:12:
./document.h:11:14: warning: unused function 'rb_document_alloc' [-Wunused-function]
static VALUE rb_document_alloc(VALUE self);
             ^
In file included from tree-sitter.c:1:
In file included from ./tree-sitter.h:13:
./node.h:18:13: warning: unused function 'rb_node_free' [-Wunused-function]
static void rb_node_free(void *n);
            ^
6 warnings generated.
compiling out/node/binding.cc
In file included from out/node/binding.cc:2:
./node.h:5:10: fatal error: 'runtime/document.h' file not found
#include "runtime/document.h"
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Makefile:214 : out/node/binding.o] Erreur 1

make failed, exit code 2

Gem files will remain installed in /Users/akim/src/proj/vendor/ruby/3.1.0/gems/tree-sitter-0.1.0 for inspection.
Results logged to /Users/akim/src/proj/vendor/ruby/3.1.0/extensions/arm64-darwin-21/3.1.0/tree-sitter-0.1.0/gem_make.out

  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/builder.rb:95:in `run'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/builder.rb:44:in `block in make'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/builder.rb:36:in `each'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/builder.rb:36:in `make'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/ext_conf_builder.rb:63:in `block in build'
  /opt/local/lib/ruby3.1/3.1.0/tempfile.rb:317:in `open'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/builder.rb:161:in `build_extension'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/builder.rb:195:in `block in build_extensions'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/builder.rb:192:in `each'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/ext/builder.rb:192:in `build_extensions'
  /opt/local/lib/ruby3.1/3.1.0/rubygems/installer.rb:853:in `build_extensions'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/rubygems_gem_installer.rb:71:in `build_extensions'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/rubygems_gem_installer.rb:28:in `install'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/source/rubygems.rb:200:in `install'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/installer/gem_installer.rb:54:in `install'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/installer/parallel_installer.rb:186:in `do_install'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/worker.rb:62:in `apply_func'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/worker.rb:57:in `block in process_queue'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/worker.rb:54:in `loop'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/worker.rb:54:in `process_queue'
  /Users/akim/src/proj/vendor/ruby/3.1.0/gems/bundler-2.2.32/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing tree-sitter (0.1.0), and Bundler cannot continue.

In Gemfile:
  tree-sitter

This is macOS 12.3.1, using MacPorts.

akimd avatar May 21 '22 07:05 akimd

In case this would be helpful to anyone, I believe the following self-contained GitHub Actions workflow essentially recreates this issue:

name: Test Tree Sitter Ruby bindings
on: workflow_dispatch
jobs:
  build:
    runs-on: ubuntu-20.04
    steps:
      - name: Set up Tree Sitter parser directory
        run: |
          mkdir -p $HOME/tree-sitter/parsers
          git -C $HOME/tree-sitter/parsers clone https://github.com/tree-sitter/tree-sitter-python
      - name: Install Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.1
      - name: Install Tree Sitter Ruby bindings
        run: TREE_SITTER_PARSER_DIR=$HOME/tree-sitter/parsers gem install tree-sitter

The exact logs from running this workflow are as follows:

Click to expand
Building native extensions. This could take a while...
ERROR:  Error installing tree-sitter:
    ERROR: Failed to build gem native extension.

    current directory: /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter
/opt/hostedtoolcache/Ruby/3.1.2/x64/bin/ruby -I /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/3.1.0 -r ./siteconf20220724-2079-rgunfm.rb extconf.rb
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/stack.o tree-sitter/src/runtime/stack.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/lexer.o tree-sitter/src/runtime/lexer.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/get_changed_ranges.o tree-sitter/src/runtime/get_changed_ranges.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/language.o tree-sitter/src/runtime/language.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/node.o tree-sitter/src/runtime/node.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/parser.o tree-sitter/src/runtime/parser.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/utf16.o tree-sitter/src/runtime/utf16.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/document.o tree-sitter/src/runtime/document.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/string_input.o tree-sitter/src/runtime/string_input.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/tree.o tree-sitter/src/runtime/tree.c -fPIC -std=c99 -Wall -O2
cc -c -Itree-sitter/src -Itree-sitter/src/../include  -Itree-sitter/externals/utf8proc -o out/utf8proc.o tree-sitter/externals/utf8proc/utf8proc.c -fPIC -std=c99 -Wall -O2
[Link (Static)]
creating Makefile

current directory: /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter
make DESTDIR\= clean

current directory: /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/tree-sitter-0.1.0/ext/tree-sitter
make DESTDIR\=
compiling document.c
document.c: In function ‘rb_document_new’:
document.c:26:15: warning: variable ‘document’ set but not used [-Wunused-but-set-variable]
   26 |   TSDocument *document;
      |               ^~~~~~~~
In file included from tree-sitter.h:13,
                 from document.h:6,
                 from document.c:1:
document.c: At top level:
node.h:18:13: warning: ‘rb_node_free’ declared ‘static’ but never defined [-Wunused-function]
   18 | static void rb_node_free(void *n);
      |             ^~~~~~~~~~~~
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
compiling node.c
In file included from tree-sitter.h:12,
                 from node.h:6,
                 from node.c:1:
document.h:11:14: warning: ‘rb_document_alloc’ declared ‘static’ but never defined [-Wunused-function]
   11 | static VALUE rb_document_alloc(VALUE self);
      |              ^~~~~~~~~~~~~~~~~
document.h:8:14: warning: ‘rb_eDocumentError’ defined but not used [-Wunused-variable]
    8 | static VALUE rb_eDocumentError;
      |              ^~~~~~~~~~~~~~~~~
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
compiling tree-sitter.c
tree-sitter.c: In function ‘Init_treesitter’:
tree-sitter.c:5:9: warning: unused variable ‘tree_sitter’ [-Wunused-variable]
    5 |   VALUE tree_sitter = rb_define_module("TreeSitter");
      |         ^~~~~~~~~~~
In file included from tree-sitter.h:12,
                 from tree-sitter.c:1:
tree-sitter.c: At top level:
document.h:11:14: warning: ‘rb_document_alloc’ declared ‘static’ but never defined [-Wunused-function]
   11 | static VALUE rb_document_alloc(VALUE self);
      |              ^~~~~~~~~~~~~~~~~
In file included from tree-sitter.h:13,
                 from tree-sitter.c:1:
node.h:18:13: warning: ‘rb_node_free’ declared ‘static’ but never defined [-Wunused-function]
   18 | static void rb_node_free(void *n);
      |             ^~~~~~~~~~~~
In file included from tree-sitter.h:12,
                 from tree-sitter.c:1:
document.h:8:14: warning: ‘rb_eDocumentError’ defined but not used [-Wunused-variable]
    8 | static VALUE rb_eDocumentError;
      |              ^~~~~~~~~~~~~~~~~
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
compiling out/node/binding.cc
In file included from out/node/binding.cc:2:
./node.h:5:10: fatal error: runtime/document.h: No such file or directory
    5 | #include "runtime/document.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:214: out/node/binding.o] Error 1

make failed, exit code 2

Gem files will remain installed in /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/tree-sitter-0.1.0 for inspection.
Results logged to /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/tree-sitter-0.1.0/gem_make.out
Error: Process completed with exit code 1.

andrewtbiehl avatar Jul 24 '22 20:07 andrewtbiehl

AFAICT this implementation is not maintained. I have moved successfully to use Grenadier instead. https://github.com/stackmystack/grenadier

akimd avatar Jul 25 '22 07:07 akimd