[erlang-questions] Problem compiling under CentOS 5

Brian Candler B.Candler@REDACTED
Fri Aug 8 11:43:04 CEST 2008


I've been trying to compile R12B3 under CentOS 5, and compilation aborts at
the following point:

gcc  -g -O2 -I/v/build/otp_src_R12B-3/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
make[4]: Leaving directory `/v/build/otp_src_R12B-3/lib/ssl/c_src'
make[3]: *** [opt] Error 2
make[3]: Leaving directory `/v/build/otp_src_R12B-3/lib/ssl/c_src'
make[2]: *** [opt] Error 2
make[2]: Leaving directory `/v/build/otp_src_R12B-3/lib/ssl'
make[1]: *** [opt] Error 2
make[1]: Leaving directory `/v/build/otp_src_R12B-3/lib'
make: *** [libs] Error 2

Now, this was already reported by someone else at
http://www.erlang.org/pipermail/erlang-questions/2008-July/036345.html

The response there(*) was to install the krb5-devel package, but I already
had that installed.

So I did some poking around. The keyctl_* functions appear to be in
-lkeyutils, but that's not present in the linker command line shown above.
(Also note: the keyutils-libs-devel package contains
/usr/lib/libkeyutils.so but no .a file)

'freecon' appears to be in -lselinux. If you add that you get further errors
about functions like 'sepol_policy_kern_vers_max' and
'sepol_policy_file_create' which are in -lsepol.

I already had keyutils-libs-devel and libselinux-devel packages installed,
so to allow to compile to complete I made a manual frig to
lib/ssl/c_src/i686-pc-linux-gnu/Makefile:

--- lib/ssl/c_src/i686-pc-linux-gnu/Makefile.orig       2008-08-08 09:19:53.000000000 +0100
+++ lib/ssl/c_src/i686-pc-linux-gnu/Makefile    2008-08-08 10:05:58.000000000 +0100
@@ -133,7 +133,7 @@
 CC_R_OPT =
 SSL_LINK_LIB = $(SSL_LIBDIR)/libssl.a $(SSL_LIBDIR)/libcrypto.a 
 ifeq ($(NEED_KERBEROS),yes)
-SSL_LINK_LIB += /usr/lib/libkrb5.a /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a /usr/lib/libcom_err.a
+SSL_LINK_LIB += /usr/lib/libkrb5.a /usr/lib/libkrb5support.a /usr/lib/libk5crypto.a /usr/lib/libresolv.a /usr/lib/libcom_err.a /usr/lib/libkeyutils.so /usr/lib/libselinux.a /usr/lib/libsepol.a
 endif
 ifeq ($(NEED_ZLIB),yes)
 SSL_LINK_LIB += /usr/lib/libz.a

After that compilation completed successfully. Presumably some autoconf
magic is required to fix this problem properly.

Regards,

Brian Candler.

(*) The other response on the list was to use the pre-built EPEL5 R11B
package instead. However I was trying to install R12, because I was trying
get erlyweb to run with its prebuilt .beam files. When I try it on another
system where I have R11B5 installed (Ubuntu Hardy) I get the following
error:

  beam/beam_load.c(1301): Error loading module erlyweb:
    use of opcode 136; this emulator supports only up to 129

My best guess from this error is that I need a newer version of erlang.

Now I could just recompile erlyweb under R11B5. When I first tried that,
erlang itself dumped core:

