SolarisでGnupgインストール(途中まで)

gnupgSolarisにインストール。ちょっと前までPGPは使っていたんですが、近頃はGnuGPの方が幅を利かせてるのかな。

必要なもの

GnuPGインストールには以下のものが必要です。

  • GNU Portable Threads Library

ftp://ftp.gnu.org/gnu/pth

  • libksba 1.0.0以上

ftp://ftp.gnupg.org/gcrypt/libksba

  • Pth(GNU Portable Threads)サポート付きlibassuan

 ftp://ftp.gnupg.org/gcrypt/libassuan

  • libcrypt1.2.2以上

ftp://ftp.gnupg.org/gcrypt/libcrypt

  • libpg-error1.4以上

ftp://ftp.gnupg.org/gcrypt/libpg-error

  • Pinentry package

 ftp://ftp.gnupg.org/cgrypt/pinentry
これは必須ではないようですが、ほとんどの機能に必要だって書いてあるので
 入れたほうがいいかも。

GNU Potable Tread Libraryをインストール

ソースを展開してconfigure,make,make test,make installでOK。

$ /usr/local/bin/tar -zxvf pth-2.0.7.tar.gz
$ cd pth-2.0.7
$ ./configure
$ /usr/local/bin/make
$ /usr/local/bin/make test
# /usr/local/bin/make install

libassuanをインストール

展開してconfigure。Pthのサポートを明示的に指定します。

$ /usr/local/bin/tar -jxvf libassuan-1.0.1.tar.bz
$ cd libassuan-1.0.1
$ ./configure --with-pth-prefix=/usr/local
$ /usr/local/bin/make
# /usr/local/bin/make install

**libgpg-errorをインストール
展開してconfigure,make,make install。

>||
$ /usr/local/bin/tar -jxvf libgpg-error-1.5.tar.bz2
$ cd libgpg-error-1.5/
$ ./configure
$ /usr/local/bin/make
# /usr/local/bin/make install

libgcryptをインストール

これも同じ手順。

$ /usr/local/bin/tar -zxvf libgcrypt-1.2.4.tar.gz
$ cd libgcrypt-1.2.4
$ ./configure
$ /usr/local/bin/make
(中略)
gcc -I/usr/local/include -g -O2 -Wall -o .libs/ac ac.o  ../src/.libs/libgcrypt.o -L/usr/local/lib /usr/local/lib/libgpg-error.so -lnsl -lsocket -R/usr/local/lb
Undefined                       first referenced
 symbol                             in file
