May 2013: gawk.exe version 4.1 built for Windows. The xml extension built against this version of gawk.
Intro
To obtain binaries that run under native Windows, gawkextlib needs to be built in a MinGW/Msys environment. The page Creating a MinGW/MSYS environment describes how to create such environment.
Note that all command lines given on this page, starting with ./configure
and make
are issued in MSYS.
Futher, gawkextlib depends on gawk version 4.1 or later. We start building gawk.
Build gawk
I used gawk-4.1.0.tar.gz downloaded from http://ftp.gnu.org/gnu/gawk. I unpacked the archive in a suitable location. The archive contains a very useful readme file:
gawk-4.1.0\README_d\README.pc
to help building. Following this, I copied the files in the `pc’ directory (EXCEPT for `ChangeLog’) to the directory with the rest of the gawk sources. (The subdirectories of `pc’ need not be copied.)
The “prefix” line in the Makefile is used during the install of gawk. I set this to
c:/Programs/MinGW32
Since the libraries for gawk will be installed under $(prefix)/lib/awk
, it is convenient to have this directory in DEFPATH
of config.h or define defpath in gawkmisc.pc. I did the first and replaced
# define DEFPATH ".;c:/lib/awk;c:/gnu/lib/awk"
by
# define DEFPATH ".;c:/MinGW32/lib/awk;c:/Programs/MinGW32/lib/awk"
Issuing ./configure
runs smoothly and generates, amongst others the Makefile.
To reduce the size of the executable, I changed the link flag in Makefile from
LF="-gdwarf-2 -g3"
to
LF="-gdwarf-2 -g3 -s"
make mingw32
runs without errors and
make install
installs in c:/Programs/MinGW32 (as specified by the prefix).
Build gawkextlib
I used gawkextlib-0.4.6.tar.gz, also downloaded from http://sourceforge.net/projects/gawkextlib/files.
I made two small modifications to extension/xml_interface.c
since I could not find a nl_langinfo implementation for Windows platforms. I commented out #include <langinfo.h>
and changed the line char *charset = nl_langinfo(CODESET)
; to
char *charset = "";
Then issued:
./configure --with-gawk=/c/Programs/MinGW32/ --prefix=/c/Programs/MinGW32/
which runs fine.
Running make
runs fine too.
Problem with MinGW dynamic library libintl, solved
Running the command gawk -f Parse-VectorDb.awk VectorDb.xml
gives
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information
and a window with the text “gawk.exe werkt niet meer”.
The culprit appears to be the MinGW library libintl-8.dll. The file comes from the archive libintl-0.18.1.1-2-mingw32-dll-8.tar.lzma.
Using intl.dll and renaming it to libintl-8.dll cures things. The file is contained in gettext-runtime_0.18.1.1-2_win32.zip, obtained from http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies.
Further testing
We carried out some further testing of the created xml and mfpr extensions using ‘make check’. ‘make check’ is supplied with the gawextension package. Since a properly working sh.exe is needed for the tests, the only possibility is using MSYS.
Further, to carry out the tests, the *.ok files in the dir test need to be converted to DOS format (CR/LF). To accomplish this, we issue:
for %f in (*.ok) do unix2dos %f
The created xml and mfpr extensions pass the tests: running ‘make check’ gives
ALL TESTS PASSED.
With these test we finished the build of the xml extension.