-
Notifications
You must be signed in to change notification settings - Fork 37
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
Unable to setup on mac #34
Comments
Same problem! I think it may have to do with clang vs gcc |
Yeah, I hit this too. The external scanner currently uses come C++14 features, and I guess the clang version on macOS doesn't support those by default. When the Tree-sitter CLI automatically compiles your parser, it just runs your C++ compiler with the default settings (as opposed to passing It'd be great to make that file a little bit more portable. I'm also open to making the Tree-sitter somehow smarter about passing those flags. It just makes the compilation process a bit more complex if you have to pass C++-specific flags. @tek I'd be curious about your opinion - how important is it that the external scanner makes uses of the latest and greatest C++ features? Would it be he hard to make it compile under C++11 semantics? |
@maxbrunsfeld not sure, but judging from the errors here it's struggling with some c++11 features (lambdas) |
I was able to build on macOS by specifying
|
I've been triaging tree-sitter/py-tree-sitter#64 and I have You can see which jobs pass from the top 3 actions here to see how passing the c++11, c++14, and c++17 flags affect a ~recent compiler on each OS: https://github.com/tree-sitter/py-tree-sitter/actions?query=branch%3Atest-haskell I vote for compiler supportYou can find compiler support here for c++14 and c++17
conclusionGCC 7 supports c++17, so think c++17 is a fairly reasonable target given these constraints. It excludes MSVC 14.0, but on Windows the MSVC version is separate from the OS version anyway so it's hopefully not too burdensome to recommend installing a current compiler there. Once this changes, I would appreciate |
sounds reasonable! |
May be it's worth to mention in tree-sitter/tree-sitter#930 |
tree-sitter-haskell requires C++14 due to generic lambdas. But nice that the MSVC error was fixed. |
Thanks for the fix @lunixbochs! I still get a failure when cross compiling to
|
Is that |
aarch64-unknown-linux-gnu |
Ah I didn't see that entry, anyway it's 4.8.2 as well. Looks like they're basing the image on Ubuntu 16.04, which is EOL: https://github.com/rust-embedded/cross/blob/master/docker/Dockerfile.aarch64-unknown-linux-gnu#L1 Even if they want to target an older glibc ABI, they should probably install a newer gcc. |
I have a similar but different problem installing on Mac, running
|
You're compiling a C++ file (.cc suffix) with a C compiler |
Which is how nvim-treesitter installs stuff. We're compiling C and C++ and linking in one go which causes some problems for Haskell because we can't set any C or C++ standard but rely on whatever is the default. cc is either gcc or clang and they usually set the language based on the filetype (except Apple clang is again different from normal clang). @nkpart can you make sure you have a C++ runtime installed libc++ on mac or I guess libstdc++ would maybe also work. |
Thanks, I've done some digging. As you all might know, nvim-treesitter uses https://github.com/nvim-treesitter/nvim-treesitter/blob/ddc0f1b606472b6a1ab85ee9becfd4877507627d/lua/nvim-treesitter/install.lua#L14 to figure out the compiler to use, and then this https://github.com/nvim-treesitter/nvim-treesitter/blob/ddc0f1b606472b6a1ab85ee9becfd4877507627d/lua/nvim-treesitter/shell_command_selectors.lua#L67-L75 for the argument set. Overriding either of those things is going to be enough to make the compile work. In my case, I could run |
I have gcc installed on mac. How do I install tree-sitter-haskell? It shows the error as mentioned by this issue. |
@aridgupta as @nkpart mentioned nvim-treesitter will respect the CC env variable. Set the environment variable CC=gcc or in lua |
@theHamsta thank you. However, when I would update tree-sitter in the future, won't this fail again? |
Not when setting |
For anyone looking through this thread facing similar issues, I was having the same error message but on Ubuntu rather than Mac:
I tried require'nvim-treesitter.install'.compilers = { "clang" } |
made a note of it in the readme |
I will close this now. |
yo. I'm just chiming in to say I believe I've tried all of the above but things still don't seem to work. I am personally using macos catalina. Pretty much all errors I get look like this This is the last info: last part of err``` fatal error: too many errors emitted, stopping now [-ferror-limit=] 2 warnings and 20 errors generated. Error during compilation Failed to execute the following command: { cmd = "gcc", err = "Error during compilation", info = "Compiling...", opts = { args = { "-o", "parser.so", "-I./src", "src/parser.c", "src/scanner.cc", "-shared", "-Os", "-lstdc++", "-fPIC" }, cwd = "/Users/hjalmarjakobsson/.local/share/nvim/tree-sitter-haskell" } } ```What other places can I look at for problem solving? Is there some other secret place or file? I am also struggling to understand what C++-14 actually means. Does this mean I am using C++-12?:
|
I can't get this to work either. I've added |
@molleweide I solved it for me, maybe you're experiencing a similar issue. Basically, macOS symlinks I fixed it by linking the real gcc somewhere into my path with higher priority. |
made another note in the readme |
please share your experience so I can improve the instructions! |
With the hint from @chianuo it works now. Awesome. 🥳 |
it wooooooorks!!! 🥳 thanks @chianuo ❤️ |
I just got a new M1 mac and I notice that after following the instructions in the readme again
then |
yes it should be I submitted a PR with this. |
@archseer Could you tell how you specified |
Here's what worked for me, on an M1 mac:
At this point gcc-11 should be here:
And then just explicitly pass in gcc-11 to install.lua
This way you don't have to mess around with symlinks in |
I have this error while trying to setup tree-sitter haskell on a mac:
Do you have any ideas what I might be doing wrong?
I tried updating gcc on mac, but this still happens
The text was updated successfully, but these errors were encountered: