Port eBBS 3.1.4-rc2 to build and run on macOS/Darwin (Apple Silicon) - #2
Port eBBS 3.1.4-rc2 to build and run on macOS/Darwin (Apple Silicon)#2DrPitre wants to merge 5 commits into
Conversation
Adds a DARWIN os profile, updates CCFLAGS for modern clang stricter K&R diagnostics, and fixes two variadic functions (prints, bbslog) that lacked prototypes visible at their call sites. On ARM64 this caused va_arg to read corrupted values and crash with SIGSEGV.
|
thanks |
Converts every K&R-style function definition to ANSI C prototype form and adds the missing standard-library #includes and cross-file function prototypes that -Wimplicit-function-declaration (a hard error by default on modern clang) exposed once removed from the Makefile's suppression flags. Also fixes the outc/outcf termcap callback signatures to match tputs()'s real prototype, two buffer-overflow-adjacent strncpy sizes, and a handful of genuine call-site bugs (missing execute() argument, SelectBoard/yyerror signature mismatches) uncovered by the now-correct prototypes. make clobber && make all now completes with 0 errors and 0 warnings, and all seven binaries (lbbs, chatd, addacct, delacct, bbslog, bbfinger, bbsmaild) still run correctly.
|
Hi! I saw your PR and I'll get it merged as soon as I can get it to build on my laptop. I don't have a Mac to test on I'm afraid, but I did try to compile it on my Linux box and it failed about halfway through. I saw that you added some more changes and once I get them pulled into my local copy I'll give it another try. |
|
I'm not sure yet if this is due to your changes or a bug that needs fixed in general. |
Hardcoded DARWIN=1/FREEBSD=1 in osdeps.h broke builds on other platforms. Replace with auto-detection via compiler predefined macros (__APPLE__, __FreeBSD__, __linux__) so no manual edits are needed per platform. Also add DARWIN to NO_TERMIO (macOS lacks termio.h, previously covered by the FREEBSD=1 alias) and LINUX to USES_UTMPX (modern Linux has utmpx). In login.c, fall back to _PATH_UTMPX from <paths.h> when UTMPX_FILE is not defined - Linux's utmpx.h omits UTMPX_FILE unlike macOS.
|
Thanks for testing on Linux! I just pushed a fix for that. The root cause was that the macOS port hardcoded The fix does two things:
|
|
It seems the original author is still working on this -> https://wq5l.net/ebbs/ . I never knew ! |
|
@DrPitre Thank you - I'll give it a try later today. @catskillmarina I had no idea - holy crap! |
- osdeps.h: add __APPLE__ to LACKS_MALLOC_H; define OLCUC/XCASE=0 for macOS - pbbs/term.c: use tcgetattr/tcsetattr on macOS instead of ioctl(TIOCGETA) to fix 'Bad address' crash on Apple Silicon - clientui.h, pbbs/io.h: declare prints() with variadic prototype so all callers use the correct ARM64 ABI (fixes SIGSEGV in va_arg) - Makefile: omit -lcrypt on Darwin (crypt is in libSystem) - gram.y: convert K&R functions to ANSI C, add forward declarations, fix assignment-in-condition warnings; regenerate y.tab.c - All .c files: convert K&R function definitions to ANSI C prototypes, add missing return types and return statements, fix -Wparentheses and -Wpointer-sign warnings (zero warnings build) - Add etc -> config symlink and ignore runtime files (log, tmp/, .shmkey)
|
I just updated my fork to Ray's 3.1.4 rc2 code, so this is the latest! |
|
Because I was having some trouble, I erased my old clone of the repo with your PR applied and re-pulled it. |
hit_alarm_clock() was declared K&R-style with no parameters, which modern compilers treat as void(*)(void) instead of the void(*)(int) signal() expects. Reported by virtadpt building on Linux with gcc 16.
|
Thanks for testing again! Fixed — the issue was that Pushed a fix (899ca42) that gives it an explicit |
Summary
#includes and cross-file function prototypes needed once-Wimplicit-function-declaration(a hard error by default on modern clang) was no longer suppressedoutc/outcftermcap callback signatures to matchtputs()'s real prototype on macOS's ncurses-backed termcap.hstrncpysize arguments (login.c terminal field, bbsmaild.c sender name)execute()argument in netmail.c,SelectBoard/yyerrorsignature mismatches in nmenus.c)Test plan
make clean && makebuilds all binaries (lbbs, chatd, addacct, delacct, bbslog, bbfinger, bbsmaild) with 0 errors and 0 warnings on macOS/Apple Silicon with Xcode clang