Problem complile demo programs
Posted in 2009
Servio Velasco hit ELFCLASS64 linker errors compiling the Informix ODBC demo programs on SunOS 5.10 with gcc and CSDK 3.50 FC3. Venkatesh Gopal suggested adding -m64. A different error remained until Art Kagel advised deleting the old 32-bit dbcreate.o. Servio removed all .o files, used cc -mcpu=v9 -m64, and make worked. Solved.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: Error Codes & Troubleshooting
Good evening I am tryining to compile the demo programs. But these produce errors. Enviroment: SunOs 5.10 sparc 64 gcc GNU C - The GNU C compiler 3.4.3 Informix Dynamic Server 11.50 FC3 Cliente SDK 3.50 FC3 I tried to use the "make" but the result was: cc -mcpu=v9 -o dbcreate dbcreate.o -L/opt/informix/lib/cli -lifdmr -lifcli -laio -lm -lnsl -lsocket -ldl ld: fatal: file /opt/informix/lib/cli/libifdmr.so: wrong ELF class: ELFCLASS64 ld: fatal: file /opt/informix/lib/cli/libifcli.so: wrong ELF class: ELFCLASS64 ld: fatal: File processing errors. No output written to dbcreate collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `dbcreate' Anyone have idea how to resolved the problem. Thank a lot Regard Servio Velasco
Looks like the compile line is using 32 bit. Try adding -m64 to the cc options. VG.
Hello VENKATESH I edited the makefile and set the following: CC = cc -m64 CFLAGS = -DNO_WIN32 -Xa SYSLIBES = -lifdmr -lifcli -laio -lm -lnsl -lsocket -ldl ODBCLIB = -L$(INFORMIXDIR)/lib/cli INCL = -I$(INFORMIXDIR)/incl/cli -I$(INFORMIXDIR)/incl/dmi -I$(INFORMIXDIR)/incl/esql ODBCLIBDIR = -L$(INFORMIXDIR)/lib/cli ODBCLIBS = -lifcli -lifdmr ODBCTHLIBS = -lthcli -lifdmr -lixcli GLSLIB = -L$(INFORMIXDIR)/lib/esql -lifgls -lifglx SOLIBSUFFIX = so UNIXLIB= \\\\ ${INFORMIXDIR}/lib/esql/isqls09b.$(SOLIBSUFFIX) # Targets DBCREATE = dbcreate DEMOS = $(DBCREATE) UNICODE = $(DBCREATEw) all: $(DEMOS) UnicodeDemo: $(UNICODE) unixxa: unixOnePhaseCommitRollback.exe # Rules unixOnePhaseCommitRollback.exe: OnePhaseCommitRollback.o $(CC) $(LDFLAGS) OnePhaseCommitRollback.o $(ODBCLIBDIR) $(UNIXLIB) \\\\ $(GLSLIB) $(SYSLIBES) $(ODBCLIBS) -o OnePhaseCommitRollback.exe OnePhaseCommitRollback.o: OnePhaseCommitRollback.c $(CC) $(CFLAGS) -c $(INCL) OnePhaseCommitRollback.c .c.o: $(RM) $*.o; \\\\ $(CC) -c $(CFLAGS) $(INCL) $*.c # Dependencies $(DBCREATE): $(DBCREATE).o $(CC) -o $(DBCREATE) $(DBCREATE).o $(ODBCLIB) $(SYSLIBES) $(DBCREATEw): $(DBCREATEw).o $(CC) -o $(DBCREATEw) $(DBCREATEw).o $(ODBCLIB) $(SYSLIBES) clean: $(RM) $(DEMOS) $(UNICODE) $(RM) $(DBCREATE).o $(RM) $(DBCREATEw).o But The error is in other file. Before were in the libs (libifdmr.so) and (libifcli.so) Now the error is in (dbcreate.o) -bash-3.00$ make cc -m64 -o dbcreate dbcreate.o -L/opt/informix/lib/cli -lifdmr -lifcli -laio -lm -lnsl -lsocket -ldl ld: fatal: file dbcreate.o: wrong ELF class: ELFCLASS32 ld: fatal: File processing errors. No output written to dbcreate collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `dbcreate' Do you have other recomendation about this? Thank a lot Servio Velasco
delete dbcreate.o and try the make again. Likely a 32bit dbcreate.o was created previously before you changed the settings in the makefile. Art Art S. Kagel Oninit (www.oninit.com) IIUG Board of Directors (art@iiug.org) Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Oninit, the IIUG, nor any other organization with which I am associated either explicitly or implicitly. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Thu, Nov 12, 2009 at 6:40 AM, SERVIO VELASCO <servio_velasco@hotmail.com>wrote: > Hello VENKATESH > > I edited the makefile and set the following: > > CC = cc -m64 > > CFLAGS = -DNO_WIN32 -Xa > SYSLIBES = -lifdmr -lifcli -laio -lm -lnsl -lsocket -ldl > ODBCLIB = -L$(INFORMIXDIR)/lib/cli > INCL = -I$(INFORMIXDIR)/incl/cli -I$(INFORMIXDIR)/incl/dmi > -I$(INFORMIXDIR)/incl/esql > ODBCLIBDIR = -L$(INFORMIXDIR)/lib/cli > ODBCLIBS = -lifcli -lifdmr > ODBCTHLIBS = -lthcli -lifdmr -lixcli > GLSLIB = -L$(INFORMIXDIR)/lib/esql -lifgls -lifglx > SOLIBSUFFIX = so > > UNIXLIB= \\\\ > > ${INFORMIXDIR}/lib/esql/isqls09b.$(SOLIBSUFFIX) > > # Targets > DBCREATE = dbcreate > > DEMOS = $(DBCREATE) > > UNICODE = $(DBCREATEw) > > all: $(DEMOS) > > UnicodeDemo: $(UNICODE) > > unixxa: unixOnePhaseCommitRollback.exe > > # Rules > unixOnePhaseCommitRollback.exe: OnePhaseCommitRollback.o > > $(CC) $(LDFLAGS) OnePhaseCommitRollback.o $(ODBCLIBDIR) $(UNIXLIB) \\\\ > > $(GLSLIB) $(SYSLIBES) $(ODBCLIBS) -o OnePhaseCommitRollback.exe > > OnePhaseCommitRollback.o: OnePhaseCommitRollback.c > > $(CC) $(CFLAGS) -c $(INCL) OnePhaseCommitRollback.c > > ..c.o: > > $(RM) $*.o; \\\\ > > $(CC) -c $(CFLAGS) $(INCL) $*.c > > # Dependencies > > $(DBCREATE): $(DBCREATE).o > > $(CC) -o $(DBCREATE) $(DBCREATE).o $(ODBCLIB) $(SYSLIBES) > > $(DBCREATEw): $(DBCREATEw).o > > $(CC) -o $(DBCREATEw) $(DBCREATEw).o $(ODBCLIB) $(SYSLIBES) > > clean: > > $(RM) $(DEMOS) $(UNICODE) > > $(RM) $(DBCREATE).o > > $(RM) $(DBCREATEw).o > > But The error is in other file. Before were in the libs (libifdmr.so) and > (libifcli.so) Now the error is in (dbcreate.o) > > -bash-3.00$ make > cc -m64 -o dbcreate dbcreate.o -L/opt/informix/lib/cli -lifdmr -lifcli > -laio > -lm -lnsl -lsocket -ldl > ld: fatal: file dbcreate.o: wrong ELF class: ELFCLASS32 > ld: fatal: File processing errors. No output written to dbcreate > collect2: ld returned 1 exit status > *** Error code 1 > make: Fatal error: Command failed for target `dbcreate' > > Do you have other recomendation about this? > > Thank a lot > Servio Velasco > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --0023545bdc1cf139f304782c7e4c
Thank everyone I deleted all files *.o I changed the makefile CC = cc -mcpu=v9 -m64 CFLAGS = -DNO_WIN32 This is form the "make" is working. Regards Servio Velasco