构建场中没有 C++ pthread 支持?

构建场中没有 C++ pthread 支持?

我正在尝试在构建农场中编译一些代码。当我在开发机器上构建它时,一切顺利:

checking if C compiler and POSIX threads work as is... no
checking if C++ compiler and POSIX threads work as is... no
checking if C compiler and POSIX threads work with -Kthread... no
checking if C compiler and POSIX threads work with -kthread... no
checking if C compiler and POSIX threads work with -pthread... yes
checking if C++ compiler and POSIX threads work with -Kthread... no
checking if C++ compiler and POSIX threads work with -kthread... no
checking if C++ compiler and POSIX threads work with -pthread... yes
checking for pthread_mutexattr_setpshared... yes
checking for pthread_condattr_setpshared... yes
checking for PTHREAD_MUTEX_ERRORCHECK_NP... yes
checking for PTHREAD_MUTEX_ERRORCHECK... yes
checking for working POSIX threads package... yes

但是当我将它交给构建场时,它无法找到有效的编译器选项来启用 pthread 支持:

[   87s] checking if C compiler and POSIX threads work as is... no
[   87s] checking if C++ compiler and POSIX threads work as is... no
[   87s] checking if C compiler and POSIX threads work with -Kthread... no
[   87s] checking if C compiler and POSIX threads work with -kthread... no
[   87s] checking if C compiler and POSIX threads work with -pthread... yes
[   87s] checking if C++ compiler and POSIX threads work with -Kthread... no
[   87s] checking if C++ compiler and POSIX threads work with -kthread... no
[   87s] checking if C++ compiler and POSIX threads work with -pthread... no
[   87s] checking if C++ compiler and POSIX threads work with -pthreads... no
[   87s] checking if C++ compiler and POSIX threads work with -mt... no
[   87s] checking if C++ compiler and POSIX threads work with -mthreads... no
[   87s] checking if C++ compiler and POSIX threads work with -lpthreads... no
[   87s] checking if C++ compiler and POSIX threads work with -llthread... no
[   87s] checking if C++ compiler and POSIX threads work with -lpthread... no
[   87s] checking for pthread_mutexattr_setpshared... yes
[   87s] checking for pthread_condattr_setpshared... yes
[   87s] checking for PTHREAD_MUTEX_ERRORCHECK_NP... yes
[   87s] checking for PTHREAD_MUTEX_ERRORCHECK... yes
[   87s] checking for working POSIX threads package... no
[   87s] configure: WARNING: "*** POSIX threads are not"
[   87s] configure: WARNING: "*** available on your system "
[   87s] configure: error: "*** Can not continue"

开发箱和构建农场使用相同的基础操作系统 - 唯一的区别是构建农场上的环境非常小,只在一小组基础操作系统包上安装 spec 文件所需的包。

我想不出任何“缺少的包”会导致这种行为。两者都安装了 glibc-*。

答案1

实际信用/来源:https://forums.opensuse.org/showthread.php/509781-No-C-Pthread-support-inside-OBS来自 wolfi323

我在尝试使用以下命令配置[Open MPI 3]时遇到了类似的问题:

./configure CC=gcc CXX=gcc FC=gfortran

wolfi323 在 forums.opensuse 上的回答暗示c++ 编译器没有充分指定。我将 c/c++ 编译器选项留空:

./configure FC=gfortran

配置报告:

checking if C++ compiler and POSIX threads work with -Kthread... no
checking if C++ compiler and POSIX threads work with -kthread... no
checking if C++ compiler and POSIX threads work with -pthread... yes

并完成。

额外的

环境

CC=gcc CXX=g++

产生与让 ./configure 找到默认编译器相同/相似的结果。

相关内容