, 1 min read

Compiling GnuCOBOL

When compiling GnuCOBOL from source this works without any hiccups. The usual configure, make sequence. I had written on this in Generating JSON with COBOL. But if you run make check you might encounter multiple check-failures when run after makepkg. The reason is that makepkg introduces a couple of system-wide CFLAGS. The cure is to add


to configure. This was recommended by Simon Sobisch, one of the current maintainers of GnuCOBOL, in a personal communication:

"Historically" GnuCOBOL disabled all optimizations, I highly suggest that you add one of the following options to your configure line.

--enable-hardening, --disable-hardening: Enable GNU C "hardening" options: define _FORTIFY_SOURCE and use -fstack-protector. If disabled, these are explicitly removed from CFLAGS for building GnuCOBOL.


The NEWS file from GnuCOBOL 3.1.2 contains the following information on hardening:

new configure option --enable-hardening to either enable GNU C's hardening options or leave as-is, or disable (which previous versions effectively did)