Squid3.2.4でコンパイルエラー
昨日のTCP_ABORT_MISSとかって出る件。やっぱりどうも気持ち悪いのでsquidをバージョンアップすることに。
現在使っているのが3.2.3で最新が3.2.4。ソースをダウンロードしてconfigure,makeするとこんなエラーが。
make[3]: ディレクトリ `/home/hogehoge/squid/squid-3.2.4/helpers/external_acl/file_userip' に入ります g++ -DHAVE_CONFIG_H -I../../.. -I../../../include -I../../../lib -I../../../src -I../../../include -I../../../libltdl -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Werror -pipe -D_REENTRANT -g -O2 -MT ext_file_userip_acl.o -MD -MP -MF .deps/ext_file_userip_acl.Tpo -c -o ext_file_userip_acl.o ext_file_userip_acl.cc ext_file_userip_acl.cc: In function ‘int main(int, char**)’: ext_file_userip_acl.cc:260: error: ‘errno’ was not declared in this scope make[3]: *** [ext_file_userip_acl.o] エラー 1 make[3]: ディレクトリ `/home/hogehoge/squid/squid-3.2.4/helpers/external_acl/file_userip' から出ます make[2]: *** [all-recursive] エラー 1 make[2]: ディレクトリ `/home/hogehoge/squid/squid-3.2.4/helpers/external_acl' から出ます make[1]: *** [all-recursive] エラー 1 make[1]: ディレクトリ `/home/hogehoge/squid/squid-3.2.4/helpers' から出ます make: *** [all-recursive] エラー 1
C++で"errno"が分からないだと。errnoと言えばたしかunsinged intでdefineされているはず。ざっと検索してみると/usr/include/errno.hにある。
そこでエラーがでているhelpers/external_acl/file_userip/ext_file_userip_acl.ccに以下の行を追加。
#ifndef errno #include <errno.h> #endif
どこでもいいだろうけど、util.hをincludeしている下あたりがいいんじゃないかな。
こんな感じで。
#include "squid.h" #include "helpers/defines.h" #include "rfc1738.h" #include "util.h" #ifndef errno #include <errno.h> #endif
これでコンパイルできました。開発者環境ではエラーでなかったんだろうか。