Original post is here: eklausmeier.goip.de
Task at hand: Install the 60-day trial of "IBM COBOL for Linux" on Arch Linux. Please see the updated installation description here: Installing IBM COBOL for Linux on Arch Linux #2.
1. Download. Downloading the compiler is at IBM COBOL for Linux on x86 60-day Trial or here.
2. Unpacking. Downloaded file is marked as gzipped tar, but in actuality it is just a tar file:
1$ file IBM_COBOL_V1.1.0_LINUX_EVAL.x86-64.tar.gz
2IBM_COBOL_V1.1.0_LINUX_EVAL.x86-64.tar.gz: POSIX tar archive (GNU)
Unpacking this tar-file provides 4 deb-files and 4 rpm-files. I picked the deb-files:
- Not required: cobol.cmp.license-eval.1.1.0_1.1.0.0-210903.864_amd64.deb
- Debugging part: cobol.dbg.1.1.0_1.1.0.0-210903.864_amd64.deb
- The compiler: cobol.cmp.1.1.0_1.1.0.0-210903.864_amd64.deb
- Runtime: cobol.rte.1.1.0_1.1.0.0-210903.864_amd64.deb
deb-files can be unpacked with ar
, see How to extract a .deb file without opening it on Debian or Ubuntu Linux. I unpacked the four deb-files. Each deb-files contains
- Can be ignored:
debian-binary
- Can be ignored:
control.tar.gz
data.tar.xz
File data.tar.xz
is then extracted with tar xf
. The resulting subdirectories are then copied to /opt/ibm
. Finally
1chown -R root:root /opt/ibm/cobol
3. Prerequisites. Installation guide specifies that the compiler needs 32-bit libraries. Without 32-bit libraries you will get below error when calling cob2
:
1cob3: execve() failed: rc -1 errno 2 No such file or directory
cob2
is the actual compiler call and is a 64-bit application which in turn calls cob3
, the 32-bit binary.
On Arch Linux the cure is to install lib32-gcc-libs:
1pacman -S lib32-gcc-libs
Before that you have to activate multilib
in /etc/pacman.conf
:
[multilib]
Include = /etc/pacman.d/mirrorlist
With the 32-bit libraries installed, you can check cob3
:
1/opt/ibm/cobol/1.1.0/bin: ldd cob3
2 linux-gate.so.1 (0xf7f2b000)
3 libcob2_32r.so => /opt/ibm/cobol/1.1.0/usr/bin/./../../../rte/usr/lib/libcob2_32r.so (0xf7e30000)
4 libdfp_32r.so => /opt/ibm/cobol/1.1.0/usr/bin/./../../../rte/usr/lib/libdfp_32r.so (0xf7d9b000)
5 libquadmath.so.0 => /usr/lib32/libquadmath.so.0 (0xf7cff000)
6 libdl.so.2 => /usr/lib32/libdl.so.2 (0xf7cf9000)
7 libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7ae8000)
8 libm.so.6 => /usr/lib32/libm.so.6 (0xf7a1b000)
9 libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf79fd000)
10 libpthread.so.0 => /usr/lib32/libpthread.so.0 (0xf79db000)
11 libc.so.6 => /usr/lib32/libc.so.6 (0xf77e2000)
12 libicuuc_32r.so => /opt/ibm/cobol/1.1.0/usr/bin/./../../../rte/usr/lib/libicuuc_32r.so (0xf75f4000)
13 libicui18n_32r.so => /opt/ibm/cobol/1.1.0/usr/bin/./../../../rte/usr/lib/libicui18n_32r.so (0xf72da000)
14 /lib/ld-linux.so.2 => /usr/lib/ld-linux.so.2 (0xf7f2d000)
15 libicudata_32r.so => /opt/ibm/cobol/1.1.0/usr/bin/./../../../rte/usr/lib/libicudata_32r.so (0xf5897000)
The compiler is a 32-bit application and can currently only generate 32-bit executables. In particular, you can not use 64-bit pointer variables. See also Memory Limitations with IBM Enterprise COBOL Compiler. Man page, man -l /opt/ibm/cobol/1.1.0/man/man1/cob2.1
, confirms this:
-q32 Specifies that a 32-bit object program is to be generated. Sets the ADDR(32) compiler option and the linker option to
instruct the linker to create a 32-bit executable module.
-q64 This option is not currently supported. The compiler accepts and ignores this option.
4. Testing the installation. Running the compiler goes like this:
1cob2 hello.cbl
This will generate the usual a.out
.
Overall the installation needs ca. 160 MB of hard disk storage:
1$ du -ks /opt/ibm/cobol
2158860 /opt/ibm/cobol
5. Documentation. IBM provides ample documentation for its Linux COBOL compiler: COBOL for Linux on x86 documentation library.
See Comparing GnuCOBOL to IBM COBOL.
Added 25-Mar-2023: I tried to install the compiler again on Arch Linux, following above guideline. It no longer works. Neither the extraction of the Ubuntu image, nor the RHEL image worked. For the rpm extraction I used package rpmextract. Running cob2
gives below error.
1$ /opt/ibm/cobol/1.1.0/bin/cob2
2SIGSEGV: Likely NULL pointer dereference (0x1).
3
4 PID 12198 PPID 1950 Signal received: 11(0) - SIGSEGV (Segmentation fault) at location 0x7f715f90235d
5 Traceback:
6/opt/ibm/cobol/1.1.0/bin/cob2(+0x8012)[0x55a3b2408012]
7/usr/lib/libc.so.6(+0x38f50)[0x7f715f7e4f50]
8/usr/lib/libc.so.6(+0x15635d)[0x7f715f90235d]
9/opt/ibm/cobol/1.1.0/bin/cob2(+0x76a1)[0x55a3b24076a1]
10/opt/ibm/cobol/1.1.0/bin/cob2(+0x87a3)[0x55a3b24087a3]
11/opt/ibm/cobol/1.1.0/bin/cob2(+0x2d33)[0x55a3b2402d33]
12/usr/lib/libc.so.6(+0x23790)[0x7f715f7cf790]
13/usr/lib/libc.so.6(__libc_start_main+0x8a)[0x7f715f7cf84a]
14/opt/ibm/cobol/1.1.0/bin/cob2(+0x5cc6)[0x55a3b2405cc6]
15 --- End of call chain ---
16zsh: segmentation fault (core dumped) /opt/ibm/cobol/1.1.0/bin/cob2