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

Automatically build tree-sitter-langs from source instead of downloading binaries on arm64 (m1) machines #36

Closed
shaunsingh opened this issue Aug 16, 2021 · 9 comments · Fixed by #73
Labels
enhancement New feature or request

Comments

@shaunsingh
Copy link

Hi, loving the idea (and treesitter on my x86 machine) so far. If emacs is running on an arm64 machine, would it be possible to have tree-sitter-langs automatically download the source and compile the parsers, insetad of download the binary and failing with no warning?

@ubolonton
Copy link
Collaborator

Yes, all the low-level building blocks are already in tree-sitter-langs-build.el, but they currently assume a cloned git repository. Some additional code to handle source downloading is needed.

@Mic92
Copy link

Mic92 commented Aug 24, 2021

In the meantime I think you can also use nix to download the grammars: https://github.com/Mic92/dotfiles/blob/3c99578315d30cd23ed2d4f7d8dbf560daaf2820/nixpkgs-config/modules/emacs/default.nix#L79

If that is not your cup of cake you can still configure emacs-tree-sitter to load grammars from a custom directory: https://github.com/Mic92/dotfiles/blob/3c99578315d30cd23ed2d4f7d8dbf560daaf2820/home/.doom.d/config.el#L187

@shaunsingh
Copy link
Author

I don't actually use nix on my m1/darwin machine, but I have compiled the parsers locally and am already loading them from a custom directory! This issue was just raised in the doom emacs server so I thought it would be nice to openan issue here

@shackra shackra added the enhancement New feature or request label Aug 25, 2021
@shaunsingh
Copy link
Author

@Mic92 have you run into an issue where tsc is build for the wrong architecture? (tsc-dyn.dylib' mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')

If so, do you have a nix way to solve it

@Mic92
Copy link

Mic92 commented Oct 26, 2021

No. But nix would also not have this issue on darwin/arm64.

@morphykuffour
Copy link

I have the tsc-dyn.aarch64-apple-darwin.dylib file downloaded how do I load the dynamic library in order to get emacs to (require 'tree-sitter). I have added the core, lisp, and langs to the load path. I am still getting the tsc-dyn error when I try to evaluate the load the tree-sitter plugin. See images below.

Screen Shot 2022-01-23 at 12 51 59 PM

Screen Shot 2022-01-23 at 12 52 53 PM

@ubolonton
Copy link
Collaborator

You will need to rename it to tsc-dyn.dylib and put it into core/.

@morphykuffour
Copy link

yeah did not work. I renamed the file and I put in the core directory of the elisp-tree-sitter git repo cloned on my manchine.
Screen Shot 2022-01-26 at 7 37 33 PM

@ubolonton
Copy link
Collaborator

ubolonton commented Jan 27, 2022

There’s not enough information to troubleshoot currently. Please describe what happened in more details, e.g. errors/backtraces. Minimal reproduction steps would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
5 participants