pdp6
pdp6 copied to clipboard
make fails on MacOS Ventura
trying to build PDP6 as part of ITS build and stand alone fails with this error. Environment: Mac OS Ventura13.6.3 (22G436) Xcode: 15.2
emu % make
cc -o pdp6 -g -O3 -Wall -Wno-parentheses -Wno-implicit-function-declaration `sdl2-config --cflags` `pkg-config SDL2_image --cflags` -DGRAPHICS main_panel.c dis340.c joy.c emu.c apr.c mem.c tty.c pt.c dc.c dt.c netmem.c netcons.c cmd.c util.c threading.c rtc.c ../tools/pdp6common.c -lpthread -lm `sdl2-config --libs` `pkg-config SDL2_image --libs`
main_panel.c:792:1: warning: unused function 'drawgrid' [-Wunused-function]
drawgrid(Grid *g, SDL_Texture *s, Uint32 col)
.... More warnings here
threading.c:216:37: error: too many arguments to function call, expected 1, have 2
pthread_setname_np(pthread_self(), name);
~~~~~~~~~~~~~~~~~~ ^~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:535:5: note: 'pthread_setname_np' declared here
int pthread_setname_np(const char*);
^
1 error generated.
make: *** [pdp6] Error 1
Here is the full make output
emu % make
cc -o pdp6 -g -O3 -Wall -Wno-parentheses -Wno-implicit-function-declaration `sdl2-config --cflags` `pkg-config SDL2_image --cflags` -DGRAPHICS main_panel.c dis340.c joy.c emu.c apr.c mem.c tty.c pt.c dc.c dt.c netmem.c netcons.c cmd.c util.c threading.c rtc.c ../tools/pdp6common.c -lpthread -lm `sdl2-config --libs` `pkg-config SDL2_image --libs`
main_panel.c:792:1: warning: unused function 'drawgrid' [-Wunused-function]
drawgrid(Grid *g, SDL_Texture *s, Uint32 col)
^
1 warning generated.
dis340.c:835:12: warning: unused variable 'ev' [-Wunused-variable]
SDL_Event ev;
^
1 warning generated.
apr.c:143:33: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
p += sprintf(p, " AR/%012lo", apr->n.ar);
~~~~~~ ^~~~~~~~~
%012llo
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
apr.c:145:33: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
p += sprintf(p, " MB/%012lo", apr->n.mb);
~~~~~~ ^~~~~~~~~
%012llo
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
apr.c:147:33: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
p += sprintf(p, " MQ/%012lo", apr->n.mq);
~~~~~~ ^~~~~~~~~
%012llo
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
apr.c:124:1: warning: unused function 'pprint' [-Wunused-function]
pprint(Apr *apr)
^
apr.c:137:1: warning: unused function 'tracechange' [-Wunused-function]
tracechange(Apr *apr)
^
5 warnings generated.
mem.c:55:27: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
fprintf(f, "%012lo\n", mem[a++]);
~~~~~~ ^~~~~~~~
%012llo
1 warning generated.
netmem.c:59:34: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
printf("write %06lo %012lo\n", a, d);
~~~~~ ^
%06llo
netmem.c:59:37: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
printf("write %06lo %012lo\n", a, d);
~~~~~~ ^
%012llo
netmem.c:70:33: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
printf("read %06lo %012lo\n", a, d);
~~~~~ ^
%06llo
netmem.c:70:36: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
printf("read %06lo %012lo\n", a, d);
~~~~~~ ^
%012llo
netmem.c:87:34: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
printf("error address %06lo\n", a);
~~~~~ ^
%06llo
5 warnings generated.
cmd.c:192:20: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
printf("%06lo: ", addr);
~~~~~ ^~~~
%06llo
cmd.c:196:22: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
printf("%012lo\n", *p);
~~~~~~ ^~
%012llo
cmd.c:498:24: warning: format specifies type 'unsigned long' but the argument has type 'word' (aka 'unsigned long long') [-Wformat]
printf("%012lo\n", w);
~~~~~~ ^
%012llo
3 warnings generated.
threading.c:216:37: error: too many arguments to function call, expected 1, have 2
pthread_setname_np(pthread_self(), name);
~~~~~~~~~~~~~~~~~~ ^~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:535:5: note: 'pthread_setname_np' declared here
int pthread_setname_np(const char*);
^
1 error generated.
make: *** [pdp6] Error 1
OS X is broken here, but looking at things, maybe this could work:
#if OSX
pthread_setname_np(name);
#else
pthread_setname_np(pthread_self(), name);
#endif
Wanna try it?
See https://github.com/aap/pdp6/pull/29 ...