2012/04/25(水)apache 2.4.1 に mod_mono 2.10 で error: 'unixd_config' undeclared

はてブ数 2012/04/25 01:50 計算機な日記::ボクと計算機つーさ

makeできなかった。

apache 2.4 から .h 側の定義が変わったらしい。
mod_mono.c を何カ所かいじってmakeできた。

参考にさせていただいた!
http://www.yazin.info/blog/archives/2012/0406_171642.html

unixd_config を ap_unixd_config にかえて、
conn_rec::remote_addr を conn_rec::client_addr にかえて
conn_rec::remote_ip を conn_rec::client_ip にかえた。

あと他にも変わってるかもしれないけどとりあえずmakeできたので見てない。

次のmonoでしれっと直るのはたぶんそうなのだろうが、
さしあたり、mod_ なんとかのmakeで困っている人が、
このページを見つければいいよということで残しておく。

makeしんでしまう。

[tu-sa@TNAS mod_mono-2.10]$ make
Making all in src
make[1]: Entering directory `/share/HDA_DATA/.qpkg/Optware/local/src/mod_mono-2.10/src'
/bin/sh ../libtool --tag=CC   --mode=compile distcc armv5tel-softfloat-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../include   -O3 -I/opt/local/apache2/include -O3 -pthread  -I/opt/local/apache2/include   -pthread  -I/opt/local/apache2/include  -O3 -I/opt/local/apache2/include -O3 -pthread  -I/opt/local/apache2/include   -pthread  -I/opt/local/apache2/include -O3 -I/opt/local/apache2/include -O3 -pthread -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -O3 -I/opt/local/apache2/include -O3 -pthread   -I/opt/local/apache2/include   -pthread -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -I/opt/local/apache2/include  -Wall -DDFLT_MONO_CONFIG_DIR=\\"/opt/local/apache2/conf/mod-mono-applications\\" -O3 -I/opt/local/apache2/include -O3 -pthread  -I/opt/local/apache2/include   -pthread  -I/opt/local/apache2/include  -MT mod_mono_la-mod_mono.lo -MD -MP -MF .deps/mod_mono_la-mod_mono.Tpo -c -o mod_mono_la-mod_mono.lo `test -f 'mod_mono.c' || echo './'`mod_mono.c
libtool: compile:  distcc armv5tel-softfloat-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../include -O3 -I/opt/local/apache2/include -O3 -pthread -I/opt/local/apache2/include -pthread -I/opt/local/apache2/include -O3 -I/opt/local/apache2/include -O3 -pthread -I/opt/local/apache2/include -pthread -I/opt/local/apache2/include -O3 -I/opt/local/apache2/include -O3 -pthread -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -O3 -I/opt/local/apache2/include -O3 -pthread -I/opt/local/apache2/include -pthread -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/opt/local/apache2/include -Wall -DDFLT_MONO_CONFIG_DIR=\\"/opt/local/apache2/conf/mod-mono-applications\\" -O3 -I/opt/local/apache2/include -O3 -pthread -I/opt/local/apache2/include -pthread -I/opt/local/apache2/include -MT mod_mono_la-mod_mono.lo -MD -MP -MF .deps/mod_mono_la-mod_mono.Tpo -c mod_mono.c  -fPIC -DPIC -o .libs/mod_mono_la-mod_mono.o
distcc[18309] ERROR: compile mod_mono.c on 192.168.24.3/24 failed
distcc[18309] (dcc_build_somewhere) Warning: remote compilation of 'mod_mono.c' failed, retrying locally
distcc[18309] Warning: failed to distribute mod_mono.c to 192.168.24.3/24, running locally instead
mod_mono.c: In function 'apache_get_userid':
mod_mono.c:389: error: 'unixd_config' undeclared (first use in this function)
mod_mono.c:389: error: (Each undeclared identifier is reported only once
mod_mono.c:389: error: for each function it appears in.)
mod_mono.c: In function 'apache_get_groupid':
mod_mono.c:399: error: 'unixd_config' undeclared (first use in this function)
mod_mono.c: In function 'apache_get_username':
mod_mono.c:409: error: 'unixd_config' undeclared (first use in this function)
mod_mono.c: In function 'ensure_dashboard_initialized':
mod_mono.c:488: warning: implicit declaration of function 'unixd_set_global_mutex_perms'
mod_mono.c: In function 'connection_get_remote_port':
mod_mono.c:854: warning: implicit declaration of function 'apr_sockaddr_port_get'
mod_mono.c:854: error: 'conn_rec' has no member named 'remote_addr'
mod_mono.c: In function 'send_initial_data':
mod_mono.c:1981: error: 'conn_rec' has no member named 'remote_ip'
mod_mono.c:2029: error: 'conn_rec' has no member named 'remote_ip'
distcc[18309] ERROR: compile mod_mono.c on localhost failed
make[1]: *** [mod_mono_la-mod_mono.lo] Error 1
make[1]: Leaving directory `/share/HDA_DATA/.qpkg/Optware/local/src/mod_mono-2.10/src'
make: *** [all-recursive] Error 1

