Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler errors running :Neovim sync-parsers #580

Closed
3 tasks done
jaidetree opened this issue Sep 16, 2022 · 3 comments
Closed
3 tasks done

Compiler errors running :Neovim sync-parsers #580

jaidetree opened this issue Sep 16, 2022 · 3 comments
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.

Comments

@jaidetree
Copy link

jaidetree commented Sep 16, 2022

Prerequisites

  • I have read contribution guidelines
  • I am using the latest version of the plugin
  • I am using either 0.6 stable or the latest compiled neovim version

Neovim Version

0.8.0-dev-1093-g982fef601-dirty

Neorg setup

(use "nvim-neorg/neorg"
      {:requires ["nvim-neorg/neorg-telescope"
                  "max397574/neorg-contexts"
                  "nvim-lua/plenary.nvim"]
       :after ["nvim-treesitter"]
       :config #(let [neorg (require :neorg)
                      tscfg (require :nvim-treesitter.configs)]
                  (tscfg.setup {:ensure_installed [:norg]
                                :highlight {:enable true}})
                  (neorg.setup
                    {:load {:core.defaults {}
                            :core.norg.dirman {:config {:workspaces {:work "~/neorg/work"
                                                                     :personal "~/neorg/personal"}}}
                            :core.norg.concealer {}
                            :core.integrations.telescope {}
                                :external.context {}}}))})

Healthcheck

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - OK: `tree-sitter` found 0.20.7 (parser generator, only needed for :TSInstallFromGrammar)
  - WARNING: `node` executable not found (only needed for :TSInstallFromGrammar, not required for :TSInstall)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: 
  - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

## Parser/Features H L F I J
  - clojure        ✓ ✓ ✓ . ✓
  - norg           ✓ . ✓ . ✓
  - help           ✓ . . . .
  - fennel         ✓ ✓ . . ✓
  - vim            ✓ ✓ ✓ . ✓
  - org            ✓ . . . ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

Actual behavior

Running :TSInstall norg works
[nvim-treesitter] [0/1] Downloading tree-sitter-norg...
[nvim-treesitter] [0/1] Creating temporary directory
[nvim-treesitter] [0/1] Extracting tree-sitter-norg...
[nvim-treesitter] [0/1] Compiling...
[nvim-treesitter] [1/1] Treesitter parser for norg has been installed
Running :Neorg sync-parsers results in a compile error
[nvim-treesitter] [0/2] Downloading tree-sitter-norg...
[nvim-treesitter] [0/2] Downloading tree-sitter-norg_meta...
[nvim-treesitter] [0/2] Creating temporary directory
[nvim-treesitter] [0/2] Extracting tree-sitter-norg_meta...
[nvim-treesitter] [0/2] Compiling...
[nvim-treesitter] [0/2] Creating temporary directory
[nvim-treesitter] [0/2] Extracting tree-sitter-norg...
[nvim-treesitter] [0/2] Compiling...
[nvim-treesitter] [1/2] Treesitter parser for norg_meta has been installed
nvim-treesitter[norg]: Error during compilation
src/scanner.cc:162:35: error: expected expression
    return std::vector<TokenType>({lhs, static_cast<TokenType>(rhs)});
                                  ^
src/scanner.cc:165:23: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
std::vector<TokenType>&& operator|(std::vector<TokenType>&& lhs, TokenType rhs)
                      ^
src/scanner.cc:165:58: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
std::vector<TokenType>&& operator|(std::vector<TokenType>&& lhs, TokenType rhs)
                                                         ^
src/scanner.cc:177:10: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
    for (auto& elem : vec)
         ^
src/scanner.cc:177:21: warning: range-based for loop is a C++11 extension [-Wc++11-extensions]
    for (auto& elem : vec)
                    ^
src/scanner.cc:542:28: error: expected ';' at end of declaration list
    size_t& get_tag_level() noexcept { return m_TagLevel; }
                           ^
                           ;
src/scanner.cc:919:23: warning: default member initializer for non-static data member is a C++11 extension [-Wc++11-extensions]
    size_t m_TagLevel = 0;
                      ^
src/scanner.cc:923:27: warning: default member initializer for non-static data member is a C++11 extension [-Wc++11-extensions]
    TokenType m_LastToken = NONE;
                          ^
src/scanner.cc:926:26: warning: default member initializer for non-static data member is a C++11 extension [-Wc++11-extensions]
    size_t m_ParsedChars = 0;
                         ^
src/scanner.cc:929:54: warning: default member initializer for non-static data member is a C++11 extension [-Wc++11-extensions]
    const std::array<int32_t, 9> m_DetachedModifiers = {'*', '-', '>', '|', '=',
                                                     ^
src/scanner.cc:931:70: warning: default member initializer for non-static data member is a C++11 extension [-Wc++11-extensions]
    const std::unordered_map<int32_t, TokenType> m_AttachedModifiers = {
                                                                     ^
src/scanner.cc:931:72: error: non-aggregate type 'const std::unordered_map<int32_t, TokenType>' (aka 'const unordered_map<int, TokenType>') cannot be initialized with an initializer list
    const std::unordered_map<int32_t, TokenType> m_AttachedModifiers = {
                                                                       ^
src/scanner.cc:201:13: error: use of undeclared identifier 'advance'
            advance(lexer);
            ^
src/scanner.cc:209:13: error: use of undeclared identifier 'advance'
            advance(lexer);
            ^
src/scanner.cc:210:20: error: use of undeclared identifier 'parse_text'
            return parse_text(lexer);
                   ^
src/scanner.cc:214:13: error: use of undeclared identifier 'advance'
            advance(lexer);
            ^
src/scanner.cc:223:17: error: use of undeclared identifier 'advance'
                advance(lexer);
                ^
src/scanner.cc:236:17: error: use of undeclared identifier 'skip'
                skip(lexer);
                ^
src/scanner.cc:241:17: error: use of undeclared identifier 'advance'
                advance(lexer);
                ^
src/scanner.cc:251:21: error: use of undeclared identifier 'advance'
                    advance(lexer);
                    ^
src/scanner.cc:254:25: error: use of undeclared identifier 'advance'

Expected behavior

Running :Neorg sync-parsers compiles as expected

Steps to reproduce

  1. Run the following command env CC=gcc-11 neovim somefile.norg as per Getting weird errors on autocommands for *.norg #74
  2. In neovim, run :Neorg sync-parsers

Potentially conflicting plugins

No response

Other information

No response

Help

Yes, but I don't know how to start. I would need guidance (check question below)

Implementation help

Depends on the solutionspace. If it's a docs issue can help, maybe a config issue, but if it's in the weeds of clang or c++ issues I'm not going to be much help.

@jaidetree jaidetree added the bug Issues related to bugs. Please attach a severity, a priority and category with this label. label Sep 16, 2022
@jaidetree
Copy link
Author

nvim-neorg/tree-sitter-norg#7 (comment)

Had to downgrade command line tools

@leviouwendijk
Copy link

One other way, without requiring the manual downgrade (or other more elaborate efforts) is suggested here.

Basically:

brew install llvm
CC=/opt/homebrew/opt/llvm/bin/clang nvim -c 'TSInstallSync norg'

@jaidetree
Copy link
Author

One other way, without requiring the manual downgrade (or other more elaborate efforts) is suggested here.

Basically:

brew install llvm
CC=/opt/homebrew/opt/llvm/bin/clang nvim -c 'TSInstallSync norg'

Great find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.
Projects
None yet
Development

No branches or pull requests

2 participants