Compiling treesitter parsers
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
.15 Replies
Alternatively, does anyone know how to get stdlib.c when cross-compiling using the arm tool chain in the termux docker container?
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
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.
That file is provided by ndk-sysroot package.
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.
It's part of toolchain, just install clang.
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.
Install it where you want to compile.
I can install regular termux packages into the termx-package docker container?
Yup.
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.
I just want to double-check something here: are you saying that I can install the clang that would run on a phone inside of the docker container? And that this is usable in the docker container? Which would then compile for arm?
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.
My apology. I am literally confused now.
Is this the part that's confusing you? Cuz if so, we can just ignore it. It might have just been a misunderstanding between us.
the smallest c compliler on termux seems to be gcc
ive used it before but some parsers were broken when i used it
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.
I'm okay using a larger compiler if I can cross compile from a PC.