pro*c编译问题

在redhat linux5 + oracle10g的搭配上,proc 参数是LINE=YES MODE=ORACLE DBMS=V8 UNSAFE_NULL=YES,但是在编译时,我们遇到以下的一堆问题:

Syntax error at line 177, column 12, file /usr/include/bits/types.h:
Error at line 177, column 12 in file /usr/include/bits/types.h
__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t;
...........1
PCC-S-02201, Encountered the symbol "__u_quad_t" when expecting one of the follo
wing:

   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,
The symbol "enum," was substituted for "__u_quad_t" to continue.

Syntax error at line 181, column 12, file /usr/include/bits/types.h:
Error at line 181, column 12 in file /usr/include/bits/types.h
__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t;
...........1
PCC-S-02201, Encountered the symbol "__u_quad_t" when expecting one of the follo
wing:

   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,
The symbol "enum," was substituted for "__u_quad_t" to continue.

Syntax error at line 187, column 9, file /usr/include/bits/types.h:
Error at line 187, column 9 in file /usr/include/bits/types.h
typedef __off64_t __loff_t;     /* Type of file sizes and offsets (LFS).  */
........1
PCC-S-02201, Encountered the symbol "__off64_t" when expecting one of the follow
ing:

   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,
The symbol "enum," was substituted for "__off64_t" to continue.

Syntax error at line 188, column 9, file /usr/include/bits/types.h:
Error at line 188, column 9 in file /usr/include/bits/types.h
typedef __quad_t *__qaddr_t;
........1
PCC-S-02201, Encountered the symbol "__quad_t" when expecting one of the followi
ng:

   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,
The symbol "enum," was substituted for "__quad_t" to continue.

Error at line 14, column 10 in file /usr/include/_G_config.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 48, column 10 in file /usr/include/wchar.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Syntax error at line 81, column 5, file /usr/include/wchar.h:
Error at line 81, column 5 in file /usr/include/wchar.h
    wint_t __wch;
....1
PCC-S-02201, Encountered the symbol "wint_t" when expecting one of the following
:

   char, const, double, enum, float, int, long, ulong_varchar,
   OCIBFileLocator OCIBlobLocator, OCIClobLocator, OCIDateTime,
   OCIExtProcContext, OCIInterval, OCIRowid, OCIDate, OCINumber,
   OCIRaw, OCIString, short, signed, sql_context, sql_cursor,
   struct, union, unsigned, utext, uvarchar, varchar, void,
   volatile, a typedef name,
The symbol "enum," was substituted for "wint_t" to continue.

Syntax error at line 28, column 3, file /usr/include/_G_config.h:
Error at line 28, column 3 in file /usr/include/_G_config.h
  __off_t __pos;
..1
PCC-S-02201, Encountered the symbol "__off_t" when expecting one of the followin
g:

   char, const, double, enum, float, int, long, ulong_varchar,
   OCIBFileLocator OCIBlobLocator, OCIClobLocator, OCIDateTime,
   OCIExtProcContext, OCIInterval, OCIRowid, OCIDate, OCINumber,
   OCIRaw, OCIString, short, signed, sql_context, sql_cursor,
   struct, union, unsigned, utext, uvarchar, varchar, void,
   volatile, a typedef name,

Error at line 48, column 10 in file /usr/include/wchar.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 31, column 10 in file /usr/include/gconv.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 53, column 11 in file /usr/include/libio.h
# include <stdarg.h>
..........1
PCC-S-02015, unable to open include file
Error at line 147, column 10 in file /usr/include/sys/types.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 25, column 10 in file /usr/include/sys/shm.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Syntax error at line 0, column 0, file paradba.pc:
Error at line 0, column 0 in file paradba.pc
PCC-S-02201, Encountered the symbol "<eof>" when expecting one of the following:

   ; : an identifier, end-exec, random_terminal

Error at line 0, column 0 in file paradba.pc
PCC-F-02102, Fatal error while doing C preprocessing
make[1]: *** [precomplie] 错误 1

