PDA

View Full Version : problem compiling c (pro*c) program - problem with oracle shared library


Daud
05-27-2005, 10:43 PM
HPUX 11iv2 (11.23)
HP Itanium2
8 Gig RAM
Oracle9i (9.2.0.6.0)

I got this error below that I have not been able to solve. Can someone
help? I am not a really a programmer .. more like a dba.

$ Make_idbicms
ld: Can't find library or mismatched ABI for -llibclntsh.so
Fatal error.
collect2: ld returned 1 exit status

$ more Make_idbicms
gcc -DPRINT -DLOG idba1Mainsend.c idba1ReadTransmit.c
idba1AssembleMsg.c idba1UtilMQ.c idba1LogError.c idba1ReadConfig.c
idba1UpdateReceive.c idba1DecodeMsg.c -ansi -I../INCLUDE
-I/u01/app/oracle/9.2.0/precomp/public -L/opt/mqm/lib -lmqic -
L/u01/app/oracle/9.2.0/lib -l:libclntsh.so idba1EnableSignal.o -o
idbicms

libclntsh.so is there in $ORACLEHOME/lib.

'Oracle Programmer' has been installed. But in
$ORACLE_HOME/precomp/demo I only see these directories:

$ cd $ORACLE_HOME/precomp/demo
$ ls -l
total 6
drwxrwxr-x 2 oracle dba 1024 May 11 10:55 procob
drwxrwxr-x 2 oracle dba 1024 May 11 10:55 procob2
drwxr-xr-x 2 oracle dba 1024 May 10 14:02 sql

The environment variables are as follows:

ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/9.2.0
export ORACLE_HOME


LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/rdbms/lib
export LD_LIBRARY_PATH

SHLIB_PATH=$ORACLE_HOME/lib32:/usr/lib:$ORACLE_HOME/rdbms/lib32
export SHLIB_PATH

PATH=$PATH:$ORACLE_HOME/bin:/opt/java1.4/bin
export PATH

ORACLE_SID=IDBP1
export ORACLE_SID


CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export CLASSPATH

TNS_ADMIN=$ORACLE_HOME/network/admin
export TNS_ADMIN

PATH=/usr/ccs/bin:/etc:/usr/bin:/usr/local/bin:$PATH
export PATH

Anything wrong?

regards
Daud

Sybrand Bakker
05-27-2005, 10:54 PM
On 27 May 2005 23:43:35 -0700, "Daud" <daud11@hotmail.com> wrote:
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/rdbms/lib export LD_LIBRARY_PATH SHLIB_PATH=$ORACLE_HOME/lib32:/usr/lib:$ORACLE_HOME/rdbms/lib32 export SHLIB_PATH


Likely $ORACLE_HOME/lib has 64-bit libraries, and you can't definitely
point to *both* 64-bit libraries *and* 32-bit libraries.
Whether you need to set LD_LIBRARY_PATH or SHLIB_PATH is platform
dependent, and can be looked up in the documentation.


--
Sybrand Bakker, Senior Oracle DBA

Daud
05-28-2005, 12:23 AM
Sybrand Bakker wrote: On 27 May 2005 23:43:35 -0700, "Daud" <daud11@hotmail.com> wrote:LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/rdbms/lib export LD_LIBRARY_PATH SHLIB_PATH=$ORACLE_HOME/lib32:/usr/lib:$ORACLE_HOME/rdbms/lib32 export SHLIB_PATH Likely $ORACLE_HOME/lib has 64-bit libraries, and you can't definitely point to *both* 64-bit libraries *and* 32-bit libraries. Whether you need to set LD_LIBRARY_PATH or SHLIB_PATH is platform dependent, and can be looked up in the documentation. -- Sybrand Bakker, Senior Oracle DBA

First I removed LD_LIBRARY_PATH and recompiled. NO luck.
Then I added LD_LIBRARY_PATH and removed SHLIB_PATH. Recompiled and
still no luck. Anything else I should check? What documentation are you
talking about?

regards
Daud

