TADS on the Raspberry Pi

I have previously posted instructions to install FrobTADS on CentOS, @fos1 has expressed some interest in how well I could build FrobTADS for the Raspberry Pi. I’ve had success in the past. These are my results with a new Pi and latest TADS for posix hosts (FrobTADS).

I got a new pi 4 with 8GB of RAM and an image of “Raspberry Pi OS with desktop and recommended software” based on Debian 10.9. After installing a few packages, fixing one issue, I seem to have the tools you would need to create and play TADS games (TADS 2 and 3) on the command line. (You can compose the games in any editor, but these tools are needed to compile the source into a GAM [game] file and run the game:

  • tadsc - The TADS 2 compiler
  • t3make - The TADS 3 compiler
  • frob - The “runtime software” that allows you to play games)

Step 1 is to make a folder to house the software, and clone the FrobTADS repo maintained by @RealNC . You need git to clone this repo and some tools to build the software. I already had git and gcc installed (but not cmake), but I’m listing the commands anyway, because it does no harm to run them.

$ sudo apt install build-essential
$ sudo apt install git
$ sudo apt install cmake
$ mkdir projects
$ cd projects
$ git clone https://github.com/realnc/frobtads.git

Step 2 is to read the instructions and follow them :slight_smile: I also had to install a few more packages:

$ cd frobtads/
$ more ../doc/INSTALL
$ mkdir build
$ cd build
$ cmake ..
$ sudo apt install ncurses
$ sudo apt install libncurses libncurses-dev
$ sudo apt install libncurses-dev
$ cmake ..
$ sudo apt install curl
$ sudo apt install libssl-dev libcurl4-openssl-dev
$ cmake ..
$ more ../doc/INSTALL
$ cmake --build .

At this point, I got some build errors:

In file included from /home/pi/projects/frobtads/tads3/tcprs.cpp:39:
/home/pi/projects/frobtads/tads3/vmbignum.h: In static member function 'static vm_obj_id_t CVmObjBigNum::create(int, const bignum_t<prec>*)':
/home/pi/projects/frobtads/tads3/vmbignum.h:585:45: error: exception cleanup for this placement new selects non-placement operator delete [-fpermissive]
         new (vmg_ id) CVmObjBigNum(vmg_ prec);
                                             ^
<built-in>: note: 'void operator delete(void*, unsigned int)' is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation)
/home/pi/projects/frobtads/tads3/vmbignum.h: In static member function 'static vm_obj_id_t CVmObjBigNum::create(int, const bignum_t<prec>&)':
/home/pi/projects/frobtads/tads3/vmbignum.h:596:45: error: exception cleanup for this placement new selects non-placement operator delete [-fpermissive]
         new (vmg_ id) CVmObjBigNum(vmg_ prec);
                                             ^
<built-in>: note: 'void operator delete(void*, unsigned int)' is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation)

This had previously been reported: https://bugs.gentoo.org/700992 The fix suggested is to add a new flag.

So, Step 3: Using your favorite editor, edit the CMakeFile.txt file in the current directory and find these lines (lines 41 and 42 for me):

//Flags used by the CXX compiler during all build types.
CMAKE_CXX_FLAGS:STRING=

Change the FLAGS line to add this:-fno-sized-deallocation, so it should look like this:

//Flags used by the CXX compiler during all build types.
CMAKE_CXX_FLAGS:STRING=-fno-sized-deallocation

This allowed the build to complete (with one warning). The warning was:

[ 18%] Building CXX object CMakeFiles/TADS3_RC_OBJECTS.dir/tads3/vmbiftad.cpp.o
/home/pi/projects/frobtads/tads3/vmbiftad.cpp: In static member function 'static vm_obj_id_t CVmBifTADS::format_datetime_list(time_t)':
/home/pi/projects/frobtads/tads3/vmbiftad.cpp:2300:49: warning: right shift count >= width of type [-Wshift-count-overflow]
                 vmg_ FALSE, (uint32_t)(timer >> 32),
                                                 ^~
[ 18%] Building CXX object CMakeFiles/TADS3_RC_OBJECTS.dir/tads3/vmbiftio.cpp.o

Here’s what success looks like:

pi@raspberrypi:~/projects/frobtads/build $ ls -l 
total 6104
-rw-r--r--  1 pi pi   22817 Jun 19 21:19 CMakeCache.txt
drwxr-xr-x 16 pi pi    4096 Jun 19 21:25 CMakeFiles
-rw-r--r--  1 pi pi  174251 Jun 19 21:19 Makefile
-rw-r--r--  1 pi pi    7982 Jun 19 21:14 cmake_install.cmake
-rwxr-xr-x  1 pi pi 2984652 Jun 19 21:25 frob
-rw-r--r--  1 pi pi    1479 Jun 19 21:14 frob_config.h
-rw-r--r--  1 pi pi     585 Jun 19 21:57 history.txt
-rwxr-xr-x  1 pi pi 2682284 Jun 19 21:23 t3make
-rwxr-xr-x  1 pi pi  308328 Jun 19 21:24 tadsc
-rwxr-xr-x  1 pi pi   47892 Jun 19 21:23 tadsrsc

Step 4: The installation is one more command and must be done as root (using sudo):

sudo cmake --build . --target install

Step 5: Of course, you’re not done until you test the software…

cd
mkdir games
cd games
wget https://www.ifarchive.org/if-archive/games/tads/ditchday.zip
mkdir ditch
cd ditch
unzip ../ditchday.zip
frob DITCH.GAM

Building a large game using T3 will probably take a little while, but the conditional compilation feature of T3 should make Pi a reasonable platform for building T3 games. I think it’s a good platform to play games. Raspberry Pi OS seems very polished and the Pi 4 is peppy.

I suppose the next project is Qtads…

7 Likes

Very good!

I will give this a try tomorrow. My efforts earlier today did not succeed.

Thank you

1 Like

BTW, if someone wants to (only) play TADS games, don’t do this (unless you want to). Just install gargoyle. But I think creating your own stories is a lot of fun too, and you’ll need these tools to do so.

1 Like

I couldn’t wait until tomorrow. The only change I had to make was installing ncurses5 rather than ncurses.

Frob plays Ditch without any problem. Next test is compiling some of my own code.

Tomorrow… :wink:

Thank you! I have trying to install FrobTADS on an RPi for several years. This is the first success.

1 Like

Yeah, the compiler is the best “puzzle box” of them all!

1 Like

The TADS compilers definitely work with polymath’s build method.

Once I sorted out the file locations and permissions Heidi from the TADS Getting Started manual compile properly with:

t3make -FC -f Heidi

You need the -FC to direct the compiler to create the necessary directories and files.

WaHoo!

PS. I would expect it would with with Eric Eve’s Adv3Lite library as well.

1 Like

IIRC, you can also put -FC in the t3make…

Best regards from Italy,
dott. Piergiorgio.

Btw, you don’t need to specify -f filename.t3m. Just always name your makefile Makefile.t3m. Then you only need to enter t3make to build.