ORACLE 10.2 Pro*C precompiler not reading header file

I'm pre-compiling a C program containing Pro*C code with Oracle 10.2 and AIX 5.2

The Oracle precompiler reads the $ORACLE_HOME/precomp/admin/pcscfg.cfg file which contains the definition of the sys_include variable (set to /usr/include).

The Pro*C compiler complains that it doesn't know what the size_t type is and the Oracle header files that use the size_t type are reporting errors.

Here's an example error being reported on the sqlcpr.h file:

extern void sqlglm( char*, size_t*, size_t* );
...........................1
PCC-S-02201, Encountered the symbol "size_t" when expecting one of the following

size_t is defined in the stdio.h header file in the /usr/include directory. I'm including the stdio.h header in my example.pc file before I include the sqlcpr.h header.

I'm issuing the proc command as follows:

proc iname=example parse=full

Any ideas what I'm doing wrong?

Answers


From Metalink

PCC-S-02201, Encountered the symbol "size_t" when expecting one of the 
following
:
   ... auto, char, const, double, enum,  float, int, long,
   ulong_varchar, OCIBFileLocator OCIBlobLocator,
   OCIClobLocator, OCIDateTime, OCIExtProcContext, OCIInterval,
   OCIRowid, OCIDate, OCINumber, OCIRaw, OCIString, register,
   short, signed, sql_context, sql_cursor, static, struct,
   union, unsigned, utext, uvarchar, varchar, void, volatile,
   a typedef name, exec oracle, exec oracle begin, exec,
   exec sql, exec sql begin, exec sql type, exec sql var,
The symbol "enum," was substituted for "size_t" to continue.
Syntax error at line 88, column 7, file /usr/include/gconv.h:
Error at line 88, column 7 in file /usr/include/gconv.h
                                  size_t *);
Solution Description

The 'sys_include' and 'include' precompiler options are not set correctly. Set 'sys_include' and 'include' precompiler options in the pcscfg.cfg file located at $ORACLE_HOME/precomp/admin or include on the command line when invoking 'proc'.

For example, here is a recommended way to set the variable properly:

Run the following command to obtain the compiler location:

gcc -v

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux7/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-128)

Use the path returned above (remove specs and replace with include)

sys_include=($ORACLE_HOME/precomp/public,
             /usr/lib/gcc-lib/i386-redhat-linux7/2.96/include, 
             /usr/include)

include=(/u02/app/oracle/product/8.1.5/precomp/public)
include=(/u02/app/oracle/product/8.1.5/rdbms/demo)
include=(/u02/app/oracle/product/8.1.5/network/public)
include=(/u02/app/oracle/product/8.1.5/plsql/public)

I am guessing that the part of having both sysinclude and include is your issue.


You have to make sure that the include search path is setup such that all needed directories are included in the right order by Pro*C.

For example on CentOS 6.5 I specify following order (in the pcscfg.cf):

sys_include=$ORACLE_HOME/sdk/include
sys_include=/usr/include
sys_include=/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include
sys_include=/usr/include/linux
ltype=short
define=__x86_64__

This configuration file is read by proc from $ORACLE_HOME/precomp/admin/pcscfg.cfg.

Apparently, the default file written by the Oracle installer is often suboptimal, because it e.g. lists a non-existing GCC path and/or uses a problematic include path order.

With a different order I get the same size_t related error messages (when permuting the first 4 lines to (1,2,4,3) ).

When permuting the first 4 lines to (1,3,2,4) and including <limits.h>, proc even goes into an memory allocating infinite loop until it is killed by the OOM killer.

As a workaround you can also specify the sys_include option on the proc command line, e.g:

lines=yes \
code=ANSI_C \
sqlcheck=full \
parse=full \
sys_include=$(ORACLE_HOME)/precomp/public \
sys_include=/usr/include \
sys_include=/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include \
sys_include=/usr/include/linux

Two thing worth noting when I playing with my pcscfg.cfg file.

1 Remember it doesn't support "space", so any path including space should be written in "short" style. e.g.: SYS_INCLUDE=D:\Progra~1\Micros~1.0\VC\include You can use dir /x in windows to get the short version of the names

2 It appears, in my case at least, INCLUDE should be written before all those options stuff. I.E. If

define=(WIN32_LEAN_AND_MEAN)
parse=full
SYS_INCLUDE=D:\Progra~1\Micros~1.0\VC\include

doesn't work, try

define=(WIN32_LEAN_AND_MEAN)
SYS_INCLUDE=D:\Progra~1\Micros~1.0\VC\include
parse=full

Instead.


I modified placing /usr/include/linux before everything else. This cleared both the failure to find stddef.h and not knowing what size_t was. Placing it next to /usr/include only fixed the former.

Modified pcscfg.cfg:

sys_include=(/usr/include/linux,$ORACLE_HOME/precomp/public,/usr/include,/usr/lib/gcc/i386-redhat-linux/4.1.1/include,/usr/lib/gcc/i386-redhat-linux/3.4.5/include,/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include,/usr/lib/gcc/i586-suse-linux/4.1.2/include,/usr/lib/gcc/i586-suse-linux/4.3/include) ltype=short

(CentOS 6.3, oracle 11g)


Use sys_include for the path containing environment variables or Visual Studio variables. If the path is simple path, use "include", else use "sys_include"

I have this issue on Visual Studio 2013, for compiling .pc files, with the above change, all got worked.


Add one compile flag line to pcscfg.cfg to make Oracle's precompiler compile with no system header file syntax errors:

define=_POSIX_C_SOURCE

That's it. It should now precompile without error.


I had the similar issue ("PCC-S-02201, Encountered the symbol ..."). I listened to both pieces of advice above.

  • Check the sys_include and make sure the directory path is the one that compiler is actually is set to use. Defaults used by Pro*C generally do not exist. Compile a 'Hello World' program with gcc -v -c <prog.c> and check COMPILER_PATH
  • I adjusted the order of options and brought sys_include up in the order (not really sure if should matter, but still.)

so the PCC-S-02201 went away.


Need Your Help

How to adding middleware to Appengine's webapp framework?

python django google-app-engine middleware django-middleware

I'm using the appengine webapp framework (link). Is it possible to add Django middleware? I can't find any examples. I'm currently trying to get the FirePython middleware to work (link).

Developing a sticker app for iPhone where do i store the images

ios iphone

I was hoping someone could help me understand this. I'm having an iPhone app sticker developed at the moment. This app is going to have different categories (angry, happy etc. There will be some...