Maxim Demenko
05-28-2005, 01:35 AM
Daud schrieb: Sybrand Bakker wrote:On 27 May 2005 23:43:35 -0700, "Daud" <daud11@hotmail.com> wrote:LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/rdbms/lib export LD_LIBRARY_PATH SHLIB_PATH=$ORACLE_HOME/lib32:/usr/lib:$ORACLE_HOME/rdbms/lib32 export SHLIB_PATHLikely $ORACLE_HOME/lib has 64-bit libraries, and you can't definitelypoint to *both* 64-bit libraries *and* 32-bit libraries.Whether you need to set LD_LIBRARY_PATH or SHLIB_PATH is platformdependent, and can be looked up in the documentation.--Sybrand Bakker, Senior Oracle DBA First I removed LD_LIBRARY_PATH and recompiled. NO luck. Then I added LD_LIBRARY_PATH and removed SHLIB_PATH. Recompiled and still no luck. Anything else I should check? What documentation are you talking about? regards Daud

As Sybrand pointed, you have most likely version mismatch.
1) LD_LIBRARY_PATH is for Solaris and Linux, you don't have to set this
variable on HPUX ( of course, i have seen some commercial Makefiles that
seeks for LD_LIBRARY_PATH on HPUX, but IMHO , Oracle is aware of it.
2) I'm not sure about HPUX on Itanium 2, but assume , is 64 bit, you
should see it with "uname -a"
3) Your Oracle installation is most likely 64 bit ( as you have
$ORACLE_HOME/lib and $ORACLE_HOME/lib32,
check the version of your libclnt.sh with "nm libclntsh.so"
4) If the check above should show 64 bit, then i would suggest
a) Remove export LD_LIBRARY_PATH from your settings
b) Replace in the SHLIB_PATH all references to lib32 through lib (e.g.
SHLIB_PATH=$ORACLE_HOME/lib:/usr/lib:$ORACLE_HOME/rdbms/lib
)


Best regards

Maxim

Daud
05-28-2005, 01:55 AM
Hi Maxim,

nm libclntsh.so returns 'no symbols'. I removed LD_LIBRARY_PATH and
pointed SHLIB_PATH to lib (instead of lib32) but I still got the same
compile error. Anything else I shd try?

regards
Daud

Maxim Demenko
05-28-2005, 02:17 AM
Daud schrieb: Hi Maxim, nm libclntsh.so returns 'no symbols'. I removed LD_LIBRARY_PATH and pointed SHLIB_PATH to lib (instead of lib32) but I still got the same compile error. Anything else I shd try? regards Daud

I'm afraid, i pointed you to wrong utility to check , what kind of
shared library is libclntsh.so, you should do it with
"file libclntsh.so" , but "no symbols" sounds a little bit strange...
You can try to run $ORACLE_HOME/bin/genclntsh to recreate this library (
prior to that make a backup of your existing file )

Best regards

Maxim

Daud
05-28-2005, 02:27 AM
I got 'ELF-64 shared object file' in $ORACLE_HOME/lib and
understandably 'ELF-32 shared object file' in $ORACLE_HOME/lib32.

Maxim Demenko
05-28-2005, 04:23 AM
Daud schrieb: I got 'ELF-64 shared object file' in $ORACLE_HOME/lib and understandably 'ELF-32 shared object file' in $ORACLE_HOME/lib32.

Well, i'm not much dealed with all with ProC* staff, but to localize the
error i would try to compile oracle samples with the demo_proc.mk. From
your previous post it seems, you don't have proper installed Pro C - the
directory in $ORACLE_HOME/precomp/proc is missing. It happens sometimes
if you choose Programmer Component during the Server Installation. To
install that "for sure" you have to do Client Installation, choose
custom, choose Oracle Programmer. After that , if you cannot get the
samples compiled - its the issue for Oracle Support. If you can -
compile your Program with Makefile from Oracle, if that succeed -ok, if
not - you still should get support from Oracle, because the first thing
the guys ask you: "did you used the makefile from Oracle?"

Best regards

