We help IT Professionals succeed at work.

cannot open as COFF file when linking a program with oracle libclntst11.a on AIX OS

cobol60
cobol60 asked
on
Hello !

I'm trying to link 2 compiled objects files with libclntst11.a.

I do that with a gcc compiler / linker. I get this error message :

collect2: /oracle/oradb/11.2.0/ora/lib/libclntst11.a: cannot open as COFF file

and here is the command line producing this error :

gcc -L/oracle/oradb/11.2.0/ora/lib -L/usr/lib  main.o  base.o    -lsql11 -lclntsh -lclntst11              -lpthread -lodm  -o istam

the file /oracle/oradb/11.2.0/ora/lib/libclntst11.a exists and the user has access to this file (i compile with the "oracle" user) ...

Anyone has an idea on what's happen ? (i'm a newbie in C/C++ ...)
Comment
Watch Question

Author

Commented:
it appears this lib has a size of 0 bytes ... Is it normal ?

i delete the dependency and now i get this error message :

ld: 0711-317 ERROR: Undefined symbol: .sqlcxt

Author

Commented:
i progress ... It seams that Oracle 11 provides only 64 bits libraries ...

So i recompiled my object files with "gcc -maix64".

Now i get a :

ld: 0711-317 ERROR: Undefined symbol: ._pow
Top Expert 2016
Commented:
oracle 11 surely provides 32-bit libraries. the subfolder for libraries should be lib32. probably you should check environment variables include and lib which may contain the wrong paths.

a library with 0 size is corrupt. you would need to reinstall or unzip from backup if available.

Sara

 
Most Valuable Expert 2013
Top Expert 2013
Commented:
>> it appears this lib has a size of 0 bytes ... Is it normal ? <<

Yes - you must generate this lib manually with $ORACLE_HOME/bin/genclntst

Notes from the script's header:

#    DESCRIPTION
#      This script generate the library libclntst11.a: a single static
#      library clients can use to link OCI, Pro*C, and XA applications
#
#    NOTES
#      This script assumes the client shared library has already been
#      generated and the linker map file for it has been saved to the
#      file ${LIB_DIR}/clntsh.map.  The map file is scanned to determine
#      the list of objects to include in the static library.


wmp
 

Author

Commented:
this version of Oracle has been "manipulated" and validated by level 3 support of my customer. And i can't reinstall Oracle as this is a Production version : i have no access to this machine and must correct the bug ASAP.

To finish : the -lm did the trick at linking to correct the preceding error

Author

Commented:
i think my customer erased the lib32 directory because it is not present ...

Author

Commented:
Thank's !