termux-packages icon indicating copy to clipboard operation
termux-packages copied to clipboard

[Package]: Re-enable tinyCC

Open Topkek-190 opened this issue 2 years ago • 8 comments

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

Additional information

No response

Topkek-190 avatar Feb 15 '23 13:02 Topkek-190

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.

thunder-coding avatar Feb 15 '23 13:02 thunder-coding

We can move to Git version without renaming.

Any request to use specific snapshot? The package in Alpine seems to use 750f0a3e3f11c1a442f00f017c2548a8f63e0b9f.

xtkoba avatar Feb 15 '23 13:02 xtkoba

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.

xtkoba avatar Feb 15 '23 13:02 xtkoba

The Alpine snapshot does not seem to support PIE. Probably it just works as explaned in the other comment.

xtkoba avatar Feb 15 '23 13:02 xtkoba

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
  • ./configure
  • make install
  • ./tcc helloworld.c (helloworld.c is a standard hello world)
  • ./a.out

Output is

Hello world

Topkek-190 avatar Feb 15 '23 13:02 Topkek-190

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.

xtkoba avatar Feb 15 '23 14:02 xtkoba

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)

xtkoba avatar Feb 15 '23 15:02 xtkoba

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)

Ah ok. Sorry for deleting it, I'd forgotten that Termux was bionic only.

Topkek-190 avatar Feb 15 '23 18:02 Topkek-190

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.

beelzebielsk avatar Apr 14 '23 21:04 beelzebielsk