nvim-neorg / tree-sitter-norg

A TreeSitter parser for the Neorg File Format
MIT License
99 stars 14 forks source link

Error while compiling on Win10 #12

Closed kishikaisei closed 2 years ago

kishikaisei commented 3 years ago

I am running windows, and I have this after following the documentation:

Console output:

[nvim-treesitter] [0/1] Downloading...
[nvim-treesitter] [0/1] Checking out locked revision
[nvim-treesitter] [0/1] Compiling...
LINK : warning LNK4044: unrecognized option '/Z-reserved-lib-stdc++'; ignored^M
   Creating library parser.lib and object parser.exp^M
parser-d99b79.o : error LNK2001: unresolved external symbol tree_sitter_norg_external_scanner_create^M
parser-d99b79.o : error LNK2001: unresolved external symbol tree_sitter_norg_external_scanner_destroy^M
parser-d99b79.o : error LNK2001: unresolved external symbol tree_sitter_norg_external_scanner_scan^M
parser-d99b79.o : error LNK2001: unresolved external symbol tree_sitter_norg_external_scanner_serialize^M
parser-d99b79.o : error LNK2001: unresolved external symbol tree_sitter_norg_external_scanner_deserialize^M
parser.so : fatal error LNK1120: 5 unresolved externals^M
nvim-treesitter[norg]: Error during compilation
clang: error: linker command failed with exit code 1120 (use -v to see invocation)^M

I am pretty sure it use to work before, but for some reason not any more, and I couldn't make sense of what the issue is:

init.lua section:

local parser_configs = require('nvim-treesitter.parsers').get_parser_configs()

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

require'nvim-treesitter.configs'.setup {
    ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
    ignore_install = { "fortran" }, -- List of parsers to ignore installing
    highlight = {
        enable = true -- false will disable the whole extension
    },
    playground = {
        enable = true,
        disable = {},
        updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
        persist_queries = false -- Whether the query persists across vim sessions
    },
    autotag = {enable = true},
    rainbow = {enable = true}
    -- refactor = {highlight_definitions = {enable = true}}
}
mrossinek commented 3 years ago

I am not sure if this will resolve your issue but you need to update your config to also include src/scanner.cc like this:

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

See also here

vhyrro commented 3 years ago

yeah i believe that's the problem too :)

kishikaisei commented 3 years ago

It changed to this now:

[nvim-treesitter] [0/1] Downloading...
[nvim-treesitter] [0/1] Checking out locked revision
[nvim-treesitter] [0/1] Compiling...
nvim-treesitter[norg]: Error during compilation
src/scanner.cc:507:77: error: no matching function for call to 'ispunct'^M
            else if (m_TagStack.size() == 0 && (std::iswspace(m_Current) || std::ispunct(m_Current)) && lexer->lookahead == '[')^M
                                                                            ^~~~~~~~~~~~^M
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\locale:246:8: note: candidate function template not viable: requires 2 arguments, but 1 was provided^M
        bool (ispunct)(_Elem _Ch, const locale& _Loc)^M
              ^^M
1 error generated.^M
vhyrro commented 3 years ago

Hey, soz for the late reply man. There's been a tonne going on 😅. I think this may be fixed now (?). Try recompiling and see whether anything works.

kishikaisei commented 3 years ago

Jazz hands to you my dude, it works now!

kishikaisei commented 2 years ago

It seems like this issue reappeared, but only for norg, norg_meta and norg_table are all good though. image

vhyrro commented 2 years ago

Hey, could you retry now? I think it should be fixed :crossed_fingers:

kishikaisei commented 2 years ago

You fixed it before me getting my dinner XD Thanks and all praised to you