1

Here are the commands I'm running

First I install tree-sitter

make PREFIX=${HOME}/.tree-sitter
make PREFIX=${HOME}/.tree-sitter install

This populates ~/.tree-sitter directory

├── include
│   └── tree_sitter
│       └── api.h
└── lib
    ├── libtree-sitter.a
    ├── libtree-sitter.so -> libtree-sitter.so.0.0
    ├── libtree-sitter.so.0 -> libtree-sitter.so.0.0
    ├── libtree-sitter.so.0.0
    └── pkgconfig
        └── tree-sitter.pc

Then I install emacs

wget https://ftp.gnu.org/gnu/emacs/emacs-29.1.tar.gz
tar -xf emacs-29.1.tar.gz
cd emacs-29.1

TREE_SITTER_CFLAGS=-I~/.tree-sitter/include TREE_SITTER_LIBS="-L~/.tree-sitter/lib -ltree-sitter" ./configure --prefix=${HOME}/emacs --bindir=${HOME}/.local/bin --with-tree-sitter --with-gnutls=ifavailable

LD_LIBRARY_PATH=~/.tree-sitter/lib make install

And the last install command errors out with

  CC       emacs.o
In file included from emacs.c:142:
treesit.h:27:10: fatal error: tree_sitter/api.h: No such file or directory
   27 | #include <tree_sitter/api.h>
7
  • Was following this guide blog.markhepburn.com/posts/…
    – phoxd
    Commented Dec 4, 2023 at 21:16
  • Well does api.h actually exist in ~/.tree-sitter/include/tree_sitter?
    – nega
    Commented Dec 5, 2023 at 2:17
  • What OS are you using and what does sudo have to do with your question?
    – db48x
    Commented Dec 5, 2023 at 10:49
  • What I actually did is build emacs inside a container while mounting certain volumes and was able to run afterwards docker run -ti -v ~/repos/tree-sitter:/tree-sitter -v ~/emacs:${HOME}/emacs -v ~/.local/bin:/emacs-bin jammy
    – phoxd
    Commented Dec 5, 2023 at 18:56
  • That is a ridiculous amount of complexity to solve a trivial problem. What OS are you using, again? And what does sudo have to do with anything? Why aren’t you just installing Emacs (and, if necessary, treesitter) the normal way for your OS?
    – db48x
    Commented Dec 5, 2023 at 19:53

1 Answer 1

1

Why are you not using documented approach? eg

./configure --with-x-toolkit=lucid --with-tree-sitter --with-native-compilation

then

make -j$(nproc)

and finally sudo to install into usr/local

sudo make install

treesitter is included in 29 afaik.

1
  • probably because OP is trying to do it without sudo, of course
    – nega
    Commented Dec 7, 2023 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.