0

尝试编译基于 Pro*C 的批处理文件时,进程“proc”卡在 1 个 CPU 内核的 100%,并且内存开始增长到系统需要 OOM 终止进程的程度(机器有 16GB 内存和进程增长到 9GB)。

有没有人见过这种行为?

作为附加信息:

- mk 是安装主包的那个
- .pc 文件是原始文件(我尝试编译了几个,例如 dtesys.pc)
- 库已正确编译
- 环境变量已正确设置

4

1 回答 1

1

是的,它是 limits.h,因为它在第 123 行递归地包含了自身:

 /* Get the compiler's limits.h, which defines almost all the ISO constants.
    We put this #include_next outside the double inclusion check because
    it should be possible to include this file more than once and still get
    the definitions from gcc's header.  */
#if defined __GNUC__ && !defined _GCC_LIMITS_H_
/*  `_GCC_LIMITS_H_' is what GCC's file defines.  */
# include_next <limits.h>
#endif

因此,解决方案是将 parse=none 选项传递给 Pro*C 预编译器:

proc parse=none iname=filename.pc oname=filename.c

或者,第二种选择:您可以先使用 c 预编译器预编译您的源代码以获取 pc 文件:

cpp -P -E yourfile.someextension -o yourfile.pc

然后你会得到limits.h 没有递归解析。

-P 选项是必需的,因为 Pro*C 是可能与线标记混淆的程序。

-E 选项是必需的,因为 Pro*C 是可能与非传统输出混淆的程序。

于 2019-06-06T19:42:49.443 回答