Back in June, I tried compiling the 0.7.9_20250611 tarball on a
MacBook Pro (Intel) using MacPorts' libraries. This failed - see (SWIG
can't process X11 files in a MacPorts build)

I downloaded the 0.7.9_20251001 tarball. I installed almost all the
required dependencies from a fully updated MacPorts on my Mac Mini
(M4, Sequoia) using the homebrew and debian lists in install-deps.sh
as a guide. and then carried out the following steps:

sudo port select --set gcc mp-gcc14
export CC=gcc
./install-swig.sh --nosudo "--prefix=$PWD/local"
export PATH="$PATH:$PWD/local/bin”
export CFLAGS="-I/opt/local/include"
export LDFLAGS="-L/opt/local/lib"
./configure --prefix=/Users/mark/Applications/gforth/0.7.9_20250817

All dependencies were met according to the output of ./configure so I
ran make -j 1. The compile failed as follows:

--- Error message:
SWIG-GEN x.fs
Failed x-fsi.c on first attempt
--------------compilation output--------------
x-fsi.c: In function 'main':
x-fsi.c:4233:60: error: expected ';' before 'if'
 4233 |         if(offsetof(struct _XExtData, free_private) >= 0) 0
      |                                                            ^
      |                                                            ;
 4234 |         if(offsetof(struct funcs, create_image) >= 0) 0
      |         ~~
------------compilation output end------------
x-fsi-fixed.c: In function 'main':
x-fsi-fixed.c:4234:56: error: expected ';' before 'if'

 4234 |         if(offsetof(struct funcs, create_image) >= 0) 0
      |                                                        ^
      |                                                        ;
 4235 |         if(offsetof(struct funcs, destroy_image) >= 0) 0
      |         ~~
make[1]: *** [x.fs] Error 1
make: *** [unix/x.fs] Error 2

Around line 4230 in x-fsi-fixed.c, the problematic code is:

 if(offsetof(struct _XExtData, free_private) >= 0) 0
 if(offsetof(struct funcs, create_image) >= 0) 0
 if(offsetof(struct funcs, destroy_image) >= 0) 0
 if(offsetof(struct funcs, get_pixel) >= 0) 0
 if(offsetof(struct funcs, put_pixel) >= 0) 0
 if(offsetof(struct funcs, sub_image) >= 0) 0
 if(offsetof(struct funcs, add_pixel) >= 0) 0

It appears that the following script in x.i is failing to put a
semicolon after the terminal \0.

// prep: sed -e
's/swigFunctionPointer.*{((\([^*]*\)\*)ptr)->\([^}]*\)}.*/if(offsetof(\1,
\2) >= 0) \0/g'

I added the semicolon and re-built clean. The process completed
without error and x.fs exists. I cannot be certain that replacing the
semicolon is the right way to go, but looking at the code, an extra
one would not affect its meaning.

My next problem is that gl.fs is missing, despite there being
unix/gl.i and unix/gl-fsi.c. Also GL/gl.h can be found in the given
include paths. I am in the process of investigating this issue. Any
thoughts welcome...

Many thanks

Reply via email to