farisawan-2000 / cfront-3

A research repository into AT&T Cfront, now converted to build with a modern compiler
9 stars 2 forks source link

Build for Linux, Windows and OSX #1

Open mingodad opened 2 years ago

mingodad commented 2 years ago

I did a refactoring/cleanup here https://github.com/mingodad/cfront-3 and have it building for Linux 32/64, Cross compiled to Windows 32/64 and OSX 64 bits, see here the github workflow and the output for it https://github.com/mingodad/cfront-3/actions/runs/1421141006/workflow

someone2639 commented 2 years ago

if your repo has output parity with mine, then it's useful (especially for N64 stuff which is why I started this project in the first place)

mingodad commented 2 years ago

Where is your repository I looked at your (https://github.com/someone2639) repositories and didn't found any cfront ?

someone2639 commented 2 years ago

It's this repo (I'm on my alt account)

mingodad commented 2 years ago

If I remember your repo doesn't build out of the box on my Ubuntu 18.04:

g++ -Wall -Wpedantic -I. -g -MMD -MP -MT build/alloc.o -MF build/alloc.d -c alloc.c -o build/alloc.o
In file included from alloc.c:17:
cfront.h:1252:11: error: expected unqualified-id before ‘not’ token
 1252 |     Pname not ;   /* name of "this"'s class or 0 */
      |           ^~~
In file included from alloc.c:20:
template.h:525:20: warning: extra ‘;’ [-Wpedantic]
  525 | Blockdeclare(Pchar);
      |                    ^
alloc.c:62:7: error: ‘operator new’ takes type ‘size_t’ (‘long unsigned int’) as first parameter [-fpermissive]
   62 | void *operator new(NEW_SIZE sz) // get memory that might be freed
      |       ^~~~~~~~
someone2639 commented 2 years ago

for my repo to build on ubuntu I had to use g++-7 and its libraries, since that was the last version to support the -ffor-scope flag out of the box (and it made compiling the repo a lot easier. Using the oldest possible yacc i could run was also easier than learning the syntax and how it's changed over 30 years.

I have also started a side project using your version of cfront, and it seems to compile correct code at first glance, so I guess the output does match.

mingodad commented 2 years ago

I just triggered the github action on my repo to discover it's not building on the latest Ubuntu due to a missing dependency, I'll try to see the workaround. NIce to hear that it's working for your case, at the time I looked around to see if someone have done any improvements to it and this one https://github.com/seyko2/cfront-3 was the one that did anything significant to allow build on more recent Linux but was rot at that time too. Your repo is lot cleaner but I somehow decided to go with full repo.