pistoletpierre / language-systemverilog

Atom SystemVerilog language support
MIT License
5 stars 2 forks source link

Failed to load a language-systemverilog package grammar #8

Open TechPeng opened 4 years ago

TechPeng commented 4 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.50.0 x64 Electron: 5.0.13 OS: Mac OS X 10.15.6 Thrown From: language-systemverilog package 1.0.0

Stack Trace

Failed to load a language-systemverilog package grammar

At Cannot find module './build/Release/tree_sitter_verilog_binding'
Require stack:
- /Users/techpeng/.atom/packages/language-systemverilog/node_modules/tree-sitter-verilog/index.js
- /Applications/Atom.app/Contents/Resources/app.asar/static/index.html in /Users/techpeng/.atom/packages/language-systemverilog/grammars/tree-sitter-systemverilog.cson

Error: Cannot find module './build/Release/tree_sitter_verilog_binding'
Require stack:
- /Users/techpeng/.atom/packages/language-systemverilog/node_modules/tree-sitter-verilog/index.js
- /Applications/Atom.app/Contents/Resources/app.asar/static/index.html
    at Module._resolveFilename (internal/modules/cjs/loader.js:683:15)
    at Module._resolveFilename (/Applications/Atom.app/Contents/Resources/electron.asar/common/reset-search-paths.js:43:12)
    at Function.get_Module._resolveFilename (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:155481)
    at Module.require (/app.asar/static/index.js:61:43)
    at require (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:146814)
    at /packages/language-systemverilog/node_modules/tree-sitter-verilog/index.js:2:20)
    at /packages/language-systemverilog/node_modules/tree-sitter-verilog/index.js:15:3)
    at Module.get_Module._compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:147498)
    at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:151046)
    at Module.load (internal/modules/cjs/loader.js:701:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:633:12)
    at Function.Module._load (internal/modules/cjs/loader.js:625:3)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (internal/modules/cjs/helpers.js:14:16)
    at customRequire (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:695414)
    at new TreeSitterGrammar (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:3105868)
    at GrammarRegistry.createGrammar (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:360435)
    at /Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:360276
    at /Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:582207
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:54:3)
  at /packages/language-systemverilog/grammars/tree-sitter-systemverilog.cson:1:1

Commands

Non-Core Packages

counter 0.3.5 
highlight-selected 0.17.0 
language-systemverilog 1.0.0 
split-diff 1.6.1 
Sublime-Style-Column-Selection 1.7.5 
pistoletpierre commented 4 years ago

My bad - I thought we had worked out all the bugs. I just unpublished the most recent release and put the improvement-in-progress (but still buggy) version on a branch. If you apm remove language-systemverilog && apm install language-systemverilog it'll be working like it was before.

drom commented 4 years ago

It looks like Mac-specific issue. I run only on Linux and it is fine. Looks like build/Release/tree_sitter_verilog_binding was not build during installation of tree-sitter-verilog

pistoletpierre commented 4 years ago

Do you remember if you had to do anything out of the ordinary when you got it working on MacOS? https://github.com/pistoletpierre/language-systemverilog/issues/4#issuecomment-537648579

i.e. was tree-sitter-verilog already installed prior to language-systemverilog & therefore you wouldn't have seen such an error?

drom commented 4 years ago

I don't own a Mac, and I have borrowed Mac for these experiments. I think that language-systemverilog will install tree-sitter-verilog as npm dependency. tree-sitter-verilog Installation requires Node GYP and C++ compiler configured. May that be a problem?

pistoletpierre commented 4 years ago

Ah ok. I put your tree-sitter code on a separate branch and reverted master for the time being. @TechPeng do you mind doing a few experiments with us since my Mac seems to not be having any issues with it anymore? (I was seeing a similar error before (https://github.com/pistoletpierre/language-systemverilog/issues/4#issuecomment-515642493), but it has since disappeared & I don't know off the top of my head how to get my computer back in to a state where the error would reappear)

@drom I would hope that if Node GYP, a C++ compiler, or anything else necessary to install prerequisites were not configured properly then apm would complain and not silently dismiss such an issue while reporting a successful package installation but you never know...

Could this be a potential fix? https://github.com/tree-sitter/tree-sitter-verilog/pull/44

drom commented 4 years ago

Could this be a potential fix? tree-sitter/tree-sitter-verilog#44

I don't think so. npm package already include C and H files.

drom commented 4 years ago

@drom I would hope that if Node GYP, a C++ compiler, or anything else necessary to install prerequisites were not configured properly then apm would complain and not silently dismiss such an issue while reporting a successful package installation but you never know...

What is the standard C++ compiler on Mac? XCode? I any quick way to check if it is installed? https://github.com/nodejs/node-gyp#on-macos ?

https://medium.com/@mrjohnkilonzi/how-to-resolve-no-xcode-or-clt-version-detected-d0cf2b10a750 xcode-select --install ?

Catalina isssue? https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md

pistoletpierre commented 4 years ago

@drom I would hope that if Node GYP, a C++ compiler, or anything else necessary to install prerequisites were not configured properly then apm would complain and not silently dismiss such an issue while reporting a successful package installation but you never know...

What is the standard C++ compiler on Mac? XCode? I any quick way to check if it is installed?

On MacOS, gcc/g++ are "secretly" clang (edit: unless you deliberately install gcc yourself). According to https://stackoverflow.com/questions/62366112/does-macos-come-built-in-with-the-clang-compiler-or-is-built-in-with-the-xcode-i, it's not included in a fresh MacOS installation but comes with XCode.

image image

@TechPeng do you mind doing which gcc and then $(which gcc) --help ?

pistoletpierre commented 4 years ago

Catalina isssue? https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md

I doubt it for my own case, but am not willing to rule it out for @TechPeng's case. I'm currently running Catalina and have not had problems installing other npm packages. Also, it was released on Oct 7 2019 (and I wasn't running any beta pre-release version) and I was having similar issue to @TechPeng when running the previous MacOS version (July 2019 - https://github.com/pistoletpierre/language-systemverilog/issues/4)

xcode-select --install ?

This wouldn't have been my issue when we first saw it last summer. I've had the XCode command-line developer tools installed & kept up-to-date for ages