ぱっち

--- src/mod_mono.c	2011-01-14 07:32:35.000000000 +0900
+++ src/mod_mono.c.new	2012-05-20 19:32:32.114742652 +0900
@@ -386,7 +386,7 @@
 apache_get_userid ()
 {
 #ifdef HAVE_UNIXD
-	return unixd_config.user_id;
+	return ap_unixd_config.user_id;
 #else
 	return ap_user_id;
 #endif
@@ -396,7 +396,7 @@
 apache_get_groupid ()
 {
 #ifdef HAVE_UNIXD
-	return unixd_config.group_id;
+	return ap_unixd_config.group_id;
 #else
 	return ap_group_id;
 #endif
@@ -406,7 +406,7 @@
 apache_get_username ()
 {
 #ifdef HAVE_UNIXD
-	return unixd_config.user_name;
+	return ap_unixd_config.user_name;
 #else
 	return ap_user_name;
 #endif
@@ -485,7 +485,7 @@
 
 #if defined (AP_NEED_SET_MUTEX_PERMS) && defined (HAVE_UNIXD)
 		DEBUG_PRINT (1, "Setting mutex permissions for %s", xsp->dashboard_lock_file);
-		rv = unixd_set_global_mutex_perms (xsp->dashboard_mutex);
+		rv = ap_unixd_set_global_mutex_perms (xsp->dashboard_mutex);
 		if (rv != APR_SUCCESS) {
 			ap_log_error (APLOG_MARK, APLOG_CRIT, STATCODE_AND_SERVER (rv),
 				      "Failed to set mutex permissions for %s",
@@ -847,26 +847,13 @@
 static int
 connection_get_remote_port (conn_rec *c)
 {
-#if defined(APACHE22)
-	return c->remote_addr->port;
-#else
-	apr_port_t port;
-	apr_sockaddr_port_get (&port, c->remote_addr);
-	return port;
-#endif
-
+	return c->client_addr->port;
 }
 
 static int
 connection_get_local_port (request_rec *r)
 {
-#if defined(APACHE22)
 	return r->connection->local_addr->port;
-#else
-	apr_port_t port;
-	apr_sockaddr_port_get (&port, r->connection->local_addr);
-	return port;
-#endif
 }
 
 static const char *
@@ -1978,7 +1965,7 @@
 
 	size += sizeof (int32_t);
 
-	info.remote_ip_len = strlen (r->connection->remote_ip);
+	info.remote_ip_len = strlen (r->connection->client_ip);
 	size += info.remote_ip_len + sizeof (int32_t);
 
 	size += sizeof (int32_t);
@@ -2026,7 +2013,7 @@
 	i = LE_FROM_INT (i);
 	memcpy (ptr, &i, sizeof (i));
 	ptr += sizeof (int32_t);
-	ptr += write_string_to_buffer (ptr, 0, r->connection->remote_ip, info.remote_ip_len);
+	ptr += write_string_to_buffer (ptr, 0, r->connection->client_ip, info.remote_ip_len);
 	i = connection_get_remote_port (r->connection);
 	i = LE_FROM_INT (i);
 	memcpy (ptr, &i, sizeof (i));

2012.05.20 破壊的修正。

ありがとうございました!


ああ、後はhttpd.confを書くだけか……めんどくさい。