Maxim

Daud
05-28-2005, 09:39 PM
Ok will try this and let you guys know. Thanks.

Daud
05-29-2005, 07:05 AM
Maxim Demenko wrote: Daud schrieb: I got 'ELF-64 shared object file' in $ORACLE_HOME/lib and understandably 'ELF-32 shared object file' in $ORACLE_HOME/lib32. Well, i'm not much dealed with all with ProC* staff, but to localize the error i would try to compile oracle samples with the demo_proc.mk. From your previous post it seems, you don't have proper installed Pro C - the directory in $ORACLE_HOME/precomp/proc is missing. It happens sometimes if you choose Programmer Component during the Server Installation. To install that "for sure" you have to do Client Installation, choose custom, choose Oracle Programmer. After that , if you cannot get the samples compiled - its the issue for Oracle Support. If you can - compile your Program with Makefile from Oracle, if that succeed -ok, if not - you still should get support from Oracle, because the first thing the guys ask you: "did you used the makefile from Oracle?" Best regards Maxim

Below seems ok to me.

oracle@crmidb03:/u01/app/oracle/9.2.0/precomp/demo/proc>make -f
$ORACLE_HOME/precomp/demo/proc/demo_proc.mk build EXE=sample1
OBJS=sample1.o

make -f /u01/app/oracle/9.2.0/precomp/demo/proc/demo_proc.mk
PROCFLAGS="" PCCSRC=sample1 I_SYM=include= pc1
proc iname=sample1 include=.
include=/u01/app/oracle/9.2.0/precomp/public
include=/u01/app/oracle/9.2.0/rdbms/public
include=/u01/app/oracle/9.2.0/rdbms/demo
include=/u01/app/oracle/9.2.0/plsql/public
include=/u01/app/oracle/9.2.0/network/public

Pro*C/C++: Release 9.2.0.6.0 - Production on Sun May 29 14:42:05 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

System default option values taken from:
/u01/app/oracle/9.2.0/precomp/admin/pcscfg.cfg

cc +Olibmerrno +Ofast +Olit=all +DSblended +Oshortdata=8 +O2
-Ae -z +Olibmerrno +Z -DHPUX -DORAIA64 -DHPUX_IA64 +DD64 -DSS_64B
IT_SERVER -DHPPA64 -DSLS8NATIVE -DSLU8NATIVE +DD64 -D_REENTRANT
-DHPUX_KTHREAD -DSLXMX_ENABLE -DSLTS_ENABLE -D_REENTRANT -DPRECOMP
-I.
-I/u01/app/oracle/9.2.0/precomp/public
-I/u01/app/oracle/9.2.0/rdbms/public -I/u01/app/oracle/9.2.0/rdbms/demo
-I/u01/app/oracle/9.2.0/
plsql/public -I/u01/app/oracle/9.2.0/network/public -DHPUX -D_REENTRANT
-DHPUX_KTHREAD -DSLXMX_ENABLE -DSLTS_ENABLE -D_LARGEFILE64_SOURCE=1
-DSS_64BIT_SERVER -DBIT64 -DMACHINE64 -DORAIA64 -DHPUX_IA64 -c
sample1.c
(Bundled) cc: warning 922: "+Olibmerrno" is unsupported in the bundled
compiler, ignored.
(Bundled) cc: warning 922: "+Ofast" is unsupported in the bundled
compiler, ignored.
(Bundled) cc: warning 922: "+Olit=all" is unsupported in the bundled
compiler, ignored.
(Bundled) cc: warning 922: "+Oshortdata=8" is unsupported in the
bundled compiler, ignored.
(Bundled) cc: warning 922: "+O2" is unsupported in the bundled
compiler, ignored.
(Bundled) cc: warning 922: "-Ae" is unsupported in the bundled
compiler, ignored.
(Bundled) cc: warning 922: "+Olibmerrno" is unsupported in the bundled
compiler, ignored.
Error (future) 355: "sample1.c", line 240 # Function 'main' must return
type 'int'.
void main()
^^^^
Warning: 1 future errors were detected and ignored. Add a '+p'
option to detect and fix them before they become fatal errors in a
future release. Behavior of this ill-formed program is not guaranteed
to match that of a well-formed program
cc +DD64 -o sample1 sample1.o -L/lib/hpux64
-L/u01/app/oracle/9.2.0/lib/ -lclntsh `cat
/u01/app/oracle/9.2.0/lib/ldflags` `cat
/u01/app/oracle/9.2.0/lib/sysliblist` -lm