修改编译参数,LINE=YES MODE=ORACLE DBMS=V8 UNSAFE_NULL=YES  SQLCHECK=SEMANTICS PARSE=NONE,我们遇到的错误终于减少了,但是任然是报错


/home/oracle/product/10.2.0/db_1/bin/proc LINE=YES MODE=ORACLE DBMS=V8 UNSAFE_NULL=YES SQLCHECK=SEMANTICS PARSE=NONE paradba.pc paradba.c

Pro*C/C++: Release 10.1.0.3.0 - Production on Fri Sep 21 19:17:19 2012

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

System default option values taken from: /home/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg

make[1]: Leaving directory `/mnt/hgfs/vmshare/param/src/paradba'
gcc -g -c -o paradba.o paradba.c
make[1]: Entering directory `/mnt/hgfs/vmshare/param/src/paradba'
/home/oracle/product/10.2.0/db_1/bin/proc LINE=YES MODE=ORACLE DBMS=V8 UNSAFE_NULL=YES SQLCHECK=SEMANTICS PARSE=NONE dbtest.pc 

Pro*C/C++: Release 10.1.0.3.0 - Production on Fri Sep 21 19:17:19 2012

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

System default option values taken from: /home/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg

Error at line 24, column 5 in file dbtest.pc
    EXEC SQL SELECT count(*) INTO :date FROM trans;
....1
PLS-S-00201, identifier 'TRANS' must be declared
Error at line 24, column 5 in file dbtest.pc
    EXEC SQL SELECT count(*) INTO :date FROM trans;
....1
PLS-S-00000, SQL Statement ignored
Semantic error at line 24, column 5, file dbtest.pc:
    EXEC SQL SELECT count(*) INTO :date FROM trans;
....1
PCC-S-02346, PL/SQL found semantic errors
make[1]: *** [precomplie] 错误 1
make[1]: Leaving directory `/mnt/hgfs/vmshare/param/src/paradba'
make: *** [dbtest.c] 错误 2
[sf]/mnt/hgfs/vmshare/param/src/paradba>make 
make[1]: Entering directory `/mnt/hgfs/vmshare/param/src/paradba'
/home/oracle/product/10.2.0/db_1/bin/proc LINE=YES MODE=ORACLE DBMS=V8 UNSAFE_NULL=YES SQLCHECK=SEMANTICS PARSE=NONE dbtest.pc 

Pro*C/C++: Release 10.1.0.3.0 - Production on Fri Sep 21 19:17:41 2012

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

System default option values taken from: /home/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg

Error at line 23, column 5 in file dbtest.pc
    EXEC SQL SELECT to_char(sysdate,'YYYYmmdd') INTO :date FROM dual;
....1
PLS-S-00201, identifier 'DUAL' must be declared
Error at line 23, column 5 in file dbtest.pc
    EXEC SQL SELECT to_char(sysdate,'YYYYmmdd') INTO :date FROM dual;
....1
PLS-S-00000, SQL Statement ignored
Semantic error at line 23, column 5, file dbtest.pc:
    EXEC SQL SELECT to_char(sysdate,'YYYYmmdd') INTO :date FROM dual;
....1
PCC-S-02346, PL/SQL found semantic errors
make[1]: *** [precomplie] 错误 1

这个错误报的很奇怪,我收集的网上答案,有以下两种:

         1、修改precomp/admin/pcscfg.cfg配置,在其中添加一些参数,但是经过验证,至少在我这个环境下是不成功的;

         2、编译的时候添加上USERID=用户名/密码 这个选项,试验证明,在我的环境中这个方法是行的通的,编译通过,但是每次编译都要附加上数据库用户名、密码,这个就不是好了。


下面我揭晓最终的答案:去掉SQLCHECK这个选项,编译就通过了。


你可能感兴趣的:(sql,c,struct,File,include,Semantic)