Build fails with typedef redefinition on macOS

I am trying to build Octave on macOS Catalina.

Compilation fails with:

In file included from ./../libinterp/dldfcn/
In file included from /usr/local/Cellar/fltk/1.3.8/include/FL/fl_draw.H:27:
In file included from /usr/local/Cellar/fltk/1.3.8/include/FL/x.H:32:
/usr/local/Cellar/fltk/1.3.8/include/FL/mac.H:32:25: error: typedef redefinition with different types ('class FLWindow *' vs 'XID' (aka 'unsigned long'))
typedef class FLWindow *Window; // pointer to the FLWindow objective-c class
/usr/local/include/X11/X.h:96:13: note: previous definition is here
typedef XID Window;

It seems like X11 & FLTK are conflicting. Any advice?

I was able to create a successful build with the following steps:

brew update
brew install gnu-sed gcc openjdk pkg-config hdf5 openblas readline texinfo texlive qrupdate qt@5 bison
cd octave/.build
make clean
./../configure --prefix=$HOME/my_octave --with-x=no --with-hdf5-includedir=/usr/local/opt/hdf5/include --with-hdf5-libdir=/usr/local/opt/hdf5/lib --with-blas="-L/usr/local/opt/openblas/lib -lopenblas" --with-java-homedir=/usr/local/opt/openjdk
make -j2
make check
make install

See also, e.g., here for the configure flags that we use in our CI on macOS with homebrew:
octave/make.yaml at 5a9558b8035b7512b9c5fb636bb628904817e744 · gnu-octave/octave (

1 Like