Problem:
On Red Hat Linux, when attempting to create an executable using the "cob" command with the "-x" flag, the following error appears:
ld: cannot find -lgcc
Resolution:
An end user might have different versions of gcc installed on Red Hat Linux. Server Express v4.0-SP1 for Red Hat was originally built using gcc version 3.2.3. The file $COBDIR/etc/cobopt includes the following line:
set GCC_LIB=/usr/lib/gcc-lib/i386-redhat-linux/3.2.3
This sets the environment variable GCC_LIB, which is later used by the "cob" command, in cooperation with the file $COBDIR/lib/liblist, at the time "cob" creates an executable by invoking the "ld" linker. If there is no file named "libgcc.a" in the $GCC_LIB directory at this time, then the error occurs: "ld: cannot find -lgcc".
To determine which gcc version is active on a system, the user can look in /user/bin for all files beginning with gcc, for example:
cd /usr/bin
ls -l gcc*
If more than one version is installed, then the "gcc" file itself might be a link to another executable named, for example, "gcc296" or "gcc333". The user could also enter "/usr/bin/gcc -v" to see the version number.
If the gcc version is something other than 3.2.3, then Micro Focus recommends that the user install gcc 3.2.3 and use it, since this is the version Server Express v4.0-SP1 was originally built with. Otherwise, the user could possibly change the file $COBDIR/etc/cobopt, but must then realize that this would be an unsupported configuration.
