Build gnuCOBOL manually on Mint 20.2

Build from source files. This was way more work than I usually want to do these days! However it was way less work than trying to fix all of the issues I would have to address on OpenSuse. And Mint’s repositories only offers v2.2 and I wanted the latest version 3.1.2.0. OpenSuse was current and one-click. This is the final working result…

bill@bill-MS-7B79:~$ cobc -V
cobc (GnuCOBOL) 3.1.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart
Built Oct 24 2021 17:42:13
Packaged Dec 23 2020 12:04:58 UTC
C version "9.3.0"
bill@bill-MS-7B79:~$
bill@bill-MS-7B79:~$ cobc --info
cobc (GnuCOBOL) 3.1.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart
Built     Oct 24 2021 17:42:13
Packaged  Dec 23 2020 12:04:58 UTC
C version "9.3.0"

build information
build environment        : x86_64-pc-linux-gnu
CC                       : gcc
C version                : "9.3.0"
CPPFLAGS                 :  -I/usr/local/include
CFLAGS                   : -O2 -pipe -finline-functions -fsigned-char
                           -Wall -Wwrite-strings -Wmissing-prototypes
                           -Wno-format-y2k
LD                       : /usr/bin/ld -m elf_x86_64
LDFLAGS                  :  -Wl,-z,relro,-z,now,-O1

GnuCOBOL information
COB_CC                   : gcc
COB_CFLAGS               : -pipe -I/usr/local/include
                           -I/usr/local/include -Wno-unused
                           -fsigned-char -Wno-pointer-sign
COB_DEBUG_FLAGS          : -ggdb3 -fasynchronous-unwind-tables
COB_LDFLAGS              : 
COB_LIBS                 : -L/usr/local/lib -lcob -lm
COB_CONFIG_DIR           : /usr/local/share/gnucobol/config
COB_COPY_DIR             : /usr/local/share/gnucobol/copy
COB_MSG_FORMAT           : GCC
COB_OBJECT_EXT           : o
COB_MODULE_EXT           : so
COB_EXE_EXT              : 
64bit-mode               : yes
BINARY-C-LONG            : 8 bytes
endianness               : little-endian
native EBCDIC            : no
extended screen I/O      : ncursesw
variable file format     : 0
sequential file handler  : built-in
indexed file handler     : BDB
mathematical library     : GMP
XML library              : libxml2
JSON library             : json-c
bill@bill-MS-7B79:~$

I would like to add that trying to run some gnuCOBOL stand alone executables created on OpenSuse gave me…
./program: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34′ not found (required by ./program)

But if I recompiled the source and it ran fine!

Install steps here!

Prerequsites for Mint 20.2
You need to install these 5 libraries
mpir, gmp, libdb-dev, libxml2-dev and libjson-c-dev
yasm is a prerequsite for mpir

FYI: mpir is for Multiple Precision Integers and Rationals and gmp is for Gnu MultiPrecision Library
libdb-dev is for Berkley DB

So you need to download/build these 2 packages (mpir and gmp )
https://mpir.org/mpir-3.0.0.tar.bz2
https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz

Note: Before building mpir…
sudo apt-get update
sudo apt install yasm

These are the 4 steps needed for mpir and gmp
./configure
make
make check [Important: I’ve had this step fail because of the directory structure. KISS!]
sudo make install

For Berkley DB…
I originally made this step much harder than it was by trying to find/build the correct source. But the following 2 lines were all that was needed…
sudo apt-get update
sudo apt-get install libdb-dev

XML & JSON libraries
sudo apt-get install -y libxml2-dev
sudo apt install libjson-c-dev

Finally I installed ncurses for extended screen I/O.

sudo apt install libncurses5-dev libncursesw5-dev

Now I’m ready to build/install gnuCOBOL

./configure
make
make check
sudo make install

Finally…
sudo ldconfig [If you don’t do this, you will get…]
cobc: error while loading shared libraries: libcob.so.4: cannot open shared object file: No such file or directory

make installcheck [Optional: like make check but from the installed library]