Search code examples
forthgforth

Can't compile image with `gforthmi`


The application shown below

." Hello, world!"
bye

creates the following error when compiling via gforthmi stdout.4th:

/usr/bin/gforthmi: 47: /usr/bin/gforthmi: /usr/lib/gforth/0.7.3/gforth-ditc: not found
/usr/bin/gforthmi: 48: /usr/bin/gforthmi: /usr/lib/gforth/0.7.3/gforth-ditc: not found
redefined th  
*OS command line*:-1: No such file or directory
comp-image >>>./temp-image.fi1<<< ./temp-image.fi2 stdout.4th bye
Backtrace:
$7F416215C970 throw 
$7F41621924F8 slurp-file 
rm: cannot remove './temp-image.fi1': No such file or directory
rm: cannot remove './temp-image.fi2': No such file or directory

I am running gforth 0.7.3 installed on an Ubuntu system via the official Ubuntu PPA.

Have I made a mistake in the way I compile the image? Am I missing any options?


Solution

  • There's couple of issues involved.

    For some reason gforth-ditc on ubuntu is located in different path. Not under /usr/bin, but under /use/lib/$MACHTYPE/gforth/$version. I.e. for 64-bit ubuntu and gforth version 0.7.2 I have it located at /usr/lib/x86_64-linux-gnu/gforth/0.7.2/gforth-ditc. Find it in your system and specify with GFORTHD environment variable.

    Second problem is with your test sample. It shouldn't end with bye, as that will terminate gforth-ditc (used by gforthmi) without possibly saving anything, as savesystem word passed as arguments to gforth-ditc will never be reached.

    Another hint - your test sample will be interpreted during compilation, but won't contribute any code to generated image. At least define some words to be called after your image is loaded :)