Sybrand Bakker
05-29-2005, 07:36 AM
On 29 May 2005 08:05:51 -0700, "Daud" <daud11@hotmail.com> wrote:
Below seems ok to me.

So what does it tell you? You need 64 bit libraries and you don't need
to and can't set up environment variables to 32-bit libraries.


--
Sybrand Bakker, Senior Oracle DBA

Maxim Demenko
05-29-2005, 08:36 AM
Daud schrieb: Maxim Demenko wrote:Daud schrieb:I got 'ELF-64 shared object file' in $ORACLE_HOME/lib andunderstandably 'ELF-32 shared object file' in $ORACLE_HOME/lib32.Well, i'm not much dealed with all with ProC* staff, but to localize theerror i would try to compile oracle samples with the demo_proc.mk. Fromyour previous post it seems, you don't have proper installed Pro C - thedirectory in $ORACLE_HOME/precomp/proc is missing. It happens sometimesif you choose Programmer Component during the Server Installation. Toinstall that "for sure" you have to do Client Installation, choosecustom, choose Oracle Programmer. After that , if you cannot get thesamples compiled - its the issue for Oracle Support. If you can -compile your Program with Makefile from Oracle, if that succeed -ok, ifnot - you still should get support from Oracle, because the first thingthe guys ask you: "did you used the makefile from Oracle?"Best regardsMaxim Below seems ok to me. oracle@crmidb03:/u01/app/oracle/9.2.0/precomp/demo/proc>make -f $ORACLE_HOME/precomp/demo/proc/demo_proc.mk build EXE=sample1 OBJS=sample1.o make -f /u01/app/oracle/9.2.0/precomp/demo/proc/demo_proc.mk PROCFLAGS="" PCCSRC=sample1 I_SYM=include= pc1 proc iname=sample1 include=. include=/u01/app/oracle/9.2.0/precomp/public include=/u01/app/oracle/9.2.0/rdbms/public include=/u01/app/oracle/9.2.0/rdbms/demo include=/u01/app/oracle/9.2.0/plsql/public include=/u01/app/oracle/9.2.0/network/public Pro*C/C++: Release 9.2.0.6.0 - Production on Sun May 29 14:42:05 2005 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. System default option values taken from: /u01/app/oracle/9.2.0/precomp/admin/pcscfg.cfg cc +Olibmerrno +Ofast +Olit=all +DSblended +Oshortdata=8 +O2 -Ae -z +Olibmerrno +Z -DHPUX -DORAIA64 -DHPUX_IA64 +DD64 -DSS_64B IT_SERVER -DHPPA64 -DSLS8NATIVE -DSLU8NATIVE +DD64 -D_REENTRANT -DHPUX_KTHREAD -DSLXMX_ENABLE -DSLTS_ENABLE -D_REENTRANT -DPRECOMP -I. -I/u01/app/oracle/9.2.0/precomp/public -I/u01/app/oracle/9.2.0/rdbms/public -I/u01/app/oracle/9.2.0/rdbms/demo -I/u01/app/oracle/9.2.0/ plsql/public -I/u01/app/oracle/9.2.0/network/public -DHPUX -D_REENTRANT -DHPUX_KTHREAD -DSLXMX_ENABLE -DSLTS_ENABLE -D_LARGEFILE64_SOURCE=1 -DSS_64BIT_SERVER -DBIT64 -DMACHINE64 -DORAIA64 -DHPUX_IA64 -c sample1.c (Bundled) cc: warning 922: "+Olibmerrno" is unsupported in the bundled compiler, ignored. (Bundled) cc: warning 922: "+Ofast" is unsupported in the bundled compiler, ignored. (Bundled) cc: warning 922: "+Olit=all" is unsupported in the bundled compiler, ignored. (Bundled) cc: warning 922: "+Oshortdata=8" is unsupported in the bundled compiler, ignored. (Bundled) cc: warning 922: "+O2" is unsupported in the bundled compiler, ignored. (Bundled) cc: warning 922: "-Ae" is unsupported in the bundled compiler, ignored. (Bundled) cc: warning 922: "+Olibmerrno" is unsupported in the bundled compiler, ignored. Error (future) 355: "sample1.c", line 240 # Function 'main' must return type 'int'. void main() ^^^^ Warning: 1 future errors were detected and ignored. Add a '+p' option to detect and fix them before they become fatal errors in a future release. Behavior of this ill-formed program is not guaranteed to match that of a well-formed program cc +DD64 -o sample1 sample1.o -L/lib/hpux64 -L/u01/app/oracle/9.2.0/lib/ -lclntsh `cat /u01/app/oracle/9.2.0/lib/ldflags` `cat /u01/app/oracle/9.2.0/lib/sysliblist` -lm

