Building Gen generated code on Linux systems using a newer version of the gcc compiler (version 10 and 11) will result in linker errors.
Customers will observe the following error when linking with the newer compiler versions:
multiple definition of ‘{variable}’
Examples of this error are:
multiple definition of ‘sqlca’
multiple definition of ‘ief_runtime_parm1’
multiple definition of ‘environment_list’
This document will provide a workaround to prevent the linker errors.
Redhat 8 with gcc-toolset-10.* or gcc-toolset-11.*
Redhat 9 with gcc-11.* or gcc-toolset-10.*
Note: The gcc-toolset-10.* and gcc-toolset-11.* are installed in addition to the default gcc compiler.
It has been discovered that recent versions of the gcc compiler (versions 10 and 11) have changed the default behavior of a compiler option that will now generate errors when compiling generated code.
The compiler option -fcommon has now been defaulted to –fno-common. Gen generated code contain several variables (as illustrated in Issue above) that are compiled into an object’s common segment, and are resolved during the link step. The change in default compiler option prevents the use of this common segment, which ends up causing the error when linking.
There is a workaround which will revert the compiler default.
Shortly after publishing this knowledge article a PTF has been created (RTX86307/LU11089) to revert the compiler default.
Edit the $IEFH/make/ief_linux.h file, adding –fcommon after the –fPIC for the definition of CFLAGS and CFLAGS2 as illustrated below:
#ifdef IEF_TUX
CC = g++
CFLAGS =
VIEWC32 = viewc32
TUXINC = -I$(TUXDIR)/include
COMLIBS = -L$(CIGEN) -ltxsx
CIREMOBJ = $(CIGEN)/ciremuse.a -L$(CIGEN) –lreqtok
#ifdef IEF_ORACLE
TUXEDO_DBMS = -r Oracle_XA
LIBS=$(SOCKLIB) $(SYSLIBS)
#endif
CFLAGS2 = -m$(GEN_BITS_ENV) -fPIC –fcommon $(DAASYS) $(STD_INCL) \
-D_XOPEN_SOURCE_EXTENDED=1 -D_XOPEN_SOURCE \
$(DBMSINC) $(TUXINC) $(SNPLOG) $(OPTDBG) -DBM_RT
CFLAGS = -m$(GEN_BITS_ENV) -fPIC –fcommon $(DAASYS) $(STD_INCL) \
-D_XOPEN_SOURCE_EXTENDED=1 -D_XOPEN_SOURCE \
$(DBMSINC) $(SNPLOG) $(OPTDBG) -DBM_RT
#else
CFLAGS2 = -m$(GEN_BITS_ENV) -fPIC –fcommon $(DAASYS) $(STD_INCL) \
-D_XOPEN_SOURCE_EXTENDED=1 -D_XOPEN_SOURCE \
$(DBMSINC) $(SNPLOG) $(OPTDBG) -DBM_RT
CFLAGS = -m$(GEN_BITS_ENV) -fPIC –fcommon $(DAASYS) $(STD_INCL) \
-D_XOPEN_SOURCE_EXTENDED=1 -D_XOPEN_SOURCE \
$(DBMSINC) $(SNPLOG) $(OPTDBG) -DBM_RT
#endif
#endif
#if !defined(IEF_GENERATED_APPLICATION)
CCLD = $(CC)
CFLAGS = -m$(GEN_BITS_ENV) -fPIC –fcommon $(DAASYS) -D_XOPEN_SOURCE_EXTENDED=1 -D_XOPEN_SOURCE \
-DIEF_POSIX $(STD_INCL) $(DBMSINC) $(SNPLOG) $(OPTDBG) -DBM_RT
CFLAGS2 = -m$(GEN_BITS_ENV) -fPIC –fcommon $(DAASYS) -D_XOPEN_SOURCE_EXTENDED=1 -D_XOPEN_SOURCE \
-DIEF_POSIX $(STD_INCL) $(DBMSINC) $(SNPLOG) $(OPTDBG) -DBM_RT
CXXFLAGS = -m$(GEN_BITS_ENV) -fPIC $(DAASYS) -D_XOPEN_SOURCE_EXTENDED=1 -D_XOPEN_SOURCE \
-DIEF_POSIX $(STD_INCL) $(DBMSINC) $(SNPLOG) $(OPTDBG) -c \
-DRW_BYTES_PER_WORD=4 -DRW_BYTES_PER_PTR=4 -DBM_RT
LOC_CXXFLAGS = $(CXXFLAGS)
#endif
The compiler flags in $IEFH/make/ief_linux.h are used when building Gen generated code.
Once the temporary fix has been made, perform a Build Tool Clean and then rebuild.