C compiler error: expected parameter declarator

C compiler error: expected parameter declarator

https://github.com/noyesno/awka

对于上面的 repo,当我尝试在 macOS 上编译它时出现以下错误(gcc 只是 clang)。我不知道如何根据错误消息解决问题。它在 Linux.

上编译得很好

我还尝试了 Homebrew 的真正 gcc 来编译包。它还显示相同的错误。我如何在 macOS 上解决这个问题?

$ ./configure
$ make
...
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o print.o print.c
print.c:52:11: error: expected parameter declarator
int PROTO(sprintf, (char *, const char *,...)) ;
          ^
print.c:52:11: error: expected ')'
print.c:52:11: note: to match this '('
print.c:52:11: error: conflicting types for '__builtin___sprintf_chk'
int PROTO(sprintf, (char *, const char *,...)) ;
          ^
print.c:52:11: note: '__builtin___sprintf_chk' is a builtin with type 'int (char *, int, unsigned long, const char *, ...)'
3 errors generated.
make[1]: *** [<builtin>: print.o] Error 1
make[1]: Leaving directory '/private/tmp/awka/awka'
make: *** [Makefile:48: awka_exe] Error 2

我不打算在这上面花很多时间,但看起来 configure 正在抓紧 stdio.h 寻找 sprintf。它无法在 header 中找到它,因此它添加了 #define:

NO_SPRINTF_IN_STDIO

它设置为 1,并用它来为 sprintf 添加自己的原型。不幸的是,在这种情况下,这似乎是一个宏,它将 sprintf 替换为“__builtin___sprintf_chk”(从外观上看,它具有额外的字符串长度检查)。

可能的解决方案:

  1. 注释掉 print.c 中的行,并确保 stdio.h 包含在某处。
  2. 在 运行 配置后,搜索定义 NO_SPRINTF_IN_STDIO 的位置并将该变量设置为 1?
  3. 修复配置以进行更严格的测试?