./configureを使用してプロジェクトの1つを設定しています。私はそれから次のエラーを取得します。Autoconf - POSIXスレッドはサポートされていません。サポートを確認するために間違ったコードを使用する可能性があります。それを修正するには?
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;
}
を私は別々にそれをコンパイルすると、それはコンパイルありません。しかし、pthread_createからの警告があります。
test_pthread.c:5:22: warning: null argument where non-null required (argument 1) [-Wnonnull]
pthread_attr_init(0); pthread_cleanup_push(0, 0);
^
test_pthread.c:6:22: warning: null argument where non-null required (argument 1) [-Wnonnull]
pthread_create(0,0,0,0); pthread_cleanup_pop(0);
^
test_pthread.c:6:22: warning: null argument where non-null required (argument 3) [-Wnonnull]
これは、configureが-pthreadをコンパイラでサポートするかどうかをチェックする方法のバグですか?これをどうすれば解決できますか?
./configureを実行する前にautoreconf -iを使用しています。この問題を解決するにはどうすればよいですか?
------------ EDIT:詳細を追加----------
私がチェックするために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ソースファイルの詳細を質問に含める必要があります。 – caf
@caf:configure.acファイルで使用するコード行を追加しています。 – theCuriousOne
この時点までにCFLAGSに '-Werror'を設定していませんか? – caf