genotrance / nimtreesitter

treesitter is a Nim wrapper for the tree-sitter library
MIT License
25 stars 4 forks source link

Simple ruby parser fails to build #5

Open vitaliel opened 2 years ago

vitaliel commented 2 years ago

Hi,

I tried this small example, but it fails to build, it seems it fails to link binary.

import treesitter/api
import treesitter_ruby/ruby

var p = tsParserNew()

assert p.tsParserSetLanguage(treeSitterruby()) == true

let code = """
puts "Hello"
"""

let tree = p.tsParserParseString(nil, code.cstring, code.len.uint32)

p.tsParserDelete()

Error:

nim c ruby_parser.nim
...........................................................................
/home/lz/snippets/nim/ruby_parser.nim(12, 5) Hint: 'tree' is declared but not used [XDeclaredButNotUsed]
CC: ruby_parser.nim
Hint:  [Link]
/bin/ld: /home/lz/.cache/nim/ruby_parser_d/scannerruby.o: in function `(anonymous namespace)::Heredoc::Heredoc()':
scanner.cc:(.text+0x14): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'
/bin/ld: /home/lz/.cache/nim/ruby_parser_d/scannerruby.o: in function `(anonymous namespace)::Scanner::serialize(char*)':
scanner.cc:(.text+0x323): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
...

/bin/ld: /home/lz/.cache/nim/ruby_parser_d/scannerruby.o:(.data.rel.local.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
Error: execution of an external program failed: 'gcc   -o /home/lz/snippets/nim/ruby_parser  /home/lz/.cache/nim/ruby_parser_d/lib.c.o /home/lz/.cache/nim/ruby_parser_d/parserruby.o /home/lz/.cache/nim/ruby_parser_d/scannerruby.o /home/lz/.cache/nim/ruby_parser_d/stdlib_digitsutils.nim.c.o /home/lz/.cache/nim/ruby_parser_d/stdlib_assertions.nim.c.o /home/lz/.cache/nim/ruby_parser_d/stdlib_dollars.nim.c.o /home/lz/.cache/nim/ruby_parser_d/stdlib_system.nim.c.o /home/lz/.cache/nim/ruby_parser_d/@mruby_parser.nim.c.o  -lm -lm   -ldl'