I've successfully ported GnuCOBOL to IBM i, and it is now available in the repo.qseco.fr IBM i yum repository. It can now be installed using yum install gnucobol and a specfile is available in our specfiles repository.
Compiling GnuCOBOL from source on IBM i is trivial and does not require any patching, however, when building it using a specfile and the rpmbuild build harness, compilation fails with the following error message:
. ../tests/atconfig && . ../tests/atlocal extras-CBL_OC_DUMP.so \ && $COBC -m -Wall -O -o CBL_OC_DUMP.so CBL_OC_DUMP.cob gcc.bin: error: unrecognized command line option '-R'; did you mean '-R'?
This happens because the rpmbuild build harness supplies rpath values to the configure script, and the resulting cobc internal compilation commands become invalid.
This can be resolved by appending --disable-rpath to the %configure statement when building a specfile.