プロが教えるわが家の防犯対策術!

Solaris10にpostgres9.0.5をインストールしようとしています。
Solarisには現時点での最新パッチが当たっている状態です(詳細はちょっと不明)

以下のオプションでconfigureを行うと、エラーになります。
./configure --prefix=/usr/local/postgres --without-readline --enable-thread-safety


以下エラー
---------------------------------------------------------------
checking thread safety of required library functions... no
configure: error: thread test program failed
This platform is not thread-safe. Check the file 'config.log' or compile
and run src/test/thread/thread_test for the exact reason.
Use --disable-thread-safety to disable thread safety.
---------------------------------------------------------------

config.logの中のエラーの内容
---------------------------------------------------------------
configure:28765: checking thread safety of required library functions
configure:28798: gcc -m64 -o conftest -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wend
if-labels -fno-strict-aliasing -fwrapv -pthreads -pthreads -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -D
IN_CONFIGURE conftest.c -lz -lnsl -lsocket -lm -lpthread -lpthread >&5
Undefined first referenced
symbol in file
sched_yield /var/tmp//ccVp73Io.o
collect2: ld returned 1 exit status
ld: fatal: symbol referencing errors. No output written to conftest
configure:28802: $? = 1
configure: program exited with status 1
---------------------------------------------------------------
thread-safetyを無効にすれば正常にインストールできます。
このエラーを回避するにはどうすればよいでしょうか?
あまり参考にはならない情報かもしれませんが、9.0.4/9.1.1でも同様のエラーが出ます。

A 回答 (1件)

> Undefined first referenced


> symbol in file
> sched_yield /var/tmp//ccVp73Io.o

sched_yieldが見つからないと言っています。
それは、Solarisではsched_yieldがlibc.soにもlibpthread.soにも含まれていないからです。
では、それがどこにあるのか? librt.soにあります。

なので、LIBSに-lrtを設定してconfigureしてみては如何でしょうか?

$ LIBS=-lrt ./configure --prefix=/usr/local/postgres --without-readline --enable-thread-safety

ところで、configureで失敗したテストプログラムは以下ですが、

$(srcdir)/src/test/thread/thread_test.c

222行目の問題箇所を見ると、/* if this is a portability problem, remove it */
と書いてあるので、以下の2行を消してconfigureしてもOKかもしれません。

while (thread1_done == 0 || thread2_done == 0)
sched_yield();

あと、余談ですが、psqlを使用することがあるなら、--without-readlineはあまりお勧めしません。
    • good
    • 0
この回答へのお礼

ご回答ありがとうございました。
LIBSに-lrtを設定したら、configureからコンパイル、インストールまでうまくいきました。
今のところ動作も問題なくいっている模様です。
助かりました。

お礼日時:2011/12/12 13:10

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!

関連するカテゴリからQ&Aを探す