bundleで入れようとしてエラーではまったときにやった対応です。
まずはGemfileを書いて、bundle installを実行。
# /opt/sample/ruby/bin/bundle install --path vendor/bundle fatal: Not a git repository (or any of the parent directories): .git Fetching gem metadata from https://rubygems.org/....... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Using json (1.8.1) Installing mini_portile (0.6.0) Building nokogiri using packaged libraries. Building libxml2-2.8.0 for nokogiri with the following patches applied: - 0001-Fix-parser-local-buffers-size-problems.patch - 0002-Fix-entities-local-buffers-size-problems.patch - 0003-Fix-an-error-in-previous-commit.patch - 0004-Fix-potential-out-of-bound-access.patch - 0005-Detect-excessive-entities-expansion-upon-replacement.patch - 0006-Do-not-fetch-external-parsed-entities.patch - 0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch - 0008-Improve-handling-of-xmlStopParser.patch - 0009-Fix-a-couple-of-return-without-value.patch - 0010-Keep-non-significant-blanks-node-in-HTML-parser.patch - 0011-Do-not-fetch-external-parameter-entities.patch ************************************************************************ IMPORTANT! Nokogiri builds and uses a packaged version of libxml2. If this is a concern for you and you want to use the system library instead, abort this installation process and reinstall nokogiri as follows: gem install nokogiri -- --use-system-libraries If you are using Bundler, tell it to use the option: bundle config build.nokogiri --use-system-libraries bundle install However, note that nokogiri does not necessarily support all versions of libxml2. For example, libxml2-2.9.0 and higher are currently known to be broken and thus unsupported by nokogiri, due to compatibility problems and XPath optimization bugs. ************************************************************************ Building libxslt-1.1.28 for nokogiri with the following patches applied: - 0001-Adding-doc-update-related-to-1.1.28.patch - 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch - 0003-Initialize-pseudo-random-number-generator-with-curre.patch - 0004-EXSLT-function-str-replace-is-broken-as-is.patch - 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch - 0007-Separate-function-for-predicate-matching-in-patterns.patch - 0008-Fix-direct-pattern-matching.patch - 0009-Fix-certain-patterns-with-predicates.patch - 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch - 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch - 0014-Fix-for-bug-436589.patch - 0015-Fix-mkdir-for-mingw.patch ************************************************************************ IMPORTANT! Nokogiri builds and uses a packaged version of libxslt. If this is a concern for you and you want to use the system library instead, abort this installation process and reinstall nokogiri as follows: gem install nokogiri -- --use-system-libraries If you are using Bundler, tell it to use the option: bundle config build.nokogiri --use-system-libraries bundle install ************************************************************************ Installing nokogiri (1.6.3.rc3) Installing aws-sdk (1.49.0) Installing httpclient (2.4.0) Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /opt/sample/ruby/bin/ruby extconf.rb checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes ----- Using mysql_config at /usr/bin/mysql_config ----- checking for mysql.h... yes checking for errmsg.h... yes checking for mysqld_error.h... yes ----- Setting libpath to /usr/lib64 ----- creating Makefile make "DESTDIR=" clean make "DESTDIR=" compiling mysql2_ext.c compiling result.c compiling infile.c compiling client.c linking shared-object mysql2/mysql2.so /usr/bin/ld: cannot find -lmysqlclient collect2: ld はステータス 1 で終了しました make: *** [mysql2.so] エラー 1 make failed, exit code 2 Gem files will remain installed in /opt/sample/ruby/lib64/ruby/gems/2.1.0/gems/mysql2-0.3.16 for inspection. Results logged to /opt/sample/ruby/lib64/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/mysql2-0.3.16/gem_make.out An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.nokogiriもいろいろエラー出てるけど、とりあえずインストールできているので今回はスルー。
mysql2がインストールできずにエラーになりました。
エラー内容を見てみると、`gem install mysql2 -v '0.3.16'`を実行してみろって書いてあります。
で実行してみたところ、やはりエラーとなります。
さらにエラー内容を見ていったところ、
「ld はステータス 1 で終了しました」というメッセージが出ています。
どうやらldでlibmysqlclientが見れてないようです。
libmysqlclientが実際に存在してないのかを確認します。
入れてあるRPMはこんな感じ。(RPMは独自に用意したものですが、名前通りのものをインストールしてます。)
# yum list installed|grep MySQL MySQL-client.x86_64 5.6.14-1.el6 @sample MySQL-devel.x86_64 5.6.14-1.el6 @sample MySQL-shared-compat.x86_64 5.6.14-1.el6 @sample perl-DBD-MySQL.x86_64 4.013-3.el6 @baseライブラリを確認。
# ldconfig -p|grep my libmysqlclient_r.so.16 (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so.16 libmysqlclient_r.so.15 (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so.15 libmysqlclient_r.so.14 (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so.14 libmysqlclient_r.so.12 (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so.12 libmysqlclient.so.16 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.16 libmysqlclient.so.15 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.15 libmysqlclient.so.14 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.14 libmysqlclient.so.12 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.12シンボリックリンクの状態も確認。
libmysqlclient.soが存在してないですね。
# ls -al /usr/lib64/libmys* lrwxrwxrwx 1 root root 24 5月 26 17:27 2014 /usr/lib64/libmysqlclient.so.12 -> libmysqlclient.so.12.0.0 -rwxr-xr-x 1 root root 253888 9月 11 12:12 2013 /usr/lib64/libmysqlclient.so.12.0.0 lrwxrwxrwx 1 root root 24 5月 26 17:27 2014 /usr/lib64/libmysqlclient.so.14 -> libmysqlclient.so.14.0.0 -rwxr-xr-x 1 root root 1242088 9月 11 12:12 2013 /usr/lib64/libmysqlclient.so.14.0.0 lrwxrwxrwx 1 root root 24 5月 26 17:27 2014 /usr/lib64/libmysqlclient.so.15 -> libmysqlclient.so.15.0.0 -rwxr-xr-x 1 root root 2101416 9月 11 12:12 2013 /usr/lib64/libmysqlclient.so.15.0.0 lrwxrwxrwx 1 root root 24 5月 26 17:27 2014 /usr/lib64/libmysqlclient.so.16 -> libmysqlclient.so.16.0.0 -rwxr-xr-x 1 root root 2131920 9月 11 12:12 2013 /usr/lib64/libmysqlclient.so.16.0.0 lrwxrwxrwx 1 root root 26 5月 26 17:27 2014 /usr/lib64/libmysqlclient_r.so.12 -> libmysqlclient_r.so.12.0.0 -rwxr-xr-x 1 root root 262312 9月 11 12:12 2013 /usr/lib64/libmysqlclient_r.so.12.0.0 lrwxrwxrwx 1 root root 26 5月 26 17:27 2014 /usr/lib64/libmysqlclient_r.so.14 -> libmysqlclient_r.so.14.0.0 -rwxr-xr-x 1 root root 1253992 9月 11 12:12 2013 /usr/lib64/libmysqlclient_r.so.14.0.0 lrwxrwxrwx 1 root root 26 5月 26 17:27 2014 /usr/lib64/libmysqlclient_r.so.15 -> libmysqlclient_r.so.15.0.0 -rwxr-xr-x 1 root root 2110184 9月 11 12:12 2013 /usr/lib64/libmysqlclient_r.so.15.0.0 lrwxrwxrwx 1 root root 26 5月 26 17:27 2014 /usr/lib64/libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0 -rwxr-xr-x 1 root root 2110184 9月 11 12:12 2013 /usr/lib64/libmysqlclient_r.so.16.0.0
調べていくと、インストールされている「MySQL-shared-compat.x86_64」はmysqlの旧バージョンと接続するためのもので、
MySQL5.6からは「MySQL-shared.x86_64」を入れないといけないようです。
ということで入れてみました。
# yum list installed|grep MySQL MySQL-client.x86_64 5.6.14-1.el6 @sample MySQL-devel.x86_64 5.6.14-1.el6 @sample MySQL-shared.x86_64 5.6.14-1.el6 @sample MySQL-shared-compat.x86_64 5.6.14-1.el6 @sample perl-DBD-MySQL.x86_64 4.013-3.el6 @base
そして、再度bundle installを実行。
# /opt/sample/ruby/bin/bundle install --path vendor/bundle fatal: Not a git repository (or any of the parent directories): .git Fetching gem metadata from https://rubygems.org/....... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Using json (1.8.1) Using mini_portile (0.6.0) Using nokogiri (1.6.3.rc3) Using aws-sdk (1.49.0) Using httpclient (2.4.0) Installing mysql2 (0.3.16) Installing mysql2-cs-bind (0.0.6) Installing net-ping (1.7.4) Installing parallel (1.1.2) Installing thor (0.19.1) Using bundler (1.5.3) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.ちゃんとインストールできました。
gemだけでは完結しないので、ちゃんと構築しないといけないですね。
参考URL
http://d.hatena.ne.jp/cou929_la/20080718/1216391301
http://y-ken.hatenablog.com/entry/inside-of-libmysqlclient-with-mysql-shared-compat
0 件のコメント:
コメントを投稿