When compiling C programs to be included in "fglgo", you may encounter the following problem, caused by IBM building the Informix dynamic libraries on an older Linux platform. Here is an example:
cfglgo ad.c ad2.c fgiusr.c read_dir.c -o newfglgo /usr/share/informix/lib/esql/libifgls.so: undefined reference to `__ctype_b' /usr/share/informix/lib/esql/libifgls.so: undefined reference to `__ctype_toupper' /usr/share/informix/lib/esql/libifgls.so: undefined reference to `__ctype_tolower' collect2: ld returned 1 exit status
The reference to `__ctype_b' should be satisfied by the C runtime library.
The problem is related to glibc. Anything on RedHat9 with a glibc >= glibc-2.3.2-11.9 is causing the problem. Actually, any stock glibc from at least 2.3.0 up is causing problems.
glibc is no longer exporting `__ctype_b'.
The compat_symbol lines were removed from ctype-info.c in the newer glibc libraries. RedHat8 and below kept the lines in ctype-info.c to support old static libraries.
To fix the problem, add these stubs to one of the modules being compiled and linked with fglgo.
/* * RH9 is missing externals for certain functions from the ctype library. * Since these functions are referenced in the Informix libraries (which * we can't recompile to fix the problem), we must include stubs herein to * resolve the unreferenced externals and call the correct replacement * functions. */ const unsigned short int *__ctype_b (void) { return (__ctypebloc()); } int __ctype_toupper(int c) { return (toupper(c)); } int __ctype_tolower(int c) { return (tolower(c)); }