2013/01/02(Wed)mod_uploaderがFedora 17でコンパイルできない

2013/01/02 15:58 Software::Linux
先日Fedora 16から17にpreupgradeしたら、libMagick++.so.4が無いというエラーでhttpdが起動できず。どうやら、libMagick++.so.5になったらしい。
仕方ないのでリコンパイルしようと思ったら、今度はmod_uploader-3.1.1がコンパイルできない…。
コンパイルエラーを直すべく、色々とやってみた。

追記:Fedora20で解決 2013/12/27

こちらの記事をご覧下さい

エラー

  • libMagick++.so.4が無い
    httpd[9562]: httpd: Syntax error on line 230 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/uploader.conf: Cannot load /etc/httpd/modules/mod_uploader.so into server: libMagick++.so.4: cannot open shared object file: No such file or directory
    systemd[1]: httpd.service: control process exited, code=exited status=1
    systemd[1]: Unit httpd.service entered failed state.
    
  • mod_uploader-3.1.1がコンパイルできない
    RFC1867Parser.cpp: In instantiation of 'void RFC1867Parser<R, W>::get_content(RFC1867Parser<R, W>::content_t*) [with R = ApacheRequestReader; W = MmapFileWriter; RFC1867Parser<R, W>::content_t = MultipartMessageParser<ApacheRequestReader>::Content]':
    ApacheRFC1867Parser.cpp:47:16:   required from here
    RFC1867Parser.cpp:153:5: error: 'start_with' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    RFC1867Parser.cpp:153:5: note: declarations in dependent base 'MultipartMessageParser<ApacheRequestReader>' are not found by unqualified lookup
    RFC1867Parser.cpp:153:5: note: use 'this->start_with' instead
    RFC1867Parser.cpp:165:5: error: 'get_param' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    RFC1867Parser.cpp:165:5: note: declarations in dependent base 'MultipartMessageParser<ApacheRequestReader>' are not found by unqualified lookup
    RFC1867Parser.cpp:165:5: note: use 'this->get_param' instead
    RFC1867Parser.cpp:171:5: error: 'get_param' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    RFC1867Parser.cpp:171:5: note: declarations in dependent base 'MultipartMessageParser<ApacheRequestReader>' are not found by unqualified lookup
    RFC1867Parser.cpp:171:5: note: use 'this->get_param' instead
    RFC1867Parser.cpp: In instantiation of 'const char* RFC1867Parser<R, W>::get_boundary(const char*) [with R = ApacheRequestReader; W = MmapFileWriter]':
    ApacheRFC1867Parser.cpp:47:16:   required from here
    RFC1867Parser.cpp:210:5: error: 'get_param' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    RFC1867Parser.cpp:210:5: note: declarations in dependent base 'MultipartMessageParser<ApacheRequestReader>' are not found by unqualified lookup
    RFC1867Parser.cpp:210:5: note: use 'this->get_param' instead
    make[1]: *** [ApacheRFC1867Parser.o] エラー 1
    make[1]: ディレクトリ `/home/kero/rpmbuild/SRPMS/mod_uploader-3.1.1/src' から出ます
    make: *** [apache-module] エラー 2
    
結局やったことは単純で、この出力のnoteに書かれていることを黙々と対応するだけ。

環境

ディストリビューション
Fedora 17 x86
g++
4.7.2 20120921 (Red Hat 4.7.2-2)
SourceForgeからダウンロードできるmod_uploader-3.1.1-1.src.rpmを基準に修正。

準備

buildを全てrootでやるには危険なので、必ず一般ユーザで実行する。
$ mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

$ cd ~/rpmbuild/SRPMS

$ rpm2cpio mod_uploader-3.1.1-1.src.rpm | cpio -i

$ mv mod_uploader.spec ../SPECS/

$ mv mod_uploader-3.1.1.tgz ../SOURCES/

パッチ

同じく、SOURCESに私が作ったパッチを配置。
あと、mod_uploader.specにパッチを読み込む行を追加。*1
$ ls ~/rpmbuild/SOURCES/

mod_uploader-3.1.1.tgz
mod_uploader-3.1.1-f17fix.patch

$ vi ~/rpmbuild/SPECS/mod_uploader.spec
--- before/mod_uploader.spec   2013-01-02 15:20:06.958564998 +0900
+++ after/mod_uploader.spec   2013-01-02 15:21:38.045539254 +0900
@@ -17,6 +17,8 @@
 BuildRequires: gcc-c++, make, libtool, httpd-devel, ImageMagick-c++-devel
 Requires: httpd, ImageMagick-c++

+Patch1: mod_uploader-3.1.1-f17fix.patch
+
 %description
 mod_uploader is a file upload application works as Apache module.
 The following features are provided:
@@ -28,6 +30,7 @@

 %prep
 %setup -q -n %{name}-%{version}
+%patch1 -p1

 %{__cat} <<EOF >uploader.conf
 LoadModule uploader_module modules/mod_uploader.so

*1 : これにまでパッチ用意しなくてもいいよね…

リビルド

$  cd ~/rpmbuild/SPECS/

$  rpmbuild -bb mod_uploader.spec

(略)
伸張ファイルの検査中: /usr/lib/rpm/check-files /home/kero/rpmbuild/BUILDROOT/mod_uploader-3.1.1-1.i386
書き込み完了: /home/kero/rpmbuild/RPMS/i686/mod_uploader-3.1.1-1.i686.rpm
書き込み完了: /home/kero/rpmbuild/RPMS/i686/mod_uploader-debuginfo-3.1.1-1.i686.rpm
(略)

$  sudo rpm -e mod_uploader-3.1.1-1.i686

警告: /etc/httpd/conf.d/uploader.conf は /etc/httpd/conf.d/uploader.conf.rpmsave として保存されました。

$  sudo rpm -ivh ~/rpmbuild/RPMS/i686/mod_uploader-3.1.1-1.i686.rpm
uploader.confは必要に応じてrpmsaveから内容を移行すること。

まだだめ

コンパイルは通ったけど、別の所でコケた。
調査中...
Cannot load /etc/httpd/modules/mod_uploader.so into server: /etc/httpd/modules/mod_uploader.so: undefined symbol: _ZN16TemplateExecutorI20ApacheResponseWriterE4execEPKN14TemplateParser4NodeEPPN16TemplateVariable8VariableEj

追記:Fedora20で解決 2013/12/27

こちらの記事をご覧下さい