ORACLE 10.2 Pro*C 预编译器不读取头文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/325826/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 01:39:56  来源:igfitidea点击:

ORACLE 10.2 Pro*C precompiler not reading header file

oracleoracle-pro-c

提问by David

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

我正在使用 Oracle 10.2 和 AIX 5.2 预编译包含 Pro*C 代码的 C 程序

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

Oracle 预编译器读取$ORACLE_HOME/precomp/admin/pcscfg.cfg file包含 sys_include 变量(设置为/usr/include)定义的。

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

Pro*C 编译器抱怨它不知道size_t类型是什么,并且使用该size_t类型的 Oracle 头文件报告错误。

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

这是sqlcpr.h文件中报告的示例错误:

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

size_tis defined in the stdio.hheader file in the /usr/includedirectory. I'm including the stdio.hheader in my example.pcfile before I include the sqlcpr.hheader.

size_tstdio.h/usr/include目录的头文件中定义。在包含stdio.h标题example.pc之前,我将sqlcpr.h标题包含在我的文件中。

I'm issuing the proc command as follows:

我发出 proc 命令如下:

proc iname=example parse=full

Any ideas what I'm doing wrong?

任何想法我做错了什么?

采纳答案by EvilTeach

From Metalink

来自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' 和 'include' 预编译器选项设置不正确。在位于 $ORACLE_HOME/precomp/admin 的 pcscfg.cfg 文件中设置“sys_include”和“include”预编译器选项,或在调用“proc”时在命令行中包含。

例如,这是正确设置变量的推荐方法:

运行以下命令以获取编译器位置:

gcc -v

从 /usr/lib/gcc-lib/i386-redhat-linux7/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-128) 读取规范

使用上面返回的路径(删除规范并替换为包含)

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.

我猜测同时具有 sysinclude 和 include 的部分是您的问题。

回答by maxschlepzig

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.

您必须确保设置了包含搜索路径,以便 Pro*C 以正确的顺序包含所有需要的目录。

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

例如在 CentOS 6.5 上,我指定以下顺序(在 中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 procfrom $ORACLE_HOME/precomp/admin/pcscfg.cfg.

此配置文件由procfrom读取$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.

显然,Oracle 安装程序编写的默认文件通常不是最理想的,因为它例如列出了不存在的 GCC 路径和/或使用了有问题的包含路径顺序。

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

使用不同的顺序,我得到相同的size_t相关错误消息(将前 4 行排列为 (1,2,4,3) 时)。

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

当将前 4 行排列为 (1,3,2,4) 并包含 时<limits.h>proc甚至会进入内存分配无限循环,直到它被 OOM 杀手杀死。

As a workaround you can also specify the sys_includeoption on the proccommand line, e.g:

作为一种解决方法,您还sys_include可以在proc命令行上指定该选项,例如:

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

回答by yogmk

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

我有类似的问题(“PCC-S-02201,遇到符号......”)。我听取了上面的两条建议。

  • Check the sys_includeand 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_includeup in the order (not really sure if should matter, but still.)
  • 检查sys_include并确保目录路径是编译器实际设置使用的路径。Pro*C 使用的默认值通常不存在。编译“Hello World”程序gcc -v -c <prog.c>并检查COMPILER_PATH
  • 我调整了选项sys_include的顺序并按顺序提出(不确定是否应该重要,但仍然如此。)

so the PCC-S-02201 went away.

所以 PCC-S-02201 消失了。

回答by AERYEN

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

当我玩我的 pcscfg.cfg 文件时,有两件事值得注意。

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\includeYou can use dir /x in windows to get the short version of the names

1 请记住,它不支持“空格”,因此任何包含空格的路径都应以“短”样式编写。例如:SYS_INCLUDE=D:\Progra~1\Micros~1.0\VC\include您可以在 Windows 中使用 dir /x 来获取名称的简短版本

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

2 看来,至少在我的情况下, INCLUDE 应该写在所有这些选项之前。如果

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.

反而。

回答by ohlemacher

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.

我修改了将 /usr/include/linux 放在其他所有内容之前的位置。这消除了无法找到 stddef.h 和不知道 size_t 是什么。将它放在 /usr/include 旁边只会修复前者。

Modified pcscfg.cfg:

修改后的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

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)

(CentOS 6.3, oracle 11g)

回答by MagicWorld

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"

将 sys_include 用于包含环境变量或 Visual Studio 变量的路径。如果路径是简单路径,则使用“include”,否则使用“sys_include”

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

我在 Visual Studio 2013 上遇到了这个问题,用于编译 .pc 文件,通过上述更改,一切正常。

回答by Ben Abarbanel

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

添加一个编译标志pcscfg.cfg行使 Oracle 的预编译器在编译时不会出现系统头文件语法错误:

define=_POSIX_C_SOURCE

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

就是这样。它现在应该没有错误地预编译。

回答by user11611523

I had the same issue:

我遇到过同样的问题:

[me@somesys:~/proC]$ proc sys_include='(/usr/include,/usr/include/linux,/usr/include/c++/4.8.2/x86_64-redhat-linux,/usr/include/c++/4.8.2/tr1,/usr/include/c++/4.8.2)' copy.pc

Pro*C/C++: Release 12.1.0.2.0 - Production on Thu Jun 6 17:47:11 2019

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

System default option values taken from: /oracle/app/oracle/product/12.1.0.2/precomp/admin/pcscfg.cfg

Syntax error at line 307, column 3, file /usr/include/libio.h:
Error at line 307, column 3 in file /usr/include/libio.h
  size_t __pad5;
..1
PCC-S-02201, Encountered the symbol "size_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,
...

And I did as yogmk suggested:

我按照 yogmk 的建议做了:

[me@somesys:~/proC]$ gcc -v -c borrame.c
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
COLLECT_GCC_OPTIONS='-v' '-c' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1 -quiet -v borrame.c -quiet -dumpbase borrame.c -mtune=generic -march=x86-64 -auxbase borrame -version -o /tmp/cc2WTuu6.s
GNU C (GCC) version 4.8.5 20150623 (Red Hat 4.8.5-36) (x86_64-redhat-linux)
        compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-36), GMP version 6.0.0, MPFR version 3.1.1, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include
 /usr/local/include
 /usr/include
End of search list.
GNU C (GCC) version 4.8.5 20150623 (Red Hat 4.8.5-36) (x86_64-redhat-linux)
...

But instead of COMPILER_PATH, I copied, in order, the non-empty directories after #include <...> search starts here:, and it worked!

但是COMPILER_PATH,我不是按顺序复制了 之后的非空目录#include <...> search starts here:,它起作用了!

[me@somesys:~/proC]$ proc sys_include='(/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include,/usr/include)' copy.pc

Pro*C/C++: Release 12.1.0.2.0 - Production on Thu Jun 6 17:54:50 2019

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

System default option values taken from: /oracle/app/oracle/product/12.1.0.2/precomp/admin/pcscfg.cfg

[me@somesys:~/proC]$

Hope it helps anyone.

希望它可以帮助任何人。