Linux Autoconf-不支持POSIX线程。配置可能使用错误的代码来验证支持。如何修复它?
我正在使用./configure配置其中一个项目。我从中得到以下错误Linux Autoconf-不支持POSIX线程。配置可能使用错误的代码来验证支持。如何修复它?,linux,pthreads,configure,autoconf,Linux,Pthreads,Configure,Autoconf,我正在使用./configure配置其中一个项目。我从中得到以下错误 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 -kthread... no checkin
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 -kthread... no
checking for the pthreads library -llthread... 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
当我检查configure文件时,我看到它正在使用以下代码检查pthread支持:
#include <pthread.h>
int main ()
{
pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0);
;
return 0;
}
这是configure检查编译器对-pthread支持的方式中的一个错误吗?我怎样才能解决这个问题
在运行之前,我正在使用autoeconf-I。/configure。解决此问题的干净方法是什么
------------编辑:添加更多信息----------
我使用configure.ac文件中的以下行检查pthread。我刚从一个在线配置中得到
# Check for POSIX thread support
ACX_PTHREAD([
LIBS="$LIBS $PTHREAD_LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS -g -Wall"
CC="$PTHREAD_CC"
AC_SUBST([LIBS])
AC_SUBST([CFLAGS])
AC_SUBST([CC])
],
[AC_MSG_ERROR([POSIX threads support is required])])
从注释中可以明显看出,您已经在autoconf脚本的早期
CFLAGS
中设置了-Werror
不要那样做。如果需要
-Werror
,请在所有调用编译器的测试运行完毕后,将其添加到脚本末尾的CFLAGS
。大多数autoconf测试都不是为使用-Werror
而编写的,警告不应阻止测试成功。您需要在问题中包含更多实现这些测试的autoconf源文件。@caf:添加我在configure.ac文件中使用的代码行。在此之前,您没有在CFLAGS中设置-Werror
,是吗?是的,我有。是否可以仅忽略-pthread库的警告。可以添加到configure.ac文件中的内容?
# Check for POSIX thread support
ACX_PTHREAD([
LIBS="$LIBS $PTHREAD_LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS -g -Wall"
CC="$PTHREAD_CC"
AC_SUBST([LIBS])
AC_SUBST([CFLAGS])
AC_SUBST([CC])
],
[AC_MSG_ERROR([POSIX threads support is required])])