What makes me suspicious in your make call ( from very first posting ) -
you link with libclntsh.so by -l:libclntsh.so
As i said, i'm not c developer, but iirc, libraries should be linked
like -lclntsh ( i.e. prefix "lib" and suffix ".so" should be dropped -
you can see it from output of demo_proc.mk ). The next thing - you try
to build your program with gcc, on another side demo_proc.mk uses
bundled cc compiler . Afaik, for oracle gcc is supported compiler only
on linux systems, on hpux you should use aCC or bundled , whatever is
supported ( you can find it in Metalink
http://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=43208.1&blackframe=1)

So, as i mentioned before, you should build your program with ( maybe
adjusted) demo_proc.mk, as only on this way you can be sure that you use
right compiler, right flags and right syntax to link with oracle
libraries. To build 32bit programs on 64bit system you can use
demo_proc32.mk ( should be in the same directory ).

Best regards

Maxim

Daud
05-30-2005, 05:43 AM
Hi Maxim,

I changed to "-lclntsh" and got passed the error. But now another
error. SHLIB_PATH is pointing to 32 bit libraries because we are using
32-bit mqseries client.

Ok maybe i should try using the correct way. This is what I have:

idba1ReadConfig.pc ,idba1ReadTransmit.pc ,idba1UpdateReceive.pc
idba1AssembleMsg.c, idba1DecodeMsg.c, idba1EnableSignal.c,
idba1LogError.c, idba1Mainsend.c idba1UtilMQ.c

The main program is idba1Mainsend.c.

Is it possible to use demo_proc.mk to produce an exe called idbicms
from all of the above programs? You will see that I have a mix of both
..c and .pc.
By the way, I have installed pro*c compiler in the server.

regards,
Daud

Maxim Demenko
05-30-2005, 02:01 PM
Daud schrieb: Hi Maxim, I changed to "-lclntsh" and got passed the error. But now another error. SHLIB_PATH is pointing to 32 bit libraries because we are using 32-bit mqseries client. Ok maybe i should try using the correct way. This is what I have: idba1ReadConfig.pc ,idba1ReadTransmit.pc ,idba1UpdateReceive.pc idba1AssembleMsg.c, idba1DecodeMsg.c, idba1EnableSignal.c, idba1LogError.c, idba1Mainsend.c idba1UtilMQ.c The main program is idba1Mainsend.c. Is it possible to use demo_proc.mk to produce an exe called idbicms from all of the above programs? You will see that I have a mix of both ..c and .pc. By the way, I have installed pro*c compiler in the server. regards, Daud

Yes , you can see how can it be done looking into makefile ( nearly line
100 are defined rules how .pc files should be processed ). In general,
you should build your targets in that order:
..pc -> .c -> .o(.so) -> exe

Best regards

Maxim


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service