North-Western-Development / oc2r

RISC-V VMs in Minecraft. Continued by North Western Development, originally by Sangar.
https://www.curseforge.com/minecraft/mc-mods/oc2r
Other
72 stars 11 forks source link

what happened to TCC ?! #17

Open ArtyBiscuit opened 2 months ago

ArtyBiscuit commented 2 months ago

what happened to the TCC compiler, its functionality was incredible, I want to be able to do C !

I seem to remember that TCC was available in the old version, is there a reason why it's no longer available? where would it be possible to add it ?

perkinslr commented 2 months ago

You can grab buildroot and make yourself an image with whatever functionality you wish. tcc was indeed included in the older version.

As an alternative, you can easily set up a cross arch chroot on a host system (including via WSL2 on windows) and statically compile your C/++ code with a better compiler, then copy the results in. This is the approach I use.

hickorysb commented 1 month ago

As far as I'm aware TCC is still included? In fact there's some conversations regarding it in the Discord if you search for TCC.

hickorysb commented 1 month ago

I've just noticed this comment on an issue. If you are using this version of Sedna then TCC will be missing which is outside of my control.

Un1q32 commented 1 month ago

I didn't realize so many people used TCC, I figured without libc headers it wouldn't be very useful. I've had an idea for a bit about a second premade craftable drive, similar to the linux drive, that contains TCC and libc headers (and headers for included libraries like ncurses), but that would require support in the OC2 mod. I might try to learn just enough java/forge to implement it eventually.

Un1q32 commented 1 month ago

I've added a big banner to that comment to hopefully stop people from reporting issues with my sedna build here.

Un1q32 commented 1 month ago

@ArtyBiscuit @perkinslr I've readded TCC in the latest release, since demand for it is greater than I expected. There's also a tarball with all the libc headers as well as headers for other included libraries like ncurses, takes up about 2 MB. you can import it into the VM and extract it to another drive and mount it at /usr/include (or just extract it to /usr/include without a separate drive if your root drive has more than 2 MB free)

perkinslr commented 2 weeks ago

I didn't realize so many people used TCC, I figured without libc headers it wouldn't be very useful. I've had an idea for a bit about a second premade craftable drive, similar to the linux drive, that contains TCC and libc headers (and headers for included libraries like ncurses), but that would require support in the OC2 mod. I might try to learn just enough java/forge to implement it eventually.

When you are doing tiny system embedded stuff, you generally don't use headers. Instead of #include <stdio.h>, you just int printf(const char *restrict format, ...); at the top of your file for the exact functions you intend to use. Or tell tcc that implicit functions are fine. You need the headers somewhere accessible, ideally searchable (man 3 printf), so you can get the exact signatures of the exact functions in question, but pulling in the whole headers is finicky at best.

As a related note, OC2 has good support for foreign disks. Been a year or more since I poked at it, but I successfully configured a boot/root system like the old tom's root and boot, using an overlay fs. I can probably assist if there is enough interest in it.