PostgreSQLインストールエラー could not determine argument types
ポスグレ?んなもん片手で入れてやんよ!と意気込んでみたものの、
configure時にエラーでまくり、且つぐぐっても情報が少なかったのでそのときの作業メモ。
configureをしてみる。
srcファイルを展開後、configureを行うとエラーがでます。
$ tar zxf postgresql-7.1.3.tar.gz $ cd postgresql-7.1.3 $ ./configure --enable-multibyte=EUC_JP <省略> checking types of arguments for accept()... configure: error: could not determine argument types
/\___/ヽ ヽ / ::::::::::::::::\ つ . | ,,-‐‐ ‐‐-、 .:::| わ | 、_(o)_,: _(o)_, :::|ぁぁ . | ::< .::|あぁ \ /( [三] )ヽ ::/ああ /`ー‐--‐‐―´\ぁあ
よくでる依存関係のエラーではなく、直訳するとなんか引数がおかしいとのこと。
正直よくわからん。
でconfigure実行時に出力される「config.log」をみてみると山のようにerrorがはかられてるわけなんだが、
一番はじめにerrorがはかれるとこはここ。
$ cat config.log <略> configure:1396: checking for Cygwin environment configure:1412: gcc -c -O2 conftest.c 1>&5 configure: In function 'main': configure:1408: error: '__CYGWIN32__' undeclared (first use in this function) configure:1408: error: (Each undeclared identifier is reported only once configure:1408: error: for each function it appears in.)
はいはい、configureの1408行目あたりでなんかおかしくなってると。
で、configureの1408行目はこんな感じ。
if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF #line 1401 "configure" #include "confdefs.h" int main() { #ifndef __CYGWIN__ #define __CYGWIN__ __CYGWIN32__ #endif return __CYGWIN__; ; return 0; } EOF
なんかヘッダーファイル(confdefs.h)をincludeしてますね。
confdes.hを見てみる。
$ cat confdefs.h #define PG_VERSION "7.1.3" #define MULTIBYTE 1 #define DEF_PGPORT 5432 #define DEF_PGPORT_STR "5432" #define DEF_MAXBACKENDS 32 #define PG_VERSION_STR "PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." #define PG_KRB_SRVNAM "postgres" #define HAVE_CRYPT_H 1 #define HAVE_ENDIAN_H 1 <略>
defineにまじってなんか変なのあるしwww
なんかgccのバージョン取得するところがおかしそうだね。(というかgccのバージョンに対応してなさそう)
実は、同じ7系の7.4.9ではconfigureは普通にインストできてるので、
7.1.3と7.4.9のconfigureでgccをチェックしてるところを比べてみた。
- 7.1.3
cc_string="GCC `${CC} --version`"
- 7.4.9
cc_string="GCC `${CC} --version | sed q`"
微妙に違う。実際コマンドを打ってみた。
$ gcc --version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ $ gcc --version | sed q gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46) $
ってことらしい(一行で出力させる)。なんで
$ diff configure.backup configure 1620c1620 < cc_string="GCC `${CC} --version`" --- > cc_string="GCC `${CC} --version | sed q`" $
こんな感じで修正して、もう一回configure。
$ ./configure --enable-multibyte=EUC_JP
今度は無事成功。
makeしてみる
ここまできたらあとは楽勝とか考えてた時期が私にもありました。
makeするとエラーでまくります。そりゃ無理やりconfigure通してんだから出るよね。
make結果はこんなん。
$ make <略> gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../../../src/include -c -o big5.o big5.c /usr/bin/ld -r -o SUBSYS.o common.o conv.o mbutils.o wchar.o wstrcmp.o wstrncmp.o big5.o make[4]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src/backend/utils/mb' から出ます /usr/bin/ld -r -o SUBSYS.o fmgrtab.o adt/SUBSYS.o cache/SUBSYS.o error/SUBSYS.o fmgr/SUBSYS.o hash/SUBSYS.o init/SUBSYS.o misc/SUBSYS.o mmgr/SUBSYS.o sort/SUBSYS.o time/SUBSYS.o mb/SUBSYS.o make[3]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src/backend/utils' から出ます gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -Wl,-rpath,/usr/local/pgsql/lib -export-dynamic access/SUBSYS.o bootstrap/SUBSYS.o catalog/SUBSYS.o parser/SUBSYS.o commands/SUBSYS.o executor/SUBSYS.o lib/SUBSYS.o libpq/SUBSYS.o main/SUBSYS.o nodes/SUBSYS.o optimizer/SUBSYS.o port/SUBSYS.o postmaster/SUBSYS.o regex/SUBSYS.o rewrite/SUBSYS.o storage/SUBSYS.o tcop/SUBSYS.o utils/SUBSYS.o -lz -lcrypt -lresolv -lnsl -ldl - lm -lbsd -lreadline -ltermcap -o postgres /usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in commands/SUBSYS.o /lib/libc.so.6: could not read symbols: Bad value collect2: ld はステータス 1 で終了しました make[2]: *** [postgres] エラー 1 make[2]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src/backend' から出ます make[1]: *** [all] エラー 2 make[1]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src' から出ます make: *** [all] エラー 2
∧_∧ ( ゚ω゚ ) makeは任せろー バリバリC□ l丶l丶 / ( ) もうやめて! (ノ ̄と、 i しーJ
でもこっちのエラーはぐぐったら情報が結構でてきたw
なんかerrono変数がわるさしてるらしい。
ヘッダーファイルをいじいじ
$ diff ./src/include/postgres.h.backup ./src/include/postgres.h 576,579c576,579 < #define DATA(x) extern int errno < #define DESCR(x) extern int errno < #define DECLARE_INDEX(x) extern int errno < #define DECLARE_UNIQUE_INDEX(x) extern int errno --- > #define DATA(x) extern int no_such_variable > #define DESCR(x) extern int no_such_variable > #define DECLARE_INDEX(x) extern int no_such_variable > #define DECLARE_UNIQUE_INDEX(x) extern int no_such_variable $
もう一回makeしてみる。ヘッダー書き換えたのでmake cleanから
$ make clean $ make <省略> make[3]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src/backend/commands' に入ります gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../../src/include -c -o async.o async.c gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../../src/include -c -o creatinh.o creatinh.c gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../../src/include -c -o command.o command.c command.c: In function ‘AlterTableAddConstraint’: command.c:1441: 警告: dereferencing type-punned pointer will break strict-aliasing rules gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../../src/include -c -o comment.o comment.c gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../../src/include -c -o copy.o copy.c copy.c: In function ‘DoCopy’: copy.c:334: error: ‘errno’ undeclared (first use in this function) copy.c:334: error: (Each undeclared identifier is reported only once copy.c:334: error: for each function it appears in.) copy.c: In function ‘CopyTo’: copy.c:582: 警告: dereferencing type-punned pointer will break strict-aliasing rules copy.c:582: 警告: dereferencing type-punned pointer will break strict-aliasing rules copy.c: In function ‘CopyFrom’: copy.c:868: 警告: dereferencing type-punned pointer will break strict-aliasing rules copy.c:868: 警告: dereferencing type-punned pointer will break strict-aliasing rules copy.c: In function ‘CopyAttributeOut’: copy.c:1209: 警告: pointer targets in passing argument 2 of ‘pg_encoding_mblen’ differ in signedness make[3]: *** [copy.o] エラー 1 make[3]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src/backend/commands' から出ます make[2]: *** [commands-recursive] エラー 2 make[2]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src/backend' から出ます make[1]: *** [all] エラー 2 make[1]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src' から出ます make: *** [all] エラー 2 $
ふむふむ。
そしたらこんな感じで修正して・・・もう一回makeしてみる。
$ diff ./src/backend/commands/copy.c.backup ./src/backend/commands/copy.c 15c15 < --- > #include <errno.h> $ $ make <略> make[4]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src/pl/plpgsql/src' から出ます make[3]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src/pl/plpgsql' から出ます make[2]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src/pl' から出ます make[1]: ディレクトリ `/usr/local/src/postgresql-7.1.3/src' から出ます All of PostgreSQL successfully made. Ready to install. $
/\___/ヽ / ::::::::::::::::\ き . | ,,-‐‐ ‐‐-、 .:::| た | 、_(o)_,: _(o)_, :::|ぁぁ . | ::< .::|あぁ \ /( [三] )ヽ ::/ああ /`ー‐--‐‐―´\ぁあ
あとはmake installして、初期DBつくってできあがり。
もう…ゴールしてもいいよね…