clang-analyzer:scan-build ./configure 寻找 pthread 支持失败:“必须定义 _REENTRANT”

clang-analyzer: scan-build ./configure fails looking for pthread support: "_REENTRANT must be defined"

我正在使用 pthreads,但我的扫描构建操作失败了:

https://github.com/SentryPeer/SentryPeer/runs/5034401493?check_suite_focus=true

我看到了这个:

cat clang_output_*
conftest.c:59:26: error: "_REENTRANT must be defined"
#                        error "_REENTRANT must be defined"
                         ^

checking whether /usr/bin/../libexec/ccc-analyzer is Clang... rm: cannot remove 'conftest.plist': Is a directory
no
checking whether pthreads work with "-pthread" and "-lpthread"... no
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... no
checking whether pthreads work with -mthreads... no
checking for the pthreads library -lpthread... no
checking whether pthreads work with --thread-safe... no
checking whether pthreads work with -mt... no
checking for pthread-config... no
configure: error: POSIX threads support is required
scan-build: Analysis run complete.
scan-build: Removing directory '/tmp/scan-build-2022-02-02-202911-1481984-1' because it contains no reports.
scan-build: No bugs found.

版本: clang-analyzer-13.0.0-3.fc35.noarch

我的 autotools 在同一 Ubuntu 版本上无需扫描构建即可正常构建,根据:

https://github.com/SentryPeer/SentryPeer/actions/runs/1783127976

这里有什么提示吗?不确定这是否是一个错误,也不知道去哪里问。我也在这里提出过 - https://github.com/llvm/llvm-project/issues/53552

感谢阅读, 加文.

_REENTRANT 是一个过时的 feature-test macro ,曾被 Glibc 和其他一些 C 实现识别。此宏的支持用例是 用户 在其源代码或编译器命令行上定义它以请求可能无法提供的功能或行为。

您正在使用的 configure 脚本似乎试图通过检查是否已定义 _REENTRANT 来确定 pthreads 支持是否已成功启用。然而,这一直是有问题的,因为它依赖于 C 库和编译器的未记录的实现细节。对于某些 C 实现,它曾一度有效,但不适用于您现在使用的 C 实现。我认为 clang-static-analyzer.

中存在缺陷