Edited at

mod_log_sqlをmakeしたときエラーの回避

More than 1 year has passed since last update.


mod_log_sqlとは?

Apacheのアクセスログをmysqlに保存できる

環境

- Rasberry Pi

まず普通にダウンロードして解凍して・・・

$ wget http://www.outoforder.cc/downloads/mod_log_sql/mod_log_sql-1.101.tar.bz2

$ tar jxvf mod_log_sql-1.101.tar.bz2
$ cd mod_log_sql-1.101
$ ./configure --with-apxs=/usr/bin/apxs2 --with-mysql=/usr/bin/mysql
$ make
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static arm-linux-gnueabihf-gcc -std=gnu99 -prefer-pic -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apache2 -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include -Wall -fno-strict-aliasing -DHAVE_CONFIG_H -DWITH_APACHE20 -c -o mod_log_sql.lo mod_log_sql.c && touch mod_log_sql.slo
In file included from mod_log_sql.c:146:0:
functions.h: In function 'extract_remote_address':
functions.h:17:25: error: 'conn_rec' has no member named 'remote_ip'
return r->connection->remote_ip;
^
mod_log_sql.c: In function 'log_sql_post_config':
mod_log_sql.c:507:37: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (cls->preserve_file == DEFAULT_PRESERVE_FILE)
^
mod_log_sql.c: In function 'safe_sql_insert':
mod_log_sql.c:594:17: warning: comparison between 'logsql_query_ret' and 'enum <anonymous>' [-Wenum-compare]
table_name))!=LOGSQL_TABLE_SUCCESS) {
^
mod_log_sql.c: In function 'log_sql_merge_state':
mod_log_sql.c:737:33: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->transfer_log_format == DEFAULT_TRANSFER_LOG_FMT) {
^
mod_log_sql.c:744:27: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->preserve_file == DEFAULT_PRESERVE_FILE)
^
mod_log_sql.c:747:27: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->preserve_file == DEFAULT_PRESERVE_FILE)
^
mod_log_sql.c:750:30: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->notes_table_name == DEFAULT_NOTES_TABLE_NAME)
^
mod_log_sql.c:753:28: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->hin_table_name == DEFAULT_HIN_TABLE_NAME)
^
mod_log_sql.c:756:29: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->hout_table_name == DEFAULT_HOUT_TABLE_NAME)
^
mod_log_sql.c:759:31: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->cookie_table_name == DEFAULT_COOKIE_TABLE_NAME)
^
apxs:Error: Command failed with rc=65536
.
Makefile:130: recipe for target 'mod_log_sql.la' failed
make: *** [mod_log_sql.la] Error 1

    _, -¬ | |.| .|              \     
 __,,-''"´   |.し'' "~,,,,.  ,,へ,              ヽ
「     _.,.  | ,| ̄ ̄ / ,/´ /             |     ふ
|__,,-''"~ |  |.,!.__,,..--',/´  /   ___.       |
    _.,_|   |    /   /  /   ノ( \.     |.     ざ
__,,-''"´   .,;;   く.,   / ./  _ノ  ヽ、_. \.  |
|   _,,-'' ^      ^"  /ノ((○)  (○)  \. |    け
|,,-''"´      、、     |  ⌒ (__人__)  ノ( | |
    |.       ヽヽ    \     |!!il|!|!l|   ⌒/`|    ん
     |i       ヽヽ    >   ⌒⌒        |
    .| !      ,     /             |.     な
   .! .{    ノ|   /               |
   i  ヽ--''"  |   {  .,             ./      !!!
   ノ        `、
ー─‐―---,,,,,____  ヽ、     \、        |{r,/_/_/冫
ー─‐―---,,,___/ | ||  , 、=-     \、      \ヾ匕/」
         ./||  | /  |\.      \、      ヽ
       ./  ||  | >   |  \      \       ヽ
____/   ||  | \   ヽ  ヽ、       `丶、..,,,,_  ヽ
     /|.    ||  | ̄´   冫    ヽ、         `ヽ i
     / !     ||  |   /       ` ー .,,,       ,) 、
    ./  |.    ||  |  /              ̄ゝ_、ノ  ヽ
__/   !     .||  |ー┴---.,,,,,___ /ヽ、         ヽ
   |         ||  |            ` ̄ ̄ `ー―---- .,,,,,__
   .i          ||  |

どうやらfunctions.hのreturn r->connection->remote_ip;が引っかかてる

$ vim functions.h

15 static const char *extract_remote_address(request_rec *r, char *a)
16 {
17 return r->connection->remote_ip;
18 }

15 static const char *extract_remote_address(request_rec *r, char *a)
16 {
17 return r->connection->client_ip;
18 }

$make
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static arm-linux-gnueabihf-gcc -std=gnu99 -prefer-pic -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apache2 -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include -Wall -fno-strict-aliasing -DHAVE_CONFIG_H -DWITH_APACHE20 -c -o mod_log_sql.lo mod_log_sql.c && touch mod_log_sql.slo
mod_log_sql.c: In function 'log_sql_post_config':
mod_log_sql.c:507:37: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (cls->preserve_file == DEFAULT_PRESERVE_FILE)
^
mod_log_sql.c: In function 'safe_sql_insert':
mod_log_sql.c:594:17: warning: comparison between 'logsql_query_ret' and 'enum <anonymous>' [-Wenum-compare]
table_name))!=LOGSQL_TABLE_SUCCESS) {
^
mod_log_sql.c: In function 'log_sql_merge_state':
mod_log_sql.c:737:33: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->transfer_log_format == DEFAULT_TRANSFER_LOG_FMT) {
^
mod_log_sql.c:744:27: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->preserve_file == DEFAULT_PRESERVE_FILE)
^
mod_log_sql.c:747:27: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->preserve_file == DEFAULT_PRESERVE_FILE)
^
mod_log_sql.c:750:30: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->notes_table_name == DEFAULT_NOTES_TABLE_NAME)
^
mod_log_sql.c:753:28: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->hin_table_name == DEFAULT_HIN_TABLE_NAME)
^
mod_log_sql.c:756:29: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->hout_table_name == DEFAULT_HOUT_TABLE_NAME)
^
mod_log_sql.c:759:31: warning: comparison with string literal results in unspecified behavior [-Waddress]
if (child->cookie_table_name == DEFAULT_COOKIE_TABLE_NAME)
^
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static arm-linux-gnueabihf-gcc -std=gnu99 -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -o mod_log_sql.la -rpath /usr/lib/apache2/modules -module -avoid-version mod_log_sql.lo
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static arm-linux-gnueabihf-gcc -std=gnu99 -prefer-pic -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apache2 -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include -Wall -fno-strict-aliasing -I/usr/include/db1 -I/usr/include/openssl -DHAVE_CONFIG_H -DWITH_APACHE20 -c -o mod_log_sql_ssl.lo mod_log_sql_ssl.c && touch mod_log_sql_ssl.slo
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static arm-linux-gnueabihf-gcc -std=gnu99 -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -o mod_log_sql_ssl.la -rpath /usr/lib/apache2/modules -module -avoid-version mod_log_sql_ssl.lo
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static arm-linux-gnueabihf-gcc -std=gnu99 -prefer-pic -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apache2 -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include -Wall -fno-strict-aliasing -DHAVE_CONFIG_H -DWITH_APACHE20 -c -o mod_log_sql_logio.lo mod_log_sql_logio.c && touch mod_log_sql_logio.slo
mod_log_sql_logio.c: In function 'register_hooks':
mod_log_sql_logio.c:118:5: warning: implicit declaration of function 'ap_hook_pre_connection' [-Wimplicit-function-declaration]
ap_hook_pre_connection(logio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE);
^
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static arm-linux-gnueabihf-gcc -std=gnu99 -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -o mod_log_sql_logio.la -rpath /usr/lib/apache2/modules -module -avoid-version mod_log_sql_logio.lo
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static arm-linux-gnueabihf-gcc -std=gnu99 -prefer-pic -pipe -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apache2 -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include -Wall -fno-strict-aliasing -I/usr/include/mysql -DHAVE_CONFIG_H -DWITH_APACHE20 -c -o mod_log_sql_mysql.lo mod_log_sql_mysql.c && touch mod_log_sql_mysql.slo
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static arm-linux-gnueabihf-gcc -std=gnu99 -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -o mod_log_sql_mysql.la -L/usr/lib/mysql -lmysqlclient -lm -lz -rpath /usr/lib/apache2/modules -module -avoid-version mod_log_sql_mysql.lo
Making all in docs
make[1]: Entering directory '/home/user/download/mod_log_sql-1.101/docs'
make[1]: Leaving directory '/home/user/download/mod_log_sql-1.101/docs'
Making all in contrib
make[1]: Entering directory '/home/user/download/mod_log_sql-1.101/contrib'
make[1]: Leaving directory '/home/user/download/mod_log_sql-1.101/contrib'

警告いっぱい出たが一応make出来た(´・ω・`)v