PDP-10 / its

Incompatible Timesharing System
Other
841 stars 80 forks source link

Building pdp10-ka on MacOS Ventura fails #2201

Closed oilcan-productions closed 9 months ago

oilcan-productions commented 1 year ago

I am getting this failure on MacOS Ventura when I am trying to build with EMULATOR=pdp10-ka

Simulation stopped, PC: 773035 (JRST 0,773034)
sim> q
Goodbye
spawn ./tools/sims/BIN/pdp10-ka build/mchn/KA/boot

KA-10 simulator V4.0-0 Current        git commit id: 48186c90
/Volumes/10TB SBP 122019/retro/its/build/mchn/KA/boot-18> at mta0 out/pdp10-ka/sources.tape
%SIM-INFO: MTA0: Tape Image 'out/pdp10-ka/sources.tape' scanned as SIMH format

 DSKDMP
dskdmp
 MFDCLB

The last command timed out.
make: *** [out/pdp10-ka/rp03.2] Error 1

I looked at similar issues with other emulators but seems none of the resolutions apply.

larsbrinkhoff commented 1 year ago

It's some kind of disk problem. Either the disk image is clobbered or malformed for some reason, or the disk devices didn't mount the image files properly. I imagine this should work the same on all Unix platforms, but you never know. Unfortunately I don't have a Mac, so I can't test this. A CI target for MacOS would be good. @eswenson1, do you have a Mac you can try this on?

eswenson1 commented 1 year ago

I do. I’ll try it.

eswenson1 commented 1 year ago

I had no issue building a pdp10-ka ITS on my Mac. I'm running macOS 13.4.1 (c). The resulting ITS is runnable under pdp10-ka. However, I had issues AFTER ITS was built. See below.

KA ITS 1651 NOT IN OPERATION AT
SHUTDOWN COMPLETE
Simulation stopped, PC: 773035 (JRST 0,773034)
sim> q
Goodbye

MAIN BUILD SCRIPT DONE
Sat Jul 15 10:59:16 PDT 2023
mkdir -p out/pdp10-ka/stamp
touch out/pdp10-ka/stamp/its
tools/sims/BIN/pdp10-ka build/pdp10-ka/hhtest.simh

KA-10 simulator V4.0-0 Current        git commit id: 48186c90

HALT instruction, PC: 000201 (HALT 201)

As you can see the build completed fine. However, I got errors building tv11:

mkdir -p out/gt40
tools/dasm/palx -I < out/pdp10-ka/bootvt.bin > out/pdp10-ka/bootvt.img
Image start: 166000
/Library/Developer/CommandLineTools/usr/bin/make -C tools/tv11 tv11 CFLAGS=-O3
cc -O3   -c -o tv11.o tv11.c
tv11.c:97:1: warning: incompatible redeclaration of library function 'log' [-Wincompatible-library-redeclaration]
log (char *format, ...)
^
tv11.c:97:1: note: 'log' is a builtin with type 'double (double)'
1 warning generated.
cc -O3   -c -o tv.o tv.c
tv.c:287:18: warning: & has lower precedence than <; < will be evaluated first [-Wparentheses]
        curbuf = (*creg & BUFMASK < NUMFBUFFERS) ? &tv->buffers[*creg & BUFMASK] : nil;
                        ^~~~~~~~~~~~~~~~~~~~~~~
tv.c:287:18: note: place parentheses around the '<' expression to silence this warning
        curbuf = (*creg & BUFMASK < NUMFBUFFERS) ? &tv->buffers[*creg & BUFMASK] : nil;
                        ^ ~~~~~~~~~~~~~~~~~~~~~
tv.c:287:18: note: place parentheses around the & expression to evaluate it first
        curbuf = (*creg & BUFMASK < NUMFBUFFERS) ? &tv->buffers[*creg & BUFMASK] : nil;
                  ~~~~~~^~~~~~~~~
tv.c:505:2: error: call to undeclared function 'writen'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        writen(con->fd, largebuf, 3+8+WIDTH*HEIGHT/8);
        ^
tv.c:505:2: note: did you mean 'write'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:496:10: note: 'write' declared here
ssize_t  write(int __fd, const void * __buf, size_t __nbyte) __DARWIN_ALIAS_C(write);
         ^
tv.c:549:3: error: call to undeclared function 'writen'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                writen(tv->cons[tv->omap[osw]].fd, buf, 7);
                ^
tv.c:732:3: error: call to undeclared function 'writen'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                writen(con->fd, largebuf, 3+8+w*h*2);
                ^
1 warning and 3 errors generated.
make[1]: *** [tv.o] Error 1
make: *** [tools/tv11/tv11] Error 2

This did abort the build, but as you can see, I did get past where @oilcan-productions had issues.

oilcan-productions commented 1 year ago

Thanks @eswenson1 I will take a look and try again. Maybe a missing dependency on my end. The Mac I am building on is an older iMac Intel i5 chipset. I will move the folder to the SSD drive and see if that makes a difference as well

oilcan-productions commented 1 year ago

I just re-ran the build with the latest bits on the SSD which is faster than the external hard drive I used before to store the repo clone. And now I am getting the same build error as @eswenson1 when it builds tv11. Looks like the latest Xcode make is has some strict rules enabled to error out on implicit function definitions.

oilcan-productions commented 1 year ago

Seems for macOS I need to change all occurrences of writen to write in tv.c then the build succeeds. @eswenson1 can you confirm?

larsbrinkhoff commented 1 year ago

change all occurrences of writen to write

No! It really is writen, but it needs a declaration. I posted an issue discussing the problems: https://github.com/aap/pdp11/issues/22

oilcan-productions commented 1 year ago

@larsbrinkhoff I looked at the code in https://github.com/aap/tv11/blob/master/tv.c and it was using write instead of writen so I assumed it would work with write as well. The code did build successfully then and tv11 runs fine

oilcan-productions commented 9 months ago

Closing this as it is now working after switching the build folder to a SSD disk rather than the slower spindle disk in my old iMac