gcry_ac_data_verify                 ac.o
gcry_ac_open                        ac.o
gcry_ac_key_init                    ac.o
gcry_ac_data_encrypt                ac.o
gcry_ac_data_decrypt                ac.o
gcry_ac_data_destroy                ac.o
gcry_ac_close                       ac.o
gcry_ac_key_data_get                ac.o
gcry_ac_key_pair_generate           ac.o
gcry_ac_key_pair_extract            ac.o
gcry_ac_data_sign                   ac.o
gcry_ac_data_copy                   ac.o
gcry_ac_data_get_index              ac.o
ld: fatal: Symbol referencing errors. No output written to .libs/ac
collect2: ld returned 1 exit status
make[2]: *** [ac] Error 1
make[2]: Leaving directory `/export/home/hoge/libgcrypt-1.2.4/tests
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/export/home/hoge/libgcrypt-1.2.4'
make: *** [all] Error 2

っと。ここでエラー発生。testsディレクトリでgcyr_ac_data_verifyとかなんとかが無いって。
このUndefined symbolになっている関数群は、cipher/ac.cに定義されていて、ここのエラーが通るまでにすでにコンパイルされている。だから、これを参照するようにすればいいんだろうという推測に基づきtests/Makefileを改変。198行目、LIBSの定義を

LIBS = ../cipher/ac.o -lnsl  -lsocket

と変更。そんなことでいいのか>俺。
でもってtests以下をmakeして、再度make。

$ cd tests
(Makefileを改変)
$ /usr/local/bin/make
$ cd ..
$ /usr/local/bin/make
# /usr/local/bin/make install

libksbaをインストール

これもconfigure,makeで。

$ /usr/local/bin/tar -jxvf libksba-1.0.1.tar.bz2
$ cd libksba-1.0.1
$ ./configure
$ /usr/local/bin/make
# /usr/local/bin/make install

pinentryをインストール。

これもconfigure,makeしてみる。

$ /usr/local/bin/tar -zxvf pinentry-0.7.2.tar.gz
$ cd pinentry-0.7.2
$ ./configure
$ /usr/local/bin/make
(中略)
f gcc -DHAVE_CONFIG_H -I. -I. -I..  -I../assuan -I../secmem -Wall  -g -O2 -Wall -Wcast-align -Wshadow -Wstrict-prototypes -MT pinentry.o -MD -MP -MF ".deps/pinentry.Tpo" -c -o pinentry.o pinentry.c; \
then mv -f ".deps/pinentry.Tpo" ".deps/pinentry.Po"; else rm -f ".deps/pinentry.Tpo"; exit 1; fi
pinentry.c:28:20: error: getopt.h: No such file or directory
pinentry.c: In function 'pinentry_parse_opts':
pinentry.c:297: error: array type has incomplete element type
pinentry.c:298: error: 'no_argument' undeclared (first use in this function)
pinentry.c:298: error: (Each undeclared identifier is reported only once
pinentry.c:298: error: for each function it appears in.)
pinentry.c:299: error: 'required_argument' undeclared (first use in this function)
pinentry.c:311: warning: implicit declaration of function 'getopt_long'
pinentry.c:297: warning: unused variable 'opts'
pinentry.c: In function 'cmd_setdesc':
pinentry.c:488: warning: pointer targets in passing argument 2 of 'strcpy_escaped' differ in signedness
pinentry.c: In function 'cmd_setprompt':
pinentry.c:505: warning: pointer targets in passing argument 2 of 'strcpy_escaped' differ in signedness
pinentry.c: In function 'cmd_seterror':
pinentry.c:522: warning: pointer targets in passing argument 2 of 'strcpy_escaped' differ in signedness
pinentry.c: In function 'cmd_setok':
pinentry.c:539: warning: pointer targets in passing argument 2 of 'strcpy_escaped' differ in signedness
pinentry.c: In function 'cmd_setcancel':
pinentry.c:556: warning: pointer targets in passing argument 2 of 'strcpy_escaped' differ in signedness
make[2]: *** [pinentry.o] Error 1
make[2]: Leaving directory `/export/home/hoge/pinentry-0.7.2/pinentry'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/export/home/hoge/pinentry-0.7.2'

getopt.hが無いって言ってるな。getopt.hを探してみるとgccの構築環境に発見。

$ cd 
$ find . -name getopt.h
./gcc/gcc-4.1.0/include/getopt.h
./gcc/gcc-4.0.2/include/getopt.h
./gcc/gcc-4.1.2/include/getopt.h
./gcc/gcc-4.1.1/include/getopt.h

これを-Iで強制的に見せることにする。

$ cd pinentry-0.7.2/
$ export CFLAGS=-I/export/home/hoge/gcc/gcc-4.1.2/include
$ ./configure
$ /usr/local/bin/make
(中略)
gcc  -I/export/hoge/gcc/gcc-4.1.2/include -Wall -Wcast-align -Wshadow -Wstrict-prototypes   -o pinentry-curses  pinentry-curses.o ../pinentry/libpinentry.a ../pinentry/libpinentry-curses.a ../assuan/libassuan.a ../secmem/libsecmem.a  -lcurses -liconv
未定義の                        最初に参照している
シンボル                            ファイル
getopt_long                         ../pinentry/libpinentry.a(pinentry.o)
ld: 重大なエラー: シンボル参照エラー。pinentry-curses に書き込まれる出力はありません。
collect2: ld returned 1 exit status
make[2]: *** [pinentry-curses] Error 1

また違うエラーが。今度はgetopt_longがないと。そうか、上のgetopt.hも含めてgccからやり直さないといけないような気がしてきた。今回はここまでにしておきます。