我尝试安装宝石' sinatra-websocket ',但是当我跑步时gem install sinatra-websocket,我收到了这个错误......
ERROR: Failed to build gem native extension
... 随着 ...
C:/Ruby193/bin/ruby.exe extconf.rb
checking for main() in -lc... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby193/bin/ruby
--with-thin_parser-dir
--without-thin_parser-dir
--with-thin_parser-include
--without-thin_parser-include=${thin_parser-dir}/include
--with-thin_parser-lib
--without-thin_parser-lib=${thin_parser-dir}/lib
--with-clib
--without-clib
C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The …Run Code Online (Sandbox Code Playgroud) 我知道这个问题有很多例子。我已经完成了这些答案中的所有内容,但 4 小时后却一无所获。
我正在尝试在 Catalina 10.15.7 上安装 gem 并获得非常流行的
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
Run Code Online (Sandbox Code Playgroud)
有了这个额外的背景
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
current directory: /Users/bmanica/.chefdk/gem/ruby/2.4.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200925-10024-qilctf.rb extconf.rb --with-cflags\=-save-temps\=obj\ -o\ tmp/a.o
Run Code Online (Sandbox Code Playgroud)
通过调用安装时
gem install ffi -- --with-cflags="-save-temps=obj -o tmp/a.o"
Run Code Online (Sandbox Code Playgroud)
绕过 Catalina 严格的权限规则。
我刚刚下载了 XCode 和命令行工具:
> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to …Run Code Online (Sandbox Code Playgroud)