Build procedure for MinGW compiler

## MINGW Notes

First version: Mar 6 2003
Last Update: Dec 28 2005
Authors: Blas Rodriguez Somoza (blas at puertareal dot com), Dmitry Sibiryakov (aafemt at mail dot ru)

### 0.-Introduction

The MSYS/MINGW build was started with 1.5 beta 4.

The only difference between the msvc build and the mingw build, is that the later one does not support the MS SEH exception handling. This means that some exceptions will not be catched and thus FB will abort.The sources using this exception handling are jrd/blob_filter.cpp, jrd/exe.cpp and jrd/fun.epp.

This port is maintained by Blas Rodriguez Somoza and Dmitry Sibiriakov.

### 1.-TODO

- Support for ms SEH (superserver).
- Executable size problem. The executables are too great. (Partially solved by stripping symbols in production build.)

### 2.-INSTALLING MSYS and MINGW

The following packages from http://www.mingw.org are needed

MinGW

- MinGW 3.1.0 at least.
- binutils 2.15 is required (included in MinGW 4). Binutils 2.13 from MinGW 3.1 produce invalid DLL export table, thus making dynamic load of fbclinet.dll impossible.
- bison-2.0-MSYS. You may omit this package if you are not going to alter *.y files.

MSYS

- MSYS
- msysDTK

If you intend to build an executable installer you will also need to download InnoSetup from http://www.jrsoftware.org

- InnoSetup
- InnoSetup QuickStart Pack

STEPS TO INSTALL

1. Install MinGW, MSYS and msysDTK using appropriate instructions for each package.
2. Optionally install Bison.
3. Install InnoSetup and InnoSetup QuickStart Pack if you want to make a executable installer

### 3.- BUILD PROCESS

1. Start msys with the icon.
2. Go to the firebird2 root directory. For instance, if your root is d:\cvs\firebird you must do cd /d/cvs/firebird2.
3. Start configure with the switches to get super/classic and production/development build, for instance:
   autogen.sh --enable-superserver
   The valid switches for autogen are
   --enable-superserver Select superserver build, default classic build.
   --enable-debug Select debug build, default production build.
   You can run ./configure --help to see full list of switches.
4. If you didn't install Bison, perform 'touch src/dsql/parse.cpp' command.
5. Make the build. For instance if you want to get compiler messages isolated from make log
   make > make.log 2>comp.log
6. After the build finish, the firebird directory with the binaries is created as gen/firebird.

You can use 'make clean' to delete files created during build process when you don't need them anymore. 'make clean_all' will do even more clean. :)

BUILD NOTE:

There is a bug in MinGW GCC (<=3.2) related with MSVC format for 64bit integers. When the I64 format is used, the compiler throws warnings of two types:

warning: [...] format, different type arg (arg 3)
or
warning: unknown conversion type character `I' in format
warning: too many arguments for format

### 4.- INSTALL.

To create an installable build you need to execute the InnoSetup script.

1. Open firebird2/builds/install/arch-specific/mingw/super/FirebirdInstall_15.iss with InnoSetup.
2. Run the script with F9 or Run->Run
3. Close InnoSetup

A executable installer will be in firebird2/builds/install/arch-specific/mingw/super/

To install the build, simply run the resulting exe.

### 5.- TROUBLESHOOTING

AUTOGEN

The autogen script creates an output file in the same directory where it is executed with the name config.out. If the autogen fails look at config.out first.

Some permission problems, most probably related with the CVS client, has been reported. If the autogen gives a permission related error, like
autom4te: cannot open configure: Permission denied
execute in the same directory:
>chmod -R +uw *