설치를 설치를 때 Nokogiri 'Gem 기본 확장을 빌드하지'
실행 bundle install
중이며이 오류가 발생합니다.
Building nokogiri using system libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --use-system-libraries
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--help
--clean
--use-system-libraries
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-pkg-config
--without-pkg-config
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-libxslt-config
--without-libxslt-config
--with-pkg-config
--without-pkg-config
--with-exslt-dir
--without-exslt-dir
--with-exslt-include
--without-exslt-include=${exslt-dir}/include
--with-exslt-lib
--without-exslt-lib=${exslt-dir}/lib
--with-libexslt-config
--without-libexslt-config
--with-pkg-config
--without-pkg-config
extconf failed, exit code 1
Gem files will remain installed in /Users/myuser/projectpath/vendor/bundle/ruby/2.0.0/gems/nokogiri-1.6.2.rc2 for inspection.
Results logged to /Users/myuser/projectpath/vendor/bundle/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/nokogiri-1.6.2.rc2/gem_make.out
An error occurred while installing nokogiri (1.6.2.rc2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.2.rc2'` succeeds before bundling.
이것이 어떤 아이디어인가?
편집하다 :
튜토리얼 의 지침에 따라 nokogiri도 설치되는 이상한 점은 gem이 설치되어있는 것입니다. 내가 실행 하면 gem list
, nokogiri (1.6.2.1)
내가 가진,하지만 때 bundle install
그것은 오류를 표시합니다.
이전 조언이 도움이되지 않았다. 여기에 OS 10.9의 솔루션이 있습니다.
brew install libxml2
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"
bundle install
Mavericks에서 해결 방법은 저에게 적합합니다.
gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2
참조 : https://github.com/sparklemotion/nokogiri/issues/1099#issuecomment-43023208
Amazon Linux에서는 두 개의 devel 라이브러리를 설치 한 다음 libxml2의 경로를 지정해야합니다.
$ yum install libxml2-devel libxslt-devel
$ gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/usr/include/libxml2/
나는 또한 nokogiri를 설치하는 데 몇 가지 문제가있었습니다. 다음 패키지를 설치 한 것보다 저에게 효과적이었습니다.
libxslt-dev
libxml2-dev
libruby1.8
libreadline-ruby1.8
libopenssl-ruby
libxml2
정확히 어느 것이 필요했는지 잘 모르겠습니다.
http://nokogiri.org/tutorials/installing_nokogiri.html . 이 링크를 참조하고 nokogiri에 필요한 종속성을 설치하십시오. 그런 다음 이것을 실행
bundle config build.nokogiri --use-system-libraries
bundle install
Yosemite 10.10.1에서이 단계는 도움이되지 않았습니다 (다른 사람에게도 효과가있을 수 있음).
gem install nokogiri -- --use-system-libraries
기본적으로 내 로컬 문제는으로 인한 libxml2
것이기 때문에 다음 해결 방법이 트릭을 수행했습니다.
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2
bundle install
이것은 OS X El Capitan에서 작동했습니다.
brew install libxml2 libxslt libiconv
'brew install libxml2 libxslt libiconv'를 실행 한 후 이미 설치되어 있음을 알 수 있습니다. 걱정하지 마세요. 다시 한 번 확인하는 것이 결코 아프지 않습니다.
sudo gem install nokogiri -v '1.6.7' -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib
bundle install
필요한 경우 nokogiri 버전을 변경하십시오. 예 :
sudo gem install nokogiri -v '1.6.5' -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib
오류는 libxml2 시스템 라이브러리가 오래되었음을 나타냅니다. 버전 2.6.21 이상이 필요합니다.
내 Debian / ubuntu 시스템에서 nokogiri가 나를 위해 컴파일하고 버전 2.9.1이 있음을 알 수 있습니다.
dpkg -l | grep libxml2-dev
ii libxml2-dev:amd64 2.9.1+dfsg1-3 amd64 Development files for the GNOME XML library
여기에는 세 가지 옵션이 있습니다.
OS 패키지 관리자가 최신 버전의 libxml2 라이브러리를 제공하는지 확인하십시오.
최신 libxml2 소스 코드를 다운로드하고 컴파일하고 설치합니다.
- 이전 libxml2 라이브러리에서 작동하는 Gemfile에서 이전 버전의 nokogiri를 수동으로 지정하십시오. nokogiri 변경 로그는 nokogiri 버전 1.4.7에서이 문제가 발생하지 않음을 보여줍니다 (이전 버전을 사용하면 보안 문제에 노출 될 수 있음).
솔루션 # 3의 경우 다음을 gemfile에 넣습니다. gem 'nokogiri', '1.4.7'
Yosemite 10.10에서 다음 단계로 내 문제를 완전히 해결했습니다.
sudo xcode-select -switch /Library/Developer/CommandLineTools
gem uninstall nokogiri libxml-ruby
gem install nokogiri
Mac의 경우 실패한 이유는 최신 Xcode 개발자 도구가 없기 때문입니다. Nokogiri는 이미 libxml2와 함께 패키지화되었습니다. 최신 Xcode 개발자 도구가 없기 때문에 기본 확장을 빌드 할 수 없습니다.
다음을 사용하여 Xcode 개발자 도구를 업데이트하려면 :
xcode-select --install
그리고:
gem install nokogiri
사용하여 수정하면
gem install nokogiri -- --use-system-libraries
나중에 유사한 경고가 표시 될 수 있습니다.
WARNING: Nokogiri was built against LibXML version 2.9.3, but has dynamically loaded 2.9.0
GitHub 의이 스레드는 Nokogiri 1.6.2를 설치하는 데 필요한 트릭을 제공했습니다.
내 ~ / .gitconfig 설정이
autocrlf = input
있습니다. 이 설정을 제거하면 nokogiri 빌드가 성공합니다.
Yosemite 10.10에서이 해결 방법은 저에게 효과적이었습니다.
gem install nokogiri -- --use-system-libraries
#CentOS의 경우 다음을 수행해야했습니다.
gem update --system
yum install libxml2-devel libxslt-devel ruby-devel
gem install nokogiri -- --use-system-libraries
이것은 오래된 스레드이지만 비슷한 문제가 발생했으며 제 경우의 솔루션은 지금까지 게시 된 것과 상당히 달랐습니다.
파헤쳐 본 후 다음 스레드를 찾았습니다. https://github.com/bundler/bundler/issues/2648#issuecomment-25124800
gem에서 사용하는 것과 다른 버전의 루비를 사용하는 번 들러에 대해 이야기합니다.
OP의 붙여 넣기에서 번 들러가 루비의 Mac 시스템 사본을 사용하고 있음을 알 수 있습니다. /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
제 경우에는 보석이 양조장에서 나온다는 것을 알았습니다. which gem
준 /usr/local/bin/gem
에 심볼릭 링크한다 /Cellar/ruby/2.3.3/bin/gem
. 내 생각 엔 OP의 경우가 같았다는 것입니다.
따라서 gem과 bundler는 동일한 루비 설치에서 작동하지 않으므로 OP가 다음과 같이 보는 이유를 설명합니다.
gem list를 실행하면 nokogiri (1.6.2.1)가 있지만 bundle install을 실행하면 오류가 표시됩니다.
제 경우에는 간단히 실행 gem install bundler
하여 번 들러가 루비의 양조 버전을 사용하기 시작했고 모든 문제가 사라졌습니다.
OSX 10.12 (Sierra)에서 이것은 나를 위해 일했습니다.
gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2
나는이 정확한 문제가 있었다. Mac에서 Rails 환경을 실행합니다. 요세미티에서 시에라로 업그레이드 한 후에는 그것이 시작되었을 때라고 믿습니다.
문제를 해결하기 위해 xcode command line tools
. Sierra 업그레이드로 인해 제거되었는지 또는 무엇인지 모르겠습니다.
xcode-select --install
(이 설치됩니다 xcode command line tools
)
또한 또 다른 증상 .. git status와 같은 것들이 작동하지 않습니다. 이 후 나는 rails new appname 을 할 수 있었고 괜찮 았 습니다.
libxml2를 설치하면이 문제를 해결할 수 있습니다.
brew install libxml2
bundle config build.nokogiri --use-system-libraries
bundle install
'ProgramingTip' 카테고리의 다른 글
UITextview의 줄 수 제한 (0) | 2020.11.12 |
---|---|
iOS에서 작동하지 않는 jQuery 클릭 이벤트 (0) | 2020.11.12 |
결합 및 유동 (0) | 2020.11.12 |
활동을 만들 때 EditText가 늘어나를 맞추지 않게 만드는 방법 (0) | 2020.11.12 |
연관에 대한 우수 사례 (0) | 2020.11.12 |