#Compiling treesitter parsers

24 messages · Page 1 of 1 (latest)

pallid tangle
#

I'm trying to compile treesitter parsers without installing clang or gcc on my phone. Has anyone else managed to do this?

I've tried two approaches so far: tiny C compiler on my phone and cross compiling from my desktop for my phone. I'm running into roadblocks with both. So far the problem has been missing headers.

  • With TCC, I'm missing the wctype.h header. There may be others, but that's as far as compilation gets.
  • With the arm toolchain in the termux-packages docker container, it's missing stdlib.h.
pallid tangle
#

Alternatively, does anyone know how to get stdlib.c when cross-compiling using the arm tool chain in the termux docker container?

low aspen
#

With the arm toolchain in the termux-packages docker container, it's missing stdlib.h.
It's in /data/data/com.termux/files/usr/include/stdlib.h

pallid tangle
#

So I should copy it from my phone to the docker container?

#

It seems weird that the header is on my phone and not available in the docker container.

#

I was expecting a path in the docker container.

low aspen
#

That file is provided by ndk-sysroot package.

pallid tangle
#

So you're telling me that I should include a directory from the ndk-sysroot package when compiling my tree sitter parser? Is that something people commonly do when cross compiling for Termux?

#

I'm surprised because the standard library is in a separate package and not part of the toolchain.

low aspen
#

It's part of toolchain, just install clang.

pallid tangle
#

Install clang where? On my phone or on the docker container? Because I'm trying to do this in the docker container. I do not want to do this using clang on my phone, I don't have the space for that.

#

There's two options. On my phone, I'm using TCC the tiny C compiler. Otherwise I'm using the docker container on my desktop. I'm looking for help using only those two. Unless you know of another option where I can compile a c program on my phone and the compiler doesn't take more than like 10 megabytes.

low aspen
#

Install it where you want to compile.

pallid tangle
#

I can install regular termux packages into the termx-package docker container?

low aspen
#

Yup.

pallid tangle
#

Okay. Clang is already part of the docker container. But I'm not seeing a cross compilation target for arm processors.

#

And I didn't see a clang package that said it was for cross compilation for arm processors.

pallid tangle
#

If so, can you tell me how to do that because I'm not aware of how. I know I can build a package for installation in termux on my phone, which is not the same as using that package in the docker container.

low aspen
#

My apology. I am literally confused now.

pallid tangle
true wren
pallid tangle
#

TCC (tiny c compiler) is smaller and currently available

#

I'm having trouble finding GCC to verify my claim. But TCC is 1.5MB installed.