这是我在CLI中收到的错误消息。我尝试了其他帖子中提供的解决方案,例如sudo gem install twilio-ruby
,但这并不起作用。我正在使用带有Sierra的Mac。我有红宝石2.4。任何帮助都表示赞赏,因为这是周末全面挑战的一小部分!我必须添加更多单词,因为我发布了大部分代码,所以这是漫无目的。
$ gem install libxml-ruby -v '3.0.0'
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
current directory: /Users/davidhalewood/.rvm/gems/ruby-2.4.0/gems/libxml-ruby-3.0.0/ext/libxml
/usr/local/opt/ruby/bin/ruby -r ./siteconf20171006-71383-4z74id.rb extconf.rb
/usr/local/opt/ruby/bin/ruby: warning: shebang line ends with \r may cause a problem
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** 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
--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=/usr/local/Cellar/ruby/2.4.2/bin/$(RUBY_BASE_NAME)
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
extconf failure: need libxml2.
Install the library or try one of the following options to extconf.rb:
--with-xml2-config=/path/to/xml2-config
--with-xml2-dir=/path/to/libxml2
--with-xml2-lib=/path/to/libxml2/lib
--with-xml2-include=/path/to/libxml2/include
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/davidhalewood/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-16/2.4.0/libxml-ruby-3.0.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/davidhalewood/.rvm/gems/ruby-2.4.0/gems/libxml-ruby-3.0.0 for inspection.
Results logged to /Users/davidhalewood/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-16/2.4.0/libxml-ruby-3.0.0/gem_make.out
[davidhalewood:...Projects/takeaway-challenge]$ cat /Users/davidhalewood/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-16/2.4.0/libxml-ruby-3.0.0/mkmf.log
find_header: checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... -------------------- no
"clang -o conftest -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/x86_64-darwin16 -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/ruby/backward -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -L. -L/usr/local/Cellar/ruby/2.4.2/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -lruby.2.4.2 -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"clang -E -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/x86_64-darwin16 -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/ruby/backward -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libxml/xmlversion.h>
/* end */
"clang -E -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/x86_64-darwin16 -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/ruby/backward -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe -I/opt/include/libxml2 conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libxml/xmlversion.h>
/* end */
"clang -E -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/x86_64-darwin16 -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/ruby/backward -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe -I/opt/local/include/libxml2 conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libxml/xmlversion.h>
/* end */
"clang -E -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/x86_64-darwin16 -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/ruby/backward -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe -I/usr/local/include/libxml2 conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libxml/xmlversion.h>
/* end */
"clang -E -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/x86_64-darwin16 -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0/ruby/backward -I/usr/local/Cellar/ruby/2.4.2/include/ruby-2.4.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe -I/usr/include/libxml2 conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
^~~~~~~~~~~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libxml/xmlversion.h>
/* end */
答案 0 :(得分:2)
我在MacOS Sierra上遇到了同样的问题。就我而言,解决方案是更新Xcode工具:
xcode-select --install
答案 1 :(得分:1)
阅读邮件,似乎只需要安装libxml2
。
sudo apt-get install libxml2
答案 2 :(得分:0)
我通过运行解决了这个问题
gem install libxml-ruby -v '3.0.0' -- --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xml2-include=/usr/local/opt/libxml2/include