fluid syntax error cross build amd64 on i386

21 views
Skip to first unread message

df7...@gmail.com

unread,
Aug 15, 2025, 8:10:25 PMAug 15
to fltk.coredev
I have an older branch of 1.4 that is modified that has the 32-bit library and utilities built, now I need to build an amd64 version (on my 32bit linux OS) so I used:

./configure --enable-threads --enable-newprefix --disable-xrender --with-archflags="-m64" --prefix="/usr/local/x64"

(the newprefix is one of the custom items a patch was provided years ago)

Everything is build  until it gets to the tests (which I really don't need) and fails with:

Generating fast_slow.cxx and header from fast_slow.fl...
../fluid/fluid: 1: Syntax error: word unexpected (expecting ")")
make[1]: *** [Makefile:279: fast_slow.cxx] Error 2

That file isn't modified, it says it's version 1.04 and I compared to file in git that is 1.05 but nothing changed with regards to any ")". Just some additional words.

If I try to run fluid from the newly built it fails as expected:

:fluid/fluid --version
bash: fluid/fluid: cannot execute binary file: Exec format error
 
So it must be using a 32bit version, but any ideas to get a clean build?

I tried ./configure --help but I didn't see an option to turn off tests or even fluid in general, I don't use it.

Thanks.



Greg Ercolano

unread,
Aug 16, 2025, 3:09:45 AMAug 16
to fltkc...@googlegroups.com

Try 'make distclean' to completely clean old binaries.

Albrecht Schlosser

unread,
Aug 16, 2025, 7:08:40 AMAug 16
to fltkc...@googlegroups.com
On 8/16/25 02:10 schrieb df7...@gmail.com wrote:
I have an older branch of 1.4 that is modified that has the 32-bit library and utilities built, now I need to build an amd64 version (on my 32bit linux OS) so I used:

./configure --enable-threads --enable-newprefix --disable-xrender --with-archflags="-m64" --prefix="/usr/local/x64"

(the newprefix is one of the custom items a patch was provided years ago)

It would be good to know on which "older" 1.4 version your modified sources are based. Obviously this is not supported by FLTK, but I'll try to help anyway.

I don't know what `--enable-newprefix`  does, but what you describe sounds like you're trying to cross-compile. See below for advice.


Everything is build  until it gets to the tests (which I really don't need) and fails with:

Generating fast_slow.cxx and header from fast_slow.fl...
../fluid/fluid: 1: Syntax error: word unexpected (expecting ")")
make[1]: *** [Makefile:279: fast_slow.cxx] Error 2

The build process tries to use the just-built fluid executable because it doesn't "know" that it is intended to cross-compile. Although I wonder why this fluid executable can be started at all... But again, see below.


That file isn't modified, it says it's version 1.04 and I compared to file in git that is 1.05 but nothing changed with regards to any ")". Just some additional words.

For a moment I thought: he's using FLTK 1.0.4 ? But then I recognized that you abbreviated the version number of the fluid file which should be 1.040x for FLTK 1.4.x. OK ...


If I try to run fluid from the newly built it fails as expected:

:fluid/fluid --version
bash: fluid/fluid: cannot execute binary file: Exec format error
 
So it must be using a 32bit version,

Yep, that looks so. But which one?


but any ideas to get a clean build?

Yep.


I tried ./configure --help but I didn't see an option to turn off tests or even fluid in general, I don't use it.

Well, first of all, there is option

  --disable-test          build test programs (default=yes)

... which looks a little weird. In fact "default=yes" is equivalent to `--enable-test` and you could use `--disable-test` to prevent building the test programs. In my FLTK 1.4 branch (git current) `./configure --help` displays this option and I assume that this is very, very old (it supposedly predates FLTK 1.4.0).

But now to real cross-compiling:


Both configure/make and CMake (recommended) allow to cross-compile. When you cross-compile (correctly), the build process knows that it can't use the fluid executable from the current build and uses one on the build system instead. This fluid executable must be on the user's PATH.

That said, the correct way to cross-compile is to use `--host` and/or `--build` in ./configure. I can demonstrate a cross-compile on my 64-bit Linux to 32-bit Windows, doing this:
```
$ make distclean
=== cleaning examples ===
...
=== cleaning documentation ===
make[1]: Entering directory '/git/fltk/branch-1.4/documentation'
make[1]: Leaving directory '/git/fltk/branch-1.4/documentation'
$ autoconf
$ export LDFLAGS='-static-libgcc -static-libstdc++'
$ ./configure --host=i686-w64-mingw32 --enable-localpng --enable-localjpeg --enable-localzlib
checking build system type... x86_64-unknown-linux-gnu
checking host system type... i686-w64-mingw32
checking for i686-w64-mingw32-gcc... i686-w64-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether i686-w64-mingw32-gcc accepts -g... yes
checking for i686-w64-mingw32-gcc option to enable C11 features... none needed
checking for i686-w64-mingw32-g++... i686-w64-mingw32-g++
checking whether the compiler supports GNU C++... yes
checking whether i686-w64-mingw32-g++ accepts -g... yes
checking for i686-w64-mingw32-g++ option to enable C++11 features... none needed
checking for i686-w64-mingw32-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking for wtypes.h... yes
checking for gdiplus.h... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for nroff... /usr/bin/nroff
checking for doxygen... /usr/local/doxygen/v1.12.0/bin/doxygen
checking for i686-w64-mingw32-ranlib... i686-w64-mingw32-ranlib
checking for i686-w64-mingw32-ar... /usr/bin/i686-w64-mingw32-ar
checking for i686-w64-mingw32-windres... /usr/bin/i686-w64-mingw32-windres
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking size of short... 2
checking size of int... 4
checking size of long... 4
checking whether byte ordering is bigendian... no
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for sys/select.h... no
checking for sys/stdtypes.h... no
checking whether we have the POSIX compatible scandir() prototype... no
checking for scandir... no
checking for vsnprintf... yes
checking for snprintf... yes
checking for strings.h... (cached) yes
checking for strcasecmp... yes
checking for strlcat... no
checking for strlcpy... no
checking for locale.h... yes
checking for localeconv... yes
checking for setenv... no
checking for library containing pow... none required
checking for math.h... yes
checking for trunc... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for long long int... yes
checking for library containing dlsym... no
checking for dlfcn.h... no
checking how to run the C preprocessor... i686-w64-mingw32-gcc -E
checking for X... no
checking for GL/gl.h... yes
checking for GL/glu.h... yes
checking if GCC supports -fno-exceptions... yes
checking if GCC supports -fno-strict-aliasing... yes
checking if ld supports -no-undefined... yes
checking if ld supports -Bsymbolic-functions... yes
checking if toolchain supports sections... yes

Configuration Summary
-------------------------------------------------------------------------
    Directories: prefix=/usr/local
                 bindir=${exec_prefix}/bin
                 datadir=${datarootdir}
                 datarootdir=${prefix}/share
                 exec_prefix=${prefix}
                 includedir=${prefix}/include
                 libdir=${exec_prefix}/lib
                 mandir=${datarootdir}/man
                 MSys docpath=/local/share/doc/fltk
    Build fluid: YES
    Build tests: YES
Cross-compiling: YES
          Build: x86_64-unknown-linux-gnu -> Host: i686-w64-mingw32   <<< Note: cross-building
       Graphics: GDI+
Image Libraries: JPEG=Builtin
                 PNG=Builtin
                 ZLIB=Builtin
Forms library:   YES
    Large Files: YES
         OpenGL: YES
        Threads: YES
   Allow std:: : NO
configure: creating ./config.status
...
```
Note the configure flags
--host=i686-w64-mingw32 --enable-localpng --enable-localjpeg --enable-localzlib

LDFLAGS='-static-libgcc -static-libstdc++'  is required for building Windows executables.

The first flag is for the cross-compiler (which is installed on my system), the other flags make sure that the bundled image libraries are built as well.

```
$ make -j15
=== making jpeg ===
make[1]: warning: -j15 forced in submake: resetting jobserver mode.
make[1]: Entering directory '/git/fltk/branch-1.4/jpeg'
Compiling jaricom.c...
Compiling jcapimin.c...
...
Compiling drivers/SVG/Fl_SVG_File_Surface.cxx...
/usr/bin/i686-w64-mingw32-ar cr ../lib/libfltk.a ...        <<< NOTE: using cross-build tools
/usr/bin/i686-w64-mingw32-ar cr ../lib/libfltk_forms.a ...
/usr/bin/i686-w64-mingw32-ar cr ../lib/libfltk_gl.a ...
/usr/bin/i686-w64-mingw32-ar cr ../lib/libfltk_images.a ...
...
Compiling ExternalCodeEditor_WIN32.cxx...
Linking fluid.exe...                                        <<< cross-building: `fluid.exe` !
...
make[1]: Entering directory '/git/fltk/branch-1.4/test'
Compiling animated.cxx...
Compiling adjuster.cxx...
Compiling arc.cxx...
...
Generating fast_slow.cxx and header from fast_slow.fl...
Generating fast_slow.h and header from fast_slow.fl...
...
Linking fast_slow.exe...
Linking inactive.exe...
...

(Build finished)

Executing some tests:

$ fluid --version   # fluid on the build host in my PATH
fluid v1.5.0

$ head -2 test/fast_slow.fl
# data file for the Fltk User Interface Designer (fluid)
version 1.0401

$ head -1 test/fast_slow.cxx 
// generated by Fast Light User Interface Designer (fluid) version 1.0500

$ file fluid/fluid.exe 
fluid/fluid.exe: PE32 executable (GUI) Intel 80386, for MS Windows, 17 sections

$ wine fluid/fluid.exe --version       # executing the just built fluid(.exe) under wine
fluid v1.4.4

$ file test/fast_slow.exe 
test/fast_slow.exe: PE32 executable (GUI) Intel 80386, for MS Windows, 17 sections
```

Well, this should be similar if you are doing a "real" cross-build to amd64 with configure on a stock FLTK source tree. I'm not sure if you need --with-archflags="-m64" as well.

But maybe that was not what you really wanted? I hope it's useful anyway.

df7...@gmail.com

unread,
Aug 21, 2025, 11:13:08 PMAug 21
to fltk.coredev
This is all good info, for now I had just removed the items from DIRS that I didn't need, that got me what I needed. 
Reply all
Reply to author
Forward
0 new messages