Re: problem compiling c (pro*c) program - problem with oracle shared library

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Sun, 29 May 2005 18:36:35 +0200
Message-ID: <d7cr2c$qjd$00$1_at_news.t-online.com>


Daud schrieb:
>
> 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_at_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 Received on Sun May 29 2005 - 18:36:35 CEST

Original text of this message