nvim-neorg/tree-sitter-norg

Macos startup errors

molleweide opened this issue · 6 comments

Yo!

I use doom-nvim and .norg i not working on neither of my old intel macbook pro or my new M1 macbook air.

M1 startup error

nvim-treesitter[norg]: Error during compilation
Undefined symbols for architecture arm64:
  "_tree_sitter_norg_external_scanner_create", referenced from:
      _tree_sitter_norg.language in parser-29db6d.o
  "_tree_sitter_norg_external_scanner_deserialize", referenced from:
      _tree_sitter_norg.language in parser-29db6d.o
  "_tree_sitter_norg_external_scanner_destroy", referenced from:
      _tree_sitter_norg.language in parser-29db6d.o
  "_tree_sitter_norg_external_scanner_scan", referenced from:
      _tree_sitter_norg.language in parser-29db6d.o
  "_tree_sitter_norg_external_scanner_serialize", referenced from:
      _tree_sitter_norg.language in parser-29db6d.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Intel startup error

nvim-treesitter[norg]: Error during compilation
Undefined symbols for architecture x86_64:
  "_tree_sitter_norg_external_scanner_create", referenced from:
      _language.0 in cc3MwxxW.o
  "_tree_sitter_norg_external_scanner_deserialize", referenced from:
      _language.0 in cc3MwxxW.o
  "_tree_sitter_norg_external_scanner_destroy", referenced from:
      _language.0 in cc3MwxxW.o
  "_tree_sitter_norg_external_scanner_scan", referenced from:
      _language.0 in cc3MwxxW.o
  "_tree_sitter_norg_external_scanner_serialize", referenced from:
      _language.0 in cc3MwxxW.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

When syncing plugins in doom nvim this info is given:
vhyrro/neorg/unstable: updated: 1a85556...6c01988

and this is what is given on M1:
✓ vhyrro/neorg/unstable: already up to date

Welp, that's not good. A lot of this comes from clang being nasty on MacOS. nvim-treesitter guys are working on it from what I know. Dany has a workaround here if you haven't seen that already, although I don't know how applicable it is in your scenario. If all fails then the best thing you can do is unfortunately wait i suppose

The error points to fact that src/scanner.cc was not compiled. Make sure you add it to sources of nvim-treesitter norg parser config.

Hmm. I'd imagine doom has the scanner.cc set up properly. @molleweide you are running on the latest doom version right?

cnt0 commented

I got such error too. This part of my config was problematic:

local parser_configs = tsparsers.get_parser_configs()
parser_configs.norg = {
  install_info = {
    url = "https://github.com/vhyrro/tree-sitter-norg",
    files = { "src/parser.c" },
    branch = "main"
  },
}

as @JoeyGrajciar pointed, you need to add src/scanner.cc here:

local parser_configs = tsparsers.get_parser_configs()
parser_configs.norg = {
  install_info = {
    url = "https://github.com/vhyrro/tree-sitter-norg",
    files = { "src/parser.c", "src/scanner.cc" },
    branch = "main"
  },
}

also, clang from macos can't compile it anyway. So, brew install gcc or brew install llvm and start nvim like

CC=/opt/homebrew/Cellar/gcc/11.2.0/bin/gcc-11 nvim

you can then run TSUpdate and everything will be OK

Hi guys, my apologies for replying after so many days.

After having pulled doom-nvim main branch today, the errors pertaining to neorg have gone away. I will therefore close this becuase everything seems to be all good.