昨日 の時点で、CentOS 7.1のコンテナーなら問題なくyumでインストールして動作確認ができることはわかりました。しかしまあ、勤め先の本番環境はほとんどがCentOS 6.xなので、どうせならそっちで動く形式にしておきたい(特に、MySQL RouterのスタイルからしてAPサーバーに載せるのが具合がいい気がするので)
SPECファイルの.in を見ている限り、systemdがない環境でもちゃんと選んでビルドしてくれそうではあったので頑張ってみることにした。
TL;DR
という訳で色々試してるんですが、rpmのビルドには失敗します。しょんぼり。誰か判ったら教えてください。バイナリー.tar.gzっぽいのはできたのでそろそろ諦めます。
CentOS 7.1ではビルドに成功する
$ rpm -i mysql-router-2.0.2-1.el7.src.rpm $ cd rpmbuild/SPECS/ $ rpmbuild -bb mysql-router.spec .. Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/mysql-router-2.0.2-1.el7.centos.x86_64 Wrote: /root/rpmbuild/RPMS/x86_64/mysql-router-2.0.2-1.el7.centos.x86_64.rpm Wrote: /root/rpmbuild/RPMS/x86_64/mysql-router-debuginfo-2.0.2-1.el7.centos.x86_64.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.cku59B + umask 022 + cd /root/rpmbuild/BUILD + cd mysql-router-2.0.2 + rm -rf /root/rpmbuild/BUILDROOT/mysql-router-2.0.2-1.el7.centos.x86_64 + exit 0
まあ、当然ですが上手くいきました。
CentOS 6.6だとダメ
$ rpm -i mysql-router-2.0.2-1.el7.src.rpm $ cd rpmbuild/SPECS/ $ scl enable devtoolset-2 "rpmbuild -ba mysql-router.spec" .. Processing files: mysql-router-2.0.2-1.el6.x86_64 error: File not found: /root/rpmbuild/BUILDROOT/mysql-router-2.0.2-1.el6.x86_64/etc/init.d/mysqlrouter Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.q5xdpa + umask 022 + cd /root/rpmbuild/BUILD + cd mysql-router-2.0.2 + DOCDIR=/root/rpmbuild/BUILDROOT/mysql-router-2.0.2-1.el6.x86_64/usr/share/doc/mysql-router-2.0.2 + export DOCDIR + rm -rf /root/rpmbuild/BUILDROOT/mysql-router-2.0.2-1.el6.x86_64/usr/share/doc/mysql-router-2.0.2 + /bin/mkdir -p /root/rpmbuild/BUILDROOT/mysql-router-2.0.2-1.el6.x86_64/usr/share/doc/mysql-router-2.0.2 + cp -pr License.txt README.txt /root/rpmbuild/BUILDROOT/mysql-router-2.0.2-1.el6.x86_64/usr/share/doc/mysql-router-2.0.2 + exit 0 RPM build errors: File not found: /root/rpmbuild/BUILDROOT/mysql-router-2.0.2-1.el6.x86_64/etc/init.d/mysqlrouter
明らかにsystemdを使わない判定の方に転がって、sysvinitスタイルのものが見付からないとかなんとか言ってる。
ソースを落としてみるとpackagingディレクトリーにbuild_rpm.shとかいうのもあってそっちも試してみたけれど、なんかこっちは最終的にmysql-router-commercial-*.tar.gzを要求されてビルドが転ける。
仕方がないのでバイナリー.tar.gz版ぽいものをビルド
$ scl enable devtoolset-2 "cmake -DINSTALL_LAYOUT=STANDALONE -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-router" $ make $ VERBOSE=1 sudo make install .. Install the project... /usr/bin/cmake -P cmake_install.cmake -- Install configuration: "" -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/config_parser.h -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/plugin.h -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/filesystem.h -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/loader.h -- Up-to-date: /usr/local/mysql-router/lib/libmysqlharness.a -- Installing: /usr/local/mysql-router/lib/libmysqlharness.so.0 -- Up-to-date: /usr/local/mysql-router/lib/libmysqlharness.so -- Installing: /usr/local/mysql-router/lib/mysqlrouter/logger.so -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/logger.h -- Installing: /usr/local/mysql-router/lib/mysqlrouter/keepalive.so -- Installing: /usr/local/mysql-router/lib/mysqlrouter/fabric_cache.so -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/fabric_cache.h -- Installing: /usr/local/mysql-router/lib/mysqlrouter/routing.so -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/routing.h -- Installing: /usr/local/mysql-router/docs/README.txt -- Installing: /usr/local/mysql-router/docs/License.txt -- Installing: /usr/local/mysql-router/docs/sample_mysqlrouter.ini -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/datatypes.h -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/utils.h -- Up-to-date: /usr/local/mysql-router/include/mysql/mysqlrouter/plugin_config.h -- Installing: /usr/local/mysql-router/bin/mysqlrouter -- Installing: /usr/local/mysql-router/lib/libmysqlrouter.so.1 -- Up-to-date: /usr/local/mysql-router/lib/libmysqlrouter.so
これで/usr/lcoal/mysql-routerの下に全部押し込められた気がする。
他のコンテナーにコピーして展開してみる。
$ tar -C /usr/local -cf mysql-router-2.0.2.glibc12.tar.gz mysql-router/ $ docker cp build:/root/mysql-router-2.0.2.glibc12.tar.gz ./ $ docker run -v /home/yoku0825/mysql-router-2.0.2.glibc12.tar.gz:/root/mysql-router-2.0.2.glibc12.tar.gz -it centos:centos6.6 bash # /usr/local/mysql-router/bin/mysqlrouter bin/mysqlrouter: error while loading shared libraries: libmysqlrouter.so.1: cannot open shared object file: No such file or directory # LD_LIBRARY_PATH=/usr/local/mysql-router/lib /usr/local/mysql-router/bin/mysqlrouter --help Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Start MySQL Router. Configuration read from the following files in the given order (enclosed in parentheses means not available for reading): (./mysqlrouter.ini) (/root/.mysqlrouter.ini) Usage: mysqlrouter [-v|--version] [-h|--help] [-c|--config=] [-a|--extra-config= ] Options: -v, --version Display version information and exit. -h, --help Display this help and exit. -c , --config Only read configuration from given file. -a , --extra-config Read this file after configuration files are read from either default locations or from files specified by the --config option.
ライブラリーパスさえ通せば動きそうだった。つらくない!
0 件のコメント :
コメントを投稿