tenox7 / micropolis

Micropolis Legacy for vintage Unix using SimCity assets
25 stars 1 forks source link

build error with GCC on aix #1

Open f34rther34pr opened 3 months ago

f34rther34pr commented 3 months ago

I'm sorry if this is a really simple thing, but I tried to build from source on AIX 4.3.3 on my 43p-140 with GCC 3.4.3 and I get this error-

gcc -O3 -DIS_LINUX  -I../../tcl   -DTCL_HAVE_SETLINEBUF -DTCL_32_BIT_RANDOM -DTCL_POSIX_SIG -DTCL_TM_GMTOFF -c tclxgdat.c
tclxgdat.y:233: warning: static declaration of 'yylex' follows non-static declaration
tclxgdat.y:437: warning: previous implicit declaration of 'yylex' was here
tclxgdat.y:585: error: conflicting types for 'yyerror'
tclxgdat.y:416: error: previous implicit declaration of 'yyerror' was here
make: 1254-004 The error code from the last command is 1.

Stop.
make: 1254-004 The error code from the last command is 2.

Stop.
make: 1254-004 The error code from the last command is 2.

That happens when I run make from the micropolis-src/src directory. Do I need to build it a different way, or is installing xlc the best way to build it on aix?

tenox7 commented 3 months ago

Firstly there already is a pre-built version under https://github.com/tenox7/micropolis/releases.

Secondly try gnu make (gmake) instead of aix make. I had some issues with order of includes.

I think I also had to tweak some stuff in tclx/makefile, let me see if I can dig it out.

f34rther34pr commented 3 months ago

Alright! I did try with gmake and I got the same error above, first running make clean and then using gmake. And yep that binary does work for me, but I wanted to try it on my 7012-350 and I wasn't sure if the binary would work since it uses the older power1 cpu(can't try it directly atm).

tenox7 commented 3 months ago

Interesting. I will try that later and tell you how I built mine. Probably add a makefile for aix or something like that.

I also tried to build it as a statically linked binary but didn't work too well.

tenox7 commented 3 months ago

I just compiled on AIX 5.1 with the standard makefile.

Can you try to build it from tclx/src/ folder using gmake?

f34rther34pr commented 2 months ago

Sorry for the late reply to this. I did try with gmake from tclx/src but it still errored out at the same place. I was able to get it built successfully after some tweaking and sorting out some missing libraries!

In tclxgdat.y, I moved this section at the very bottom

void
yyerror(msg)
    char *msg;
{
}

to below this section at the very top-

%token ID MONTH DAY MERIDIAN NUMBER UNIT MUNIT SUNIT ZONE DAYZONE AGO
%{
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <ctype.h>
#include <time.h>

so it looks like-

%token ID MONTH DAY MERIDIAN NUMBER UNIT MUNIT SUNIT ZONE DAYZONE AGO
%{
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <ctype.h>
#include <time.h>

void
yyerror(msg)
    const char *msg;
{
}

#ifndef NULL
#    define NULL    0
#endif

It built fine after that, and the game seems to work fine for me. I'll have some time later to test it out further, but that seemed to produce a binary that at least gets into gameplay.

neozeed commented 2 weeks ago

I had something very similar. Although I ended up building Bison 1.6 as this seems to want something more SYSV/Ancient?

`diff -ruN micropolis/src/tclx/src/tclxgdat.y ../micropolis/src/tclx/src/tclxgdat.y --- micropolis/src/tclx/src/tclxgdat.y 2024-10-24 11:11:58.000000000 +0100 +++ ../micropolis/src/tclx/src/tclxgdat.y 2024-10-24 12:02:17.241085207 +0100 @@ -228,7 +228,7 @@

static char *lptr;

-static +//static yylex() {

ifndef YYSTYPE`

neozeed commented 2 weeks ago

If it helps I processed this file with Bison 1.16 & it compiled for me. Although I just found out it only runs on 1/8bit displays so I haven't been able to actually test it yet.

tclxgdat.zip