Hello Ian,

your hint, that a cross compiler is necessary, was the final step to 
success - the whole fltk, including built-in image libs, was built and 
is working when using wine or Windows. The only thing, that seems a 
little strange to me is a "libgcc_s_sjlj-1.dll", I needed to copy to 
Windows system to make the files work under Windows. But it is okay to 
me, to compile final releases using Windows, to prevent need of install 
this dll to customers PCs.

You had been right, it is not very difficult, if having a clue of 
necessary steps. :o/

To prevent other people from repeating my questions and spending lots of 
time for "research" now a little summary of steps to cross compile FLTK 
using Fedora Linux.

1.  Installation of Fedora MinGW Cross-Compile Packages:
- MinGW Windows cross-compiler (GCC) for C
- MinGW Windows cross-compiler for C++
- MinGW Windows binutils
- MinGW Windows cross-C Preprocessor
- MinGW bse filesystem and environment
- MinGW Windows cross-compiler runtime
- Win32 header files and stubs

2. Installation of wine and support packages

3. Konfiguration of wine regarding to libgcc_s_sjlj-1.dll, see
http://fedoraproject.org/wiki/MinGW/Configure_wine

4. Current FLTK lib must be downloaded (this time fltk-1.1.10rc1) and 
./configure must be run, to create files for make.

At this point one should care for necessary options, i.e. "./configure 
--enable-threads" - "./configure --help" shows available options. Be 
aware that your files could be different to following description, 
because of different options. Use brain 1.0. ;o)

5. Before doing make the files "config.h" and "makefile" must be 
patched. The most easy way to do this, is to make a "./configure" using 
Windows and then copying these files to linux system - this will provide 
all windows flags and only paths and tools are to be changed. But 
because Fedore Cross-Compile-Project is aimed to create windows apps 
without need to use Windows, I want to tell about all changes from Linux 
to Windows configuration:

5.a Patch of "config.h":
The differences beween Linux und Windows are some HAVE_SOMETHING, that 
windows doesn't provide. These lines must be deleted or commented out. 
The different entrys are shown like "Li:" for Linux file and "Wd:" for 
Windows file.

Li: #define HAVE_SCANDIR 1
Li: #define HAVE_SCANDIR_POSIX 1
=>
Wd: /* #undef HAVE_SCANDIR */
Wd: /* #undef HAVE_SCANDIR_POSIX */

Li: #define HAVE_SYS_SELECT_H 1
=>
Wd: /* #undef HAVE_SYS_SELECT_H */

Li: #define HAVE_PTHREAD 1
Li: #define HAVE_PTHREAD_H 1
=>
Wd: /* #undef HAVE_PTHREAD */
Wd: /* #undef HAVE_PTHREAD_H */

Li: #define HAVE_DLFCN_H 1
Li: #define HAVE_DLSYM 1
=>
Wd: /* #undef HAVE_DLFCN_H */
Wd: /* #undef HAVE_DLSYM */

5.b Patch of "makeinclude"
This file is more difficult to patch, it is necessary to change paths, 
tools and windows flags. My first approach is to keep the preinstalled 
MinGW paths and names, but for a more sophisticated cross compile 
environment it might be useful, to copy the tools and rename them to 
standard names like  "i686-pc-mingw32-g++" => g++ (see section "# 
compiler names" of "makeinclude"). Because the entries are named, I 
don't think it is necessary to provide a Windows-Linux comparison and 
only show the different entrys of windows version.

prefix          = /usr/i686-pc-mingw32/sys-root/mingw

# programs we use...
NROFF           =
SHELL           = sh
STRIP           = /usr/i686-pc-mingw32/bin/strip

# compiler names:
CXX             = i686-pc-mingw32-g++
CC              = i686-pc-mingw32-gcc

# flags for C++ compiler:
OPTIM           =  -O3 -Wall -Wunused -Wno-format-y2k  -fno-exceptions 
-fno-strict-aliasing
CFLAGS          = $(OPTIM)    -mno-cygwin -mwindows -DWIN32  -mno-cygwin
CXXFLAGS        = $(OPTIM)    -mno-cygwin -mwindows -DWIN32  -mno-cygwin

# program to make the archive:
[...]
LIBCOMMAND      = /usr/i686-pc-mingw32/bin/ar cr
RANLIB          = /usr/i686-pc-mingw32/bin/ranlib

# libraries to link with:
AUDIOLIBS       = -lwinmm
DSOFLAGS        = -L. -mwindows  -mno-cygwin
LDFLAGS         = $(OPTIM) -mwindows  -mno-cygwin
LDLIBS          =  -lole32 -luuid -lcomctl32 -lwsock32
GLDLIBS         =   -lole32 -luuid -lcomctl32 -lwsock32

IMAGELIBS       = -L../lib -lfltk_png -lfltk_z -lfltk_jpeg

# image libraries to build...
IMAGEDIRS       = jpeg zlib png

# The extension to use for executables...
EXEEXT          = .exe

# Do we build the threads demo?
THREADS         = threads.exe

# Additional GUI install/uninstall targets...
INSTALL_DESKTOP =
UNINSTALL_DESKTOP =

# Build commands and filename extensions...
.c.o:
        echo Compiling $<...
        $(CC) -I.. $(ARCHFLAGS) -I../png -I../jpeg -I../zlib $(CFLAGS) -c $<

.cxx.o:
        echo Compiling $<...
        $(CXX) -I.. $(ARCHFLAGS) -I../png -I../jpeg -I../zlib $(CXXFLAGS) -c $<

6. Now one should open a terminal, go to the fltk directory containing 
patched files and change the path to find MinGW tools first:
PATH=/usr/i686-pc-mingw32/bin:/usr/bin:/bin

7. Typing in "make" now builds cross compile fltk library and the files 
are inside of directories lib (the libraries), fluid and test (some 
.exe-files).

I just used this HowTo and it works for a second time. Now I will go on 
to set up an Eclipse environment...

HTH,

Ed


_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to