ESQL, 4GL and C/gcc on Solaris
Posted in 2005
Topics: Installation, Setup & Upgrades, Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues, Internationalization & Character Sets, Versions, Editions & End-of-Life
I'm trying to compile some elderly programs on a system we're migrating to IDS 10.0, 4GL 7.32 and ESQL , all FC versions, all on Solaris 9 on a 64-bit server. Solaris 9 doesn't come with a C compiler as standard, so I've installed gcc. When I try to compile: # make -f Makefile cfglgo fgiusr.c extras.o nfile.o ndates.o getakey.o read_ln.o scan_weeks.o read_merged.o last_access.o -o /home/caps/tabs/bin/run4gl gcc: language arch=v9 not recognized gcc: language arch=v9 not recognized <repeated many times> gcc: language arch=v9 not recognized ld: fatal: file fgiusr.c: unknown file type ld: fatal: File processing errors. No output written to /home/caps/tabs/bin/run4gl collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `run4gl' I read some cdi stiff that says that the 'arch' flag is a Solaris C thing, and commented it out of $INFORMIXDIR/bin/cfglgo Now I get: # make -f Makefile cfglgo fgiusr.c extras.o nfile.o ndates.o getakey.o read_ln.o scan_weeks.o read_merged.o last_access.o -o /home/caps/tabs/bin/run4gl ld: warning: file /opt/informix/10.0/lib/tools/libfmain.a(fgiapi.o): wrong ELF class: ELFCLASS64 ld: warning: file /opt/informix/10.0/lib/tools/lib4io.a(effin.o): wrong ELF class: ELFCLASS64 ld: fatal: file /opt/informix/10.0/lib/esql/libiffgisql.so: wrong ELF class: ELFCLASS64 ld: fatal: file /opt/informix/10.0/lib/libifasf.so: wrong ELF class: ELFCLASS64 ld: fatal: file /opt/informix/10.0/lib/esql/libifgen.so: wrong ELF class: ELFCLASS64 ld: fatal: file /opt/informix/10.0/lib/esql/libifos.so: wrong ELF class: ELFCLASS64 ld: fatal: file /opt/informix/10.0/lib/esql/libifgls.so: wrong ELF class: ELFCLASS64 ld: fatal: file /opt/informix/10.0/lib/esql/checkapi.o: wrong ELF class: ELFCLASS64 ld: fatal: File processing errors. No output written to /home/caps/tabs/bin/run4gl collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `run4gl' Can it not all be made to work with gcc? Do I need to buy a pukka Solaris C compiler? thanks Neil
>Can it not all be made to work with gcc? Do I need to buy a pukka Solaris C >compiler? I'm not sure what the state of play is now, but in the past (in the UK) it was always possible to get a temporary Solaris cc licence to compile our bespoke runner. If this is a one-off compilation you might like to speak to Sun support and try getting one.
Neil Truby wrote: >I'm trying to compile some elderly programs on a system we're migrating to >IDS 10.0, 4GL 7.32 and ESQL , all FC versions, all on Solaris 9 on a 64-bit >server. >Solaris 9 doesn't come with a C compiler as standard, so I've installed gcc. > > > You've got a Makefile that has flags defined in it (or they're defined by default) for the Solaris C compiler and you're compiling 32 bit rather than 64 bit (that's the ELF class warning). Edit your Makefile and at the top enter a line: CFLAGS<tab>=<tab>-O -m64 You will probably need to clean out corpses -- when an ESQL/C or 4GL compilation fails, you'll have files sitting in the directory that are created by the translator (ESQL/C creates as .c file from the .ec file, for example, and you need to get rid of the .c file manually -- same for 4GL). Then type make and see what happens (you don't need "make -f Makefile," make defaults to use Makefile). The top of your Makefile should like something like MAKEFILE = Makefile CFLAGS = -O -m64 At the risk of confusing things, here's a make.rules file with the rules for building Informix application programs. You would place this file in a local include directory (say, /usr/local/include or something similar) and replace the CFLAGS line above with include /usr/local/include/make.rules Give it a shot. Here's the file (if you need to change the CFLAGS, ECFLAGS, C4FLAGS, change them in make.rules -- once you've got it, you won't have to do it again). The leading spaces in the file below need to be tabs, as do the spaces between the tokens; .e.g., CFLAGS, the equal sign, and the options list. Just replace all multiple spaces in this file with a single tab. These rules "clean up after themselves;" the corpses are removed during normal compilation (but not if compilation fails!). And, after you've got the base rules defined in here (the FLAGS), don't edit them again -- you can override what's in make.rules by including a line in your Makefile as above; you'd do that to define an include path for additional header files (the -I argument). Note that the standard Informix headers are included in the FLAGS in make.rules. You may need to "export CC=gcc" in your .profile if it's not already defined on your system. #ident $Id: make.rules,v 4.6 2002/09/10 16:20:40 trona Exp $ # $Log: make.rules,v $ # # Initial installation # .SUFFIXES: .arc .arc~ .ace .ace~ .cbl .cbl~ .frm .frm~ .per .per~ .o .4gl .4gl~ .4go .ec .ec~ .c .c~ .y .y~ .l .l~ .s .s~ .sh .sh~ .h .h~ # C optimization flag CFLAGS = -O -m64 # ace section .ace~.arc: $(GET) $(GFLAGS) $< ${INFORMIXDIR}/bin/saceprep $< rm -f $*.ace .ace.arc: ${INFORMIXDIR}/bin/saceprep $< # perform section FORM = ${INFORMIXDIR}/bin/sformbld .per~.frm: $(GET) $(GFLAGS) $< ${FORM} $< rm -f $*.per .per.frm: ${FORM} $< # 4gl language section C4GL = c4gl C4FLAGS = -O -m64 -w FGL = fglpc .4gl~: $(GET) $(GFLAGS) $< $(C4GL) $(C4FLAGS) -s -o $@ $< $(LDFLAGS) -rm -f $*.4gl $*.4ec $*.ec $*.[co] .4gl: $(C4GL) $(C4FLAGS) -s -o $@ $< $(LDFLAGS) -rm -f $*.4ec $*.[co] .4gl~.4go: $(GET) $(GFLAGS) $< $(FGL) $*.4gl -rm -f $*.4gl .4gl.4go: $(FGL) $*.4gl .4gl~.o: $(GET) $(GFLAGS) $< $(C4GL) $(C4FLAGS) -e $< $(CC) $(C4FLAGS) -I${INFORMIXDIR}/incl/tools -c $*.c -rm -f $*.4gl $*.4ec $*.ec $*.c .4gl.o: $(C4GL) $(C4FLAGS) -e $< $(CC) $(C4FLAGS) -I${INFORMIXDIR}/incl/tools -c $*.c -rm -f $*.4ec $*.ec $*.c .4gl~.a: $(GET) $(GFLAGS) $< $(C4GL) $(C4FLAGS) -e $< $(CC) $(C4FLAGS) -I${INFORMIXDIR}/incl/tools -c $*.c $(AR) $(ARFLAGS) $@ $*.o -rm -f $*.4gl $*.4ec $*.ec $*.[co] .4gl.a: $(C4GL) $(C4FLAGS) -e $< $(CC) $(C4FLAGS) -I${INFORMIXDIR}/incl/tools -c $*.c $(AR) $(ARFLAGS) $@ $*.o -rm -f $*.4ec $*.ec $*.[co] # esql/c language section ESQL = esql ECFLAGS = -O -m64 .ec~: $(GET) $(GFLAGS) $< $(ESQL) $(ECFLAGS) -s -o $@ $< $(LDFLAGS) -rm -f $*.ec $*.[co] .ec: $(ESQL) $(ECFLAGS) -s -o $@ $< $(LDFLAGS) -rm -f $*.[co] .ec~.o: $(GET) $(GFLAGS) $< $(ESQL) $(ECFLAGS) -e $< $(CC) -I${INFORMIXDIR}/incl/esql $(ECFLAGS) -c $*.c -rm -f $*.ec $*.c .ec.o: $(ESQL) $(ECFLAGS) -e $< $(CC) -I${INFORMIXDIR}/incl/esql $(ECFLAGS) -c $*.c -rm -f $*.c .ec~.a: $(GET) $(GFLAGS) $< $(ESQL) $(ECFLAGS) -e $< $(CC) -I${INFORMIXDIR}/incl/esql $(ECFLAGS) -c $*.c $(AR) $(ARFLAGS) $@ $*.o -rm -f $*.ec $*.[co] .ec.a: $(ESQL) $(ECFLAGS) -e $< $(CC) -I${INFORMIXDIR}/incl/esql $(ECFLAGS) -c $*.c $(AR) $(ARFLAGS) $@ $*.o -rm -f $*.[co] .c~.c: $(GET) $(GFLAGS) $< .c~.o: $(GET) $(GFLAGS) $< $(CC) $(CFLAGS) -c $*.c -rm -f $*.c