仅更新至macOS Mojave,通过brew重新安装了mysql并下载了最新的xcode 9.2。在尝试为旧的Rails项目设置开发环境时,捆绑程序在安装mysql2 gem时崩溃。在开始时,我以为是因为最新的mysql2版本与ruby 1.9不兼容,所以我尝试了:
gem安装mysql2 -v'0.3.17'
我收到了
/Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb 正在检查ruby / thread.h ... * extconf.rb失败* 由于某些原因(可能缺少)而无法创建Makefile 必要的库和/或标头。检查mkmf.log文件以获取更多信息 细节。您可能需要配置选项。
提供的配置选项: --with-opt-dir --with-opt-include --without-opt-include = $ {opt-dir} / include --with-opt-lib --without-opt-lib = $ {opt-dir} / lib --with-make-prog --with-make-prog --srcdir =。 --curdir --ruby = /用户/me/.rvm/rubys/ruby-1.9.3-p125/bin/ruby /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:381:in
中try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:506:in
try_cpp' 来自/Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:931:在block in have_header' from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:790:in
中阻止“ check_for” 来自/Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:在block (2 levels) in postpone' from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in
中打开” 来自/Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:在block in postpone' from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in
中打开” 来自/Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:280:在postpone' from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:789:in
中 来自/Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:930:have_header' from extconf.rb:9:in
'
从/Users/me/.rvm/gems/ruby-1.9.3-p125@mailcatcher/gems/mysql2-0.2.18/ext/mysql2/mkmf.log复制:
“ / usr / bin / gcc-4.2 -o conftest -I / Users / me / .rvm / rubies / ruby-1.9.3-p125 / include / ruby-1.9.1 / x86_64-darwin10.8.0 -I /Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/backward -I / Users / me / .rvm / rubies / ruby-1.9.3-p125 / include /ruby-1.9.1 -I。-I / Users / me / .rvm / usr / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused参数-Wno括号-Wno-long-long -Wno -missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -fno-common -pipe conftest.c -L。-L / Users /me/.rvm/rubies/ruby-1.9.3-p125/lib -L / Users / me / .rvm / usr / lib -L。-L / usr / local / lib -lruby.1.9.1 -lpthread- ldl -lobjc“ 检查的程序是: / *开始 / 1:#include“ ruby.h” 2: 3:int main(){返回0;} / 结尾* /
答案 0 :(得分:3)
听起来您好像缺少XCode命令行工具:
ORDER BY FIND_IN_SET(name, 'b,c,a,d,e');
或mySQL软件包:
如果您还没有自制软件:
ORDER BY FIND_IN_SET(name, 'b','c','a','d','e');
然后安装mysql:
xcode-select --install
我不记得过去曾为我解决过这个问题,但我确定它就是其中之一。
答案 1 :(得分:0)
将我的答案交叉链接到几乎完全相同的问题。我认为可能只是找不到正确的配置路径
sudo gem install mysql2 -- --with-mysql-config=/usr/local/bin/mysql_config
查看答案here
编辑:格式化