我正在尝试安装一个开源 Rails 3.2.21 应用程序,该应用程序使用mysql2
宝石,但是当我尝试运行bundle
命令我收到以下错误:
Fetching: mysql2-0.3.18.gem (100%)
Building native extensions. This could take a while...
p
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/my_username/.rvm/rubies/ruby-2.1.2/bin/ruby -r ./siteconf20150614-72129-orqsb7.rb 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/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
-----
-----
Setting libpath to /usr/local/Cellar/mysql/5.6.25/lib
-----
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
linking shared-object mysql2/mysql2.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/my_username/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/mysql2-0.3.18 for inspection.
Results logged to /Users/my_username/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/extensions/x86
我尝试卸载每个版本mysql
我通过自制程序安装并重新安装它们,如下所示:
brew uninstall --force mysql && brew install mysql
然后运行:
sudo gem install mysql2
正如此处提出的许多类似问题所建议的那样,但它仍然会导致与上面相同的错误。
请问有人可以提供有关如何启动和运行此程序的指导吗?
对于仍然遇到该问题的任何人:
当您通过brew安装openssl时,您应该收到以下消息:
Apple 已弃用 OpenSSL,转而使用自己的 TLS 和加密库
一般来说,这不会给您带来任何后果。如果你建立你的
自己的软件,它需要这个公式,你需要添加到你的
构建变量:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS:-I/usr/local/opt/openssl/include
PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig
您可以通过运行以下命令来设置这些构建标志(对于本地应用程序):
bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
这对我有用。
See 捆绑器的文档 http://bundler.io/v1.13/man/bundle-config.1.html了解更多信息。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)