I have run the commands (adding -fPIC for linux). I can confirm that using the resulting shared object does not crash Emacs. A bit of experimentation reveals that the crash occurs only when the grammar is compiled with -O0. However, despite not crashing, Emacs does not parse the file successfully, although I agree this may be a separate issue. On Mon, Oct 16, 2023 at 21:29 Eli Zaretskii wrote: > [Please use Reply All when replying to keep the bug tracker CC'ed.] > > > From: Erik Overdahl > > Date: Mon, 16 Oct 2023 18:21:26 -0500 > > > > > After cloning the repository, I ran the following commands: > > > > > > cd src > > > gcc -O2 -I. -MMD -MF ./parser.d -MP -c -o parser.o parser.c > > > gcc -O2 -I. -MMD -MF ./scanner.d -MP -c -o scanner.o scanner.c > > > gcc -shared parser.o scanner.o -ltree-sitter -o > libtree-sitter-hcl.dll > > > > > > (This is on Windows, thus the .dll extension and no -fPIC compiler > > > switch.) Your link command line, viz.: > > > > > > cc -fPIC -shared *.o -o libtree-sitter-hcl.so > > > > > > lacks the -ltree-sitter switch, though, which may or may not be the > > > problem. > > > > If there is a problem with the command I used to build the grammar, then > there is a problem with the > > function `treesit-install-language-grammar`, as I copied the commands > directly from there. I imagine > > this is how most users would install this grammar? > > Maybe there is a problem, but please try compiling using the above > commands, and see if the problem is gone. We must establish the root > cause before we assign blame or consider where and how to fix the > problem. > > So: did the above commands fix the problem for you. > > > I have discovered another oddity. > > Thanks, but I'm not sure this is related. I think we should focus on > fixing the crash first. >