CentOS5.2でErlang R12B-4をbuildしようとしてエラーになった
$ make clean; LANG=C ; export LANG ; ./configure --prefix=/usr/local/erlang ; make 中略 make[4]: Entering directory `/usr/local/src/otp_src_R12B-4/lib/ssl/c_src' gcc -g -O2 -I/usr/local/src/otp_src_R12B-4/erts/i686-pc-linux-gnu -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -o ../priv/bin/i686-pc-linux-gnu/ssl_esock ../priv/obj/i686-pc-linux-gnu/esock.o ../priv/obj/i686-pc-linux-gnu/debuglog.o ../priv/obj/i686-pc-linux-gnu/esock_poll.o ../priv/obj/i686-pc-linux-gnu/esock_osio.o ../priv/obj/i686-pc-linux-gnu/esock_utils.o ../priv/obj/i686-pc-linux-gnu/esock_posix_str.o ../priv/obj/i686-pc-linux-gnu/esock_openssl.o -lutil -ldl -lm /usr/lib/libssl.a /usr/lib/libcrypto.a /usr/lib/libkrb5.a /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a /usr/lib/libcom_err.a /usr/lib/libz.a /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_next_cred': (.text+0x738): undefined reference to `keyctl_read_alloc' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_get_principal': (.text+0xf2b): undefined reference to `keyctl_read_alloc' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_getkeycount': (.text+0x1196): undefined reference to `keyctl_read' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_clearcache': (.text+0x1237): undefined reference to `keyctl_clear' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_clearcache': (.text+0x1269): undefined reference to `keyctl_clear' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x184f): undefined reference to `request_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x1887): undefined reference to `keyctl_read' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x190f): undefined reference to `keyctl_search' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x1945): undefined reference to `add_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_resolve': (.text+0x1af2): undefined reference to `keyctl_search' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_initialize': (.text+0x20f8): undefined reference to `add_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_store': (.text+0x2b8f): undefined reference to `add_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_generate_new': (.text+0x2d1b): undefined reference to `keyctl_search' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_generate_new': (.text+0x2d5d): undefined reference to `add_key' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_start_seq_get': (.text+0x32e5): undefined reference to `keyctl_read' /usr/lib/libkrb5.a(cc_keyring.o): In function `krb5_krcc_destroy': (.text+0x39a5): undefined reference to `keyctl_unlink' /usr/lib/libkrb5support.a(selinux.o): In function `pop_fscreatecon': (.text+0x1a): undefined reference to `is_selinux_enabled' /usr/lib/libkrb5support.a(selinux.o): In function `pop_fscreatecon': (.text+0x34): undefined reference to `setfscreatecon' /usr/lib/libkrb5support.a(selinux.o): In function `pop_fscreatecon': (.text+0x40): undefined reference to `freecon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x77): undefined reference to `is_selinux_enabled' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x97): undefined reference to `getfscreatecon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x149): undefined reference to `matchpathcon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x160): undefined reference to `setfscreatecon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x173): undefined reference to `freecon' /usr/lib/libkrb5support.a(selinux.o): In function `push_fscreatecon': (.text+0x198): undefined reference to `freecon' collect2: ld returned 1 exit status make[4]: *** [../priv/bin/i686-pc-linux-gnu/ssl_esock] Error 1
このエラーで検索したところ、[erlang-questions] Problem compiling under CentOS 5から始まるスレッドの終わりの記事が参考になりそうだ。Makefileの不備らしい。
パッチが出ている。要するにkeyutilsとselinuxのライブラリをリンクし忘れてましたってことです。エラーの冒頭に出てくるkeyctl_read_allocは /usr/include/keyutils.h で定義されてましたから、納得です。
--- lib/ssl/c_src/Makefile.in 2008-03-27 13:43:04.000000000 +0300 +++ lib/ssl/c_src/Makefile.in 2008-03-27 14:03:27.000000000 +0300 @@ -38,7 +38,7 @@ CC = @CC@ LD = @LD@ SHELL = /bin/sh -LIBS = @LIBS@ +LIBS = @LIBS@ -lkeyutils -lselinux PLAIN_CFLAGS = @CFLAGS@
実際に lib/ssl/c_src/Makefile.in を編集して ./configure ; make したら通りました。
# uname -a Linux www.jin.gr.jp 2.6.18-92.1.6.el5xen #1 SMP Wed Jun 25 14:54:06 EDT 2008 i686 i686 i386 GNU/Linux # cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz stepping : 13 cpu MHz : 1994.999 cache size : 1024 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm bogomips : 4989.27 processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz stepping : 13 cpu MHz : 1994.999 cache size : 1024 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc up pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm bogomips : 4989.27 # /usr/local/erlang/bin/erl Erlang (BEAM) emulator version 5.6.4 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.6.4 (abort with ^G) 1>
ところで、ライブラリを明示的に指定しないでOKだったケースというのは、どう理解したらいいものやら。リンクしていたライブラリが、その機能を参照してなかったということなのだろうか?
(2009/1/19追記
トラックバックをいただいていたのだが、R12B-5でも同じ問題が残っていることを確認できた。)
(2009/5/26追記 R13Bでも同様の方法でbuildできました)