simh / simtools

Tools useful when using or migrating to or from a simh simulator environment
48 stars 16 forks source link

rstsflx compile / link error on modern Linux #21

Open Terry-Kennedy opened 2 months ago

Terry-Kennedy commented 2 months ago

I'm attempting to build rstsflx from the sources here on a Raspberry Pi running: Linux PiDP11 6.6.31+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux

There are several compiler warnings as well as a link failure. I'll attach a complete transcript, but the particular warnings / errors are:

rtime.c: In function ‘cvtdate’: rtime.c:21:17: warning: ‘memcpy’ reading 12 bytes from a region of size 10 [-Wstringop-overread] 21 | memcpy (buf, " none ", DATELEN); | ^~~~~~~~~~

scancmd.c: In function ‘initialize_readline’: scancmd.c:484:9: warning: ‘CPPFunction’ is deprecated [-Wdeprecated-declarations] 484 | rl_attempted_completion_function = (CPPFunction *)flx_completion; | ^~~~~~~~

/usr/bin/ld: doclean.o:/opt/pidp11/systems/rsts101/rstsflx/doclean.c:73: multiple definition of files'; dolist.o:/opt/pidp11/systems/rsts101/rstsflx/dolist.c:16: first defined here /usr/bin/ld: doclean.o:/opt/pidp11/systems/rsts101/rstsflx/doclean.c:68: multiple definition ofcurprog'; dolist.o:/opt/pidp11/systems/rsts101/rstsflx/dolist.c:17: first defined here /usr/bin/ld: doclean.o:/opt/pidp11/systems/rsts101/rstsflx/doclean.c:68: multiple definition of `curproj'; dolist.o:/opt/pidp11/systems/rsts101/rstsflx/dolist.c:17: first defined here collect2: error: ld returned 1 exit status make: *** [Makefile:58: flx] Error 1

A few other nits that wouldn't otherwise affect the build, but should also be fixed:

pi@PiDP11:/opt/pidp11/systems/rsts101/rstsflx# make depend gcc -MM rstsflx.c fip.c rtime.c filename.c doget.c dolist.c doalloc.c docomp.c dotype.c doput.c dodump.c dodelete.c dorename.c dorts.c doprot.c dodir.c doident.c doinit.c dohook.c scancmd.c doclean.c fileio.c diskio.c unxabsio.c > flx.dep make: *** No rule to make target 'depend'. Stop.

In the Makefile, "$(CC)" rstsflx-bug.txt is used properly except in the flx.dep: target, where there's a hard-coded "gcc".

This builds properly under FreeBSD 13.4 with an old gcc34 I've been dragging along to deal with recalcitrant programs like this.

Terry-Kennedy commented 2 months ago

I have no idea why GitHub decided to insert a link to my attachment in the middle of a sentence, but there it is.