因工作需要,我要在centos7 安装oracle11g,我在第一次用proc命令编译.pc文件出现情况如下:
[oracle@localhost programfile]$ proc first.pc
Pro*C/C++: Release 12.1.0.2.0 - Production on Tue Jul 2 17:37:15 2019
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
System default option values taken from: /data/oracle/product/11.2.0/db_1/precomp/admin/pcscfg.cfg
Error at line 33, column 11 in file /usr/include/stdio.h
# include
..........1
PCC-S-02015, unable to open include file
Error at line 15, column 10 in file /usr/include/_G_config.h
#include
.........1
PCC-S-02015, unable to open include file
Error at line 51, column 11 in file /usr/include/wchar.h
# include
..........1
PCC-S-02015, unable to open include file
Error at line 50, column 10 in file /usr/include/libio.h
#include
.........1
PCC-S-02015, unable to open include file
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,
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 "size_t" to continue.
Syntax error at line 339, column 62, file /usr/include/libio.h:
Error at line 339, column 62 in file /usr/include/libio.h
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
.............................................................1
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,
---------------------------------------------------------------------------------------------------------------------------
分割线:
起初我被上面的调试信息误导,以为是配置文件没包含"stddef.h"这个文件的路径,于是我用find / - name stddef.h把找到的内容:
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/stddef.h
/usr/include/linux/stddef.h
添加到proc的配置文件下 ,我的配置路径是:/data/oracle/product/11.2.0/db_1/precomp/admin/pcscfg.cfg
然而,我再去调用proc first.pc编译发现还是同样的错误,找了很久;最后发现是我的pcscfg.cfg文件内,第一行
sys_include=($ORACLE_HOME/precomp/public,/usr/include,/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include,/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include,/usr/lib/gcc/x86_64-redhat-linux/4.4.4/include,/usr/lib64/gcc/x86_64-suse-linux/4.1.2/include,/usr/lib64/gcc/x86_64-suse-linux/4.3/include)
这里的路径
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include,
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include,
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/include,
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/include,
是我系统没有的,然后我把他们删掉,再去找我系统中对应的版本内容,修改后整个pcscfg.cfg如下:
sys_include=($ORACLE_HOME/precomp/public,/usr/include,/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include,/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include)
ltype=short
define=__x86_64__
sys_include=$ORACLE_HOME/oracle
sys_include=/usr/include
sys_include=/$ORACLE_HOME/lib/
保存完成后,再用proc编译文件就成功了!!
最后总结:
用proc编译的时候,出错了,先看调试信息,看缺失的文件是否存在,如果存在的话,再看看配置文件中是否有非法的路径,删掉它们,然后替换自己系统目录下对应的版本路径即可(测试路径很简单,就用cd命令去访问,能访问成功的就是正确的,如果不能访问成功则网上一级访问,一直找到能访问的路径,找到后就查看当前路径底下的内容,然后复制你系统的路径下的版本内容即可)。