COBOL still runs payroll, billing and banking systems everywhere, and plenty of shops want to compile and test that code on modern Linux. GnuCOBOL is the free COBOL compiler that makes that possible, but Enterprise Linux 10 doesn’t ship it in the base repositories. The ZWIEGNET GnuCOBOL for Enterprise Linux 10 project closes that gap with ready-to-install RPMs for AlmaLinux 10, RHEL 10, Oracle Linux 10, Rocky Linux 10 and CentOS Stream 10.
Project on GitHub: azwieg103/gnucobol
What GnuCOBOL is
GnuCOBOL translates COBOL source into C and then uses the system C compiler to produce native executables. The package includes the compiler, cobc, and its runtime library, libcob. Because the final step is a normal C compile, your COBOL programs end up as ordinary Linux binaries you can run, debug and deploy like anything else.
Why this repository exists
Building GnuCOBOL by hand on every server gets old fast, and hand builds drift. This project turns it into a repeatable package pipeline:
- The
upstream/directory holds a snapshot of the official GnuCOBOL source, synchronized from the project’s SourceForge Subversion repository. - It deliberately tracks
branches/gnucobol-3.x. GnuCOBOL 4.0 is a separate compatibility line, so it is never silently swapped in. - A sync workflow checks SourceForge on a schedule (or on demand), commits any upstream change and records the Subversion revision.
- The RPM workflow builds the source in an AlmaLinux 10 container, runs the GnuCOBOL test suite and publishes a GitHub Release only if everything passes.
Supported platforms
The RPMs are built on AlmaLinux 10 x86_64 and are intended for the whole Enterprise Linux 10 family:
- AlmaLinux 10
- Red Hat Enterprise Linux (RHEL) 10
- Oracle Linux 10
- Rocky Linux 10
- CentOS Stream 10
They are not individually built or tested on every distribution in that list, so compatibility can vary with your system. As the README says plainly, the packages come with no warranty or support.
Package versions explained
The RPM version is the upstream numeric version without any suffix, because RPM version fields don’t use -dev. Upstream 3.3-dev therefore becomes RPM version 3.3. The release field is ZWIEGNET.N.el10, where N counts rebuilds of the same upstream version. The earliest 3.3 builds, ZWIEGNET.1 and ZWIEGNET.2, predate the .el10 suffix. At the time of writing, the current release is:
gnucobol-3.3-ZWIEGNET.3.el10.x86_64.rpm
Each release also carries a source RPM plus debuginfo and debugsource packages.
Install GnuCOBOL on AlmaLinux 10, RHEL 10 or Rocky Linux 10
Download the binary RPM from the GitHub Releases page, then install it with dnf so its library dependencies are pulled in from your configured repositories:
sudo dnf install ./gnucobol-3.3-ZWIEGNET.3.el10.x86_64.rpm
GnuCOBOL compiles through the system C compiler, so make sure gcc is installed too:
sudo dnf install -y gcc
cobc --version
Hello, World! in COBOL
Create helloworld.cob. The fixed-format indentation matters, so keep the leading spaces:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY "Hello, World!".
STOP RUN.
Compile it to an executable with -x and run it:
cobc -x helloworld.cob
./helloworld
Expected output:
Hello, World!
Packaging choices worth knowing
- Berkeley DB support is disabled. The package is configured
--without-db, and no Berkeley DB development package is installed in the build environment. - Database clients are your application’s business. Integrations such as PostgreSQL are treated as application build dependencies, not compiler-package dependencies.
- Shared libraries only. Static libraries are disabled.
- Clean compiler flags for your programs. The spec configures GnuCOBOL with portable flags, then applies the full EL hardening flags only to the package build. That stops RPM-only GCC specs (such as
redhat-hardened-cc1and annobin) from being baked into GnuCOBOL’s installedCOB_CFLAGS, where they could break latercobccompiles on systems that aren’t doing an RPM build. - The test suite runs during the build.
%checkrunsmake checkwithTERM=xtermso the curses tests work in a headless container.
Build the RPM yourself
On AlmaLinux 10, enable CRB and install the same build requirements the CI workflow uses (.github/workflows/build-rpm.yml):
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --set-enabled crb
sudo dnf -y install gcc gcc-c++ make autoconf automake libtool bison flex \
gettext-devel ncurses-devel ncurses-term gmp-devel texinfo \
pkgconf-pkg-config rpm-build rpmdevtools git python3 \
tar gzip findutils sed grep help2man
Then clone the repository and run the build script:
git clone https://github.com/azwieg103/gnucobol.git
cd gnucobol
bash scripts/build-rpm.sh
The script copies upstream/ to a work directory, regenerates the autotools files (the SourceForge export omits them) and runs rpmbuild. Finished RPMs land in dist/. A local build defaults to release ZWIEGNET.1.el10. In CI the next number is chosen automatically from earlier releases. For the general workflow, see Build RPM From Source.
Troubleshooting
cobcfails with a C compiler error: installgcc. GnuCOBOL needs it for every compile.- dnf can’t resolve dependencies: the package links against libraries such as ncurses and GMP from the base OS. Make sure your system’s BaseOS and AppStream repositories are enabled. On RHEL, that also means an active subscription.
build-rpm.shstops with “required build command not found”: the script checks forgcc,make,autoconf,automake,libtool,rpmbuildandtarbefore it starts. Install the package list above.- “upstream/ is missing”: you are not in a full clone, or
upstream/configure.acis absent. Re-clone the repository. - You need indexed files backed by Berkeley DB: this package doesn’t enable that. Build your own variant from the spec.
FAQ
Is this official GnuCOBOL? No. It is a community rebuild of the official source for Enterprise Linux 10. The upstream project lives at sourceforge.net/projects/gnucobol.
Why 3.x and not 4.0? GnuCOBOL 4.0 is a separate development line with its own compatibility story. This package stays on 3.x on purpose.
Does it work on EL9? The packages target EL10 only.
How do I report a problem? Open an issue on the GitHub repository. Security reports should follow the repository’s SECURITY.md.
License
GnuCOBOL is free software. The RPM spec declares GPL-3.0-or-later, and upstream notes that the libcob runtime library is distributed under the GNU Lesser General Public License. See upstream/COPYING and upstream/COPYING.LESSER in the repository.
If you develop on Red Hat-family systems, Developing Applications for RHEL/CentOS is useful background.
Download
Get the RPMs and source here: github.com/azwieg103/gnucobol. Releases are on the releases page.
