寻找一位明智的圣人,指出我正朝着正确的方向前进。
我在OS X上使用RVM和brew。我已经确认xcode是最新的并且安装了xcode命令行工具。
我在gem install tiny_tds
/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in 'try_do':编译器无法生成可执行文件。 (RuntimeError)
您必须先安装开发工具 来自/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:461:in'try_link0'
来自/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:476:in'try_link'
来自/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:619:in'try_func'
我向mkmf.rb
添加了一些调试日志记录,以查看当时发生了什么。
对try_do
的调用是在command
参数中传递以下内容:
命令
/usr/local/opt/gcc46/bin/gcc-4.6 -o conftest -I/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/x86_64-darwin13.4.0 -I/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/backward -I/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1 -I. -I/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/include -I/usr/include -I/usr/local/include -I/usr/local/mysql/include -I/opt/X11/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib -L/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib -L/usr/lib -L/usr/local/lib -L/usr/local/mysql/lib -L/opt/X11/lib -L/usr/local/git/lib -L/Users/bdx/.rvm/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -lpthread -ldl -lobjc
在command
参数之后,我发现/usr/local/opt/gcc46/bin/gcc-4.6
不存在。做locate gcc-4.6
找到了我的路径,所以我跑了:ln -s /usr/local/opt/gcc46/bin/gcc-4.6 /usr/local/Library/ENV/4.3/gcc-4.6
并再次尝试,但同样的错误仍然存在。
答案 0 :(得分:0)
我遇到了相同的错误-
您必须先安装开发工具
当尝试安装tiny_tds gem时。检查日志文件mkmf.rb时,我发现错误是:
xcrun:错误:无效的活动开发人员路径(/ Library / Developer / CommandLineTools),缺少xcrun,位于:/ Library / Developer / CommandLineTools / usr / bin / xcrun
运行xcode-select --reset
为我解决了这个问题。