$ make
sh make.sh
{"init terminating in do_boot",{undef,[{erltl,compile,["src/erlyweb/erlyweb_view.et",[{outdir,"ebin"},debug_info,show_errors,show_warnings]]},{filelib,fold_files2,6},{filelib,fold_files2,6},{erl_eval,do_apply,5},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
make: *** [all] Error 1
$ make clean
rm ebin/*.beam
$ make
sh make.sh
Recompile: src/erlyweb/yaws_headers
src/erlyweb/yaws_headers.erl:31: can't find include file "yaws_api.hrl"
src/erlyweb/yaws_headers.erl:35: record headers undefined
src/erlyweb/yaws_headers.erl:38: record arg undefined
src/erlyweb/yaws_headers.erl:38: record headers undefined
src/erlyweb/yaws_headers.erl:41: record arg undefined
src/erlyweb/yaws_headers.erl:41: record headers undefined
src/erlyweb/yaws_headers.erl:44: record arg undefined
src/erlyweb/yaws_headers.erl:44: record headers undefined
src/erlyweb/yaws_headers.erl:47: record arg undefined
src/erlyweb/yaws_headers.erl:47: record headers undefined
src/erlyweb/yaws_headers.erl:50: record arg undefined
src/erlyweb/yaws_headers.erl:50: record headers undefined
src/erlyweb/yaws_headers.erl:53: record arg undefined
src/erlyweb/yaws_headers.erl:53: record headers undefined
src/erlyweb/yaws_headers.erl:56: record arg undefined
src/erlyweb/yaws_headers.erl:56: record headers undefined
src/erlyweb/yaws_headers.erl:59: record arg undefined
src/erlyweb/yaws_headers.erl:59: record headers undefined
src/erlyweb/yaws_headers.erl:62: record arg undefined
src/erlyweb/yaws_headers.erl:62: record headers undefined
src/erlyweb/yaws_headers.erl:65: record arg undefined
src/erlyweb/yaws_headers.erl:65: record headers undefined
src/erlyweb/yaws_headers.erl:68: record arg undefined
src/erlyweb/yaws_headers.erl:68: record headers undefined
src/erlyweb/yaws_headers.erl:71: record arg undefined
src/erlyweb/yaws_headers.erl:71: record headers undefined
src/erlyweb/yaws_headers.erl:74: record arg undefined
src/erlyweb/yaws_headers.erl:74: record headers undefined
src/erlyweb/yaws_headers.erl:77: record arg undefined
src/erlyweb/yaws_headers.erl:77: record headers undefined
src/erlyweb/yaws_headers.erl:80: record arg undefined
src/erlyweb/yaws_headers.erl:80: record headers undefined
src/erlyweb/yaws_headers.erl:83: record arg undefined
src/erlyweb/yaws_headers.erl:83: record headers undefined
src/erlyweb/yaws_headers.erl:86: record arg undefined
src/erlyweb/yaws_headers.erl:86: record headers undefined
src/erlyweb/yaws_headers.erl:89: record arg undefined
src/erlyweb/yaws_headers.erl:89: record headers undefined
src/erlyweb/yaws_headers.erl:92: record arg undefined
src/erlyweb/yaws_headers.erl:92: record headers undefined
src/erlyweb/yaws_headers.erl:95: record arg undefined
src/erlyweb/yaws_headers.erl:95: record headers undefined
src/erlyweb/yaws_headers.erl:98: record arg undefined
src/erlyweb/yaws_headers.erl:98: record headers undefined
src/erlyweb/yaws_headers.erl:101: record arg undefined
src/erlyweb/yaws_headers.erl:101: record headers undefined
src/erlyweb/yaws_headers.erl:104: record arg undefined
src/erlyweb/yaws_headers.erl:104: record headers undefined
src/erlyweb/yaws_headers.erl:107: record arg undefined
src/erlyweb/yaws_headers.erl:107: record headers undefined
src/erlyweb/yaws_headers.erl:110: record arg undefined
src/erlyweb/yaws_headers.erl:110: record headers undefined
src/erlyweb/yaws_headers.erl:113: record arg undefined
src/erlyweb/yaws_headers.erl:113: record headers undefined
src/erlyweb/yaws_headers.erl:116: record arg undefined
src/erlyweb/yaws_headers.erl:116: record headers undefined
src/erlyweb/yaws_headers.erl:119: record arg undefined
src/erlyweb/yaws_headers.erl:119: record headers undefined
src/erlyweb/yaws_headers.erl:122: record arg undefined
src/erlyweb/yaws_headers.erl:122: record headers undefined
src/erlyweb/yaws_headers.erl:125: record arg undefined
src/erlyweb/yaws_headers.erl:125: record headers undefined
src/erlyweb/yaws_headers.erl:128: record arg undefined
src/erlyweb/yaws_headers.erl:128: record headers undefined
src/erlyweb/yaws_headers.erl:131: record arg undefined
src/erlyweb/yaws_headers.erl:131: record headers undefined
src/erlyweb/yaws_headers.erl:134: record arg undefined
src/erlyweb/yaws_headers.erl:134: record headers undefined
src/erlyweb/yaws_headers.erl:137: record arg undefined
src/erlyweb/yaws_headers.erl:137: record headers undefined
src/erlyweb/yaws_headers.erl:140: record arg undefined
src/erlyweb/yaws_headers.erl:140: record headers undefined
src/erlyweb/yaws_headers.erl:143: record arg undefined
src/erlyweb/yaws_headers.erl:143: record headers undefined
src/erlyweb/yaws_headers.erl:40: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:46: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:52: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:58: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:64: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:70: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:76: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:82: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:88: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:94: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:100: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:106: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:112: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:118: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:124: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:130: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:136: Warning: variable 'Val' is unused
src/erlyweb/yaws_headers.erl:142: Warning: variable 'Val' is unused
{"init terminating in do_boot",{undef,[{erltl,compile,["src/erlyweb/erlyweb_view.et",[{outdir,"ebin"},debug_info,show_errors,show_warnings]]},{filelib,fold_files2,6},{filelib,fold_files2,6},{erl_eval,do_apply,5},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
make: *** [all] Error 1

I had already built yaws, and I had symlinked /usr/lib/erlang/lib/yaws-1.77
to /usr/local/lib/yaws where yaws installed itself (under there are ebin,
examples, include, priv directories). However erlyweb was still unable to
find yaws_api.hrl. Whether that should cause a core dump I don't know.

Sticking some absolute paths in src/erlyweb/yaws_arg.erl and
src/erlyweb/yaws_headers.erl seemed to fix it. I clearly have a lot to learn
about this environment :-)

However, making R12B3 compile under CentOS seems to be a useful aim in its
own right, so I posted anyway.



More information about the erlang-questions mailing list