You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Red Hat 8编译Pro*C程序遇PCC-S-02014等错误求助

Red Hat 8下Pro*C编译预处理器错误解决

环境信息

  • Red Hat 8
  • GCC 8.5.0
  • Oracle Client 19.0

编译错误信息

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

Syntax error at line 166, column 45, file /usr/include/sys/cdefs.h:
Error at line 166, column 45 in file /usr/include/sys/cdefs.h
#define __glibc_fortify(f, __l, __s, __osz, ...) \
............................................1
PCC-S-02014, Encountered the symbol "..." when expecting one of the following:

   an identifier, define, elif, else, endif, error, if, ifdef,
   ifndef, include, include_next, line, pragma, undef, exec,
   sql, begin, end, var, type, oracle,
   an immediate preprocessor command, a C token, create,
   function, package, procedure, trigger, or, replace,

Syntax error at line 168, column 9, file /usr/include/sys/cdefs.h:
Error at line 168, column 9 in file /usr/include/sys/cdefs.h
   ? __ ## f ## _alias (__VA_ARGS__)                                          \
........1

PCC-S-02201, Encountered the symbol "__uint8_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 "__uint8_t" to continue.

Syntax error at line 53, column 9, file /usr/include/bits/types.h:
Error at line 53, column 9 in file /usr/include/bits/types.h
typedef __int16_t __int_least16_t;
........1

   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 0, column 0 in file /home/Functions.pc
PCC-F-02102, Fatal error while doing C preprocessing
There are compilation errors step1!!

问题原因

这些错误源于Pro*C预处理器对GNU C扩展语法(比如可变参数宏__VA_ARGS__、glibc的__glibc_fortify宏)以及系统自定义类型(__uint8_t、__int16_t)的兼容性支持不足,无法正确解析Red Hat 8自带的glibc头文件。

解决步骤

1. 调整编译命令,添加兼容选项

在编译时直接指定Pro*C兼容ANSI C,并手动映射不被识别的类型、屏蔽冲突宏:

proc in=Functions.pc out=Functions.c code=ansi_c parse=none \
define=__uint8_t=unsigned char \
define=__int16_t=short \
define=__int_least16_t=short \
undef=__glibc_fortify
  • code=ansi_c:强制生成符合ANSI C标准的代码
  • parse=none:跳过Pro*C对C代码的语法解析,交给系统GCC处理
  • define:手动映射Pro*C不识别的系统类型
  • undef:屏蔽导致语法错误的__glibc_fortify宏

2. 在.pc文件头部添加预编译屏蔽指令

在Functions.pc最开头加入以下内容,提前规避冲突:

#undef __glibc_fortify
#define __uint8_t unsigned char
#define __int16_t short
#define __int_least16_t short

3. 修改Pro*C全局配置文件(可选)

编辑Oracle Client的全局配置文件/u01/app/oracle/product/19.0.0/client_1/precomp/admin/pcscfg.cfg,添加全局生效的兼容选项:

code=ansi_c
parse=none
sys_include=($ORACLE_HOME/precomp/public,/usr/include)
define=__uint8_t=unsigned char
define=__int16_t=short

4. 先通过GCC预处理再交给Pro*C

如果上述方法无效,先让GCC完成预处理,再将结果交给Pro*C:

gcc -E Functions.pc > Functions_preprocessed.pc
proc in=Functions_preprocessed.pc out=Functions.c

内容的提问来源于stack exchange,提问作者Ashok Kumar Chelladurai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 03:53:19