OpenStreetMap mod_tile.c のコンパイルエラーとその回避方法

openstreetmapja-en-2012.05.13-v1.0_book.pdf - Google ドキュメント と OpenStreetMapデータを使って地図サーバを構築してみた を参考に自前の OpenStreetMap サーバを構築してて引っかかったのでメモ。

まとめ

mod_tile の 2012/6/26 10時頃JST時点の svn 最新版 rev28458 は型互換性の問題でコンパイルエラーになるから、問題部分の変更が入る前の rev28453 にしとこう。

問題点

Apache ウェブサーバと mod_tileのインストールと構成」で、mod_tile を make する部分があるんですが、今(2012/6/26 10時頃JST)時点の最新版は rev28458。

手順に沿って

$ svn co http://svn.openstreetmap.org/applications/utils/mod_tile
$ cd mod_tile
$ cd mod_tile
$ ./autogen.sh
$ ./configure
$ make

すると make で

make
(省略)
apxs2 -c    ./mod_tile.c ./store.c ./dir_utils.c
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static i686-linux-gnu-gcc -prefer-pic -DLINUX=2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -I/usr/include/apr-1.0 -I/usr/include/openssl -I/usr/include/xmltok -pthread     -I/usr/include/apache2  -I/usr/include/apr-1.0   -I/usr/include/apr-1.0   -c -o ./mod_tile.lo ./mod_tile.c && touch ./mod_tile.slo
In file included from ./mod_tile.c:51:0:
./mod_tile.h:98:1: warning: useless storage class specifier in empty declaration [enabled by default]
./mod_tile.c: In function 'add_expiry':
./mod_tile.c:379:22: warning: format '%lld' expects argument of type 'long long int', but argument 3 has type 'long int' [-Wformat]
./mod_tile.c: In function 'tile_handler_mod_stats':
./mod_tile.c:814:36: error: incompatible types when assigning to type 'apr_uint64_t[10]' from type 'void *'
./mod_tile.c:816:36: error: incompatible types when assigning to type 'apr_uint64_t[10]' from type 'void *'
./mod_tile.c:823:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:824:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:825:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:826:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:827:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:828:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:829:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:830:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:831:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:832:5: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:834:9: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:838:9: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c:839:9: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'apr_uint64_t' [-Wformat]
./mod_tile.c: In function 'mod_tile_post_config':
./mod_tile.c:1105:27: error: incompatible types when assigning to type 'apr_uint64_t[10]' from type 'apr_uint64_t *'
./mod_tile.c:1106:27: error: incompatible types when assigning to type 'apr_uint64_t[10]' from type 'apr_uint64_t *'
apxs:Error: Command failed with rc=65536
.

とのエラーを吹いて mod_tile.c がコンパイルできず。メッセージにあるとおり、型互換性の問題。
rev28454 のパッチがまずいようなので、1つ前のリビジョンに巻き戻せばひとまずはOK。

$ svn update -r28453
$ make