在 CentOS 5.5 上安装 Oracle 10g R2 ,进行 PRO*C 开发,编译总是报错
[handsome@rzgh src]$ make -f s_secubusiflow.gcc
g++ -c -fPIC -D OS_UNIX s_secubusiflow.cpp -I..
/u01/app/oracle/product/10.2.0/db_1/bin/proc ireclen=132 oreclen=132 select_error=yes mode=ansi userid=hs_his/handsome@gfdb SQLCHECK=SYNTAX def_sqlcode=YES THREADS=YES CODE=CPP Char_map=STRING CPP_SUFFIX=cpp PARSE=PARTIAL CLOSE_ON_COMMIT=YES MAXOPENCURSORS=60 DEFINE=USE_PRO_C HOLD_CURSOR=YES PREFETCH=200 include=/u01/app/oracle/product/10.2.0/db_1/precomp/public include=/u01/app/oracle/product/10.2.0/db_1/oci/include include=.. include=/usr/lib/gcc-lib/i386-redhat-linux/4.1.1/include iname=s_secubusifunc.pc oname=s_secubusifunc.cpp
Pro*C/C++: Release 10.2.0.1.0 - Production on Wed Aug 17 12:55:33 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /u01/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg
PCC-I-02106, Userid only used when SQLCHECK = FULL, userid ignored.
Error at line 33, column 10 in file /usr/include/string.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 34, column 11 in file /usr/include/stdio.h
# include <stddef.h>
..........1
PCC-S-02015, unable to open include file
但是在 RHEL4上都是好的,检查后发现 /u01/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg 文件中指定的搜索路径有问题,
[oracle@rzgh ~]$ less /u01/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg
sys_include=(/ade/aime_rdbms_9819/oracle/precomp/public,/usr/include,/usr/lib/gcc-lib/i486-suse-linux/2.95.3/include,/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include,/usr/lib/gcc-lib/i386-redhat-linux7/2.96/include)
ltype=short
/u01/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg (END)
由于CentOS 5.5 升级后,gcc的版本已经到了 4.1.2,相关的头文件路径也发生了变化,所以这里配置的头文件是找不到的。。。
按照上面的报错,逐个解决,添加头文件:
[handsome@rzgh ~]$ find /usr -name stddef.h -print
/usr/src/kernels/2.6.18-238.19.1.el5-i686/include/linux/stddef.h
/usr/src/kernels/2.6.18-194.el5-i686/include/linux/stddef.h
/usr/include/linux/stddef.h
/usr/lib/syslinux/com32/include/stddef.h
/usr/lib/syslinux/com32/include/bitsize/stddef.h
find: /usr/lib/audit: Permission denied
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stddef.h
/usr/lib/gcc/i386-redhat-linux/3.4.6/include/stddef.h
/usr/lib/bcc/include/stddef.h
选择使用 4.1.1的头文件目录,添加到 /u01/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg 中,重新进行编译,不再报错了。