termux-packages
termux-packages copied to clipboard
[Package]: Re-enable tinyCC
Why do you want to add this package to Termux?
The tinyCC compiler added PIE+Android support in https://repo.or.cz/tinycc.git/commit/ebaa5c81f43fc7963ee50fbb01729290e2349aa5 and the commit after it.
In an Alpine Linux Proot with the tcc package installed, tcc can produce working executables.
Home page URL
https://bellard.org/tcc
Source code URL
https://repo.or.cz/tinycc.git
Packaging policy acknowledgement
- [X] The requested package complies with Packaging Policy.
Additional information
No response
The last release for TinyCC was 5 years ago. In order for tinycc to be re-enabled, a new tagged release of tinycc is desired, (which I don't see happening anytime soon). tinycc-git package may be added (if someone is willing to maintain the package and keep it up to date with the git repository, and there is enough request for it).
In an Alpine Linux Proot with the tcc package installed, tcc can produce working executables.
That's cause it is running under prooted environment. If it works under proot, it doesn't gaurantee functionality without proot. Also proot will work-around pie around this PIE executables issue, which can't be done natively.
We can move to Git version without renaming.
Any request to use specific snapshot? The package in Alpine seems to use 750f0a3e3f11c1a442f00f017c2548a8f63e0b9f.
Alpine uses "0.9.27_git20220323" as the version string. Gentoo uses "0.9.27_p20211022". We are going to use "0.9.27-pYYYYMMDD" style of the version.
The Alpine snapshot does not seem to support PIE. Probably it just works as explaned in the other comment.
That's cause it is running under prooted environment. If it works under proot, it doesn't gaurantee functionality without proot. Also proot will work-around pie around this PIE executables issue, which can't be done natively.
Compiled it on termux and it works
git clone https://repo.or.cz/tinycc && cd tinycc./configuremake install./tcc helloworld.c(helloworld.c is a standard hello world)./a.out
Output is
Hello world
Example of using Git snapshot (from sdl-image package):
https://github.com/termux/termux-packages/blob/0c4b843f33bb757fe6951e1268841f82ac5048fd/x11-packages/sdl-image/build.sh#L5-L10
https://github.com/termux/termux-packages/blob/0c4b843f33bb757fe6951e1268841f82ac5048fd/x11-packages/sdl-image/build.sh#L13-L29
PR is welcome. Thanks.
We used to apply a patch so that crtbegin_dynamic.o and crtbegin_so.o are used instead of crt1.o and crti.o.
[EDIT] This was a reply to a now deleted comment as follows:
How does Termux handle crt1.o and crti.o? Can't find the files in any package other than the mingw ucrt cross compile package (using apt-file)
We used to apply a patch so that
crtbegin_dynamic.oandcrtbegin_so.oare used instead ofcrt1.oandcrti.o.[EDIT] This was a reply to a now deleted comment as follows:
How does Termux handle crt1.o and crti.o? Can't find the files in any package other than the mingw ucrt cross compile package (using apt-file)
Ah ok. Sorry for deleting it, I'd forgotten that Termux was bionic only.
What's the right way to express interest in having tiny CC on termux? I'm interested. Some stuff requires a c compiler and I don't want to give up like 200 MB of space for it. My use cases are for chicken scheme and compiling tree sitter parsers for neovim. And luarocks.