2016-11-20 53 views
0

大家好我是新来的导轨,我安装了一切ruby rails mysql和一切都做得很好,健康,当我试图创建一个新的应用程序'rails new blog'for例如一切都做得很好,但每当我添加'-d mysql'它会发现并知道一切都安装好错误使用mysql db创建新的应用程序导轨时出错

Aikers-MBP:〜Aiker $ brew install mysql Warning:mysql-5.7.16 already installed Aikers-MBP:〜爱克尔$

在这里,我试图安装

的安装mysql2(0.4.5)时发生错误,并且Bundler无法继续。 确保gem install mysql2 -v '0.4.5'成功捆绑之前。 Aikers-MBP:kar Aiker $ rake db create 无法在您的Gemfile中列出的或本机上可用的任何Gem源中找到gem'rails(= 4.2.6)'。 运行bundle install安装缺失的宝石。 Aikers-MBP:kar Aiker $ gem install mysql2 -v'0.4.5' 构建原生扩展。这可能需要一段时间... 错误:安装mysql2时出错: 错误:无法构建gem本机扩展。

+0

当它提供错误“无法构建gem原生扩展名”时,它会给出一个长错误。请复制粘贴错误,以便我们知道系统上缺少的内容。 –

+0

是的,这是整个错误 – Aiker

回答

0

您的系统无法找到存在于OpenSSL中的lssl库。为了解决这个问题,你需要运行:

brew install openssl 

在此之后尝试安装mysql2宝石。如果这仍然失败,那么你可能需要通过运行重新安装的Xcode命令行工具:

xcode-select --install 

希望这能解决您的安装问题。 :)

+0

这真的解决了这个问题非常感谢你:) – Aiker

+0

乐意帮助@Aiker –

0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    current directory: /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5/ext/mysql2 
/Users/Aiker/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20161121-68854-12pc3sf.rb extconf.rb 
checking for rb_absint_size()... yes 
checking for rb_absint_singlebit_p()... yes 
checking for ruby/thread.h... yes 
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes 
checking for rb_thread_blocking_region()... no 
checking for rb_wait_for_single_fd()... yes 
checking for rb_hash_dup()... yes 
checking for rb_intern3()... yes 
checking for rb_big_cmp()... yes 
----- 
Using mysql_config at /usr/local/bin/mysql_config 
----- 
checking for mysql.h... yes 
checking for SSL_MODE_DISABLED in mysql.h... yes 
checking for SSL_MODE_PREFERRED in mysql.h... yes 
checking for SSL_MODE_REQUIRED in mysql.h... yes 
checking for SSL_MODE_VERIFY_CA in mysql.h... yes 
checking for SSL_MODE_VERIFY_IDENTITY in 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.7.16/lib 
----- 
creating Makefile 

To see why this extension failed to compile, please check the mkmf.log which can be found here: 

    /Users/Aiker/Desktop/blog/vendor/bundle/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/mkmf.log 

current directory: /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5/ext/mysql2 
make "DESTDIR=" clean 

current directory: /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5/ext/mysql2 
make "DESTDIR=" 
compiling client.c 
compiling infile.c 
compiling mysql2_ext.c 
compiling result.c 
compiling statement.c 
linking shared-object mysql2/mysql2.bundle 
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/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5 for inspection. 
Results logged to /Users/Aiker/Desktop/blog/vendor/bundle/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/gem_make.out 

An error occurred while installing mysql2 (0.4.5), and Bundler cannot continue. 
Make sure that `gem install mysql2 -v '0.4.5'` succeeds before bundling. 
相关问题