Mac 사용자 및 경고 : Nokogiri는 LibXML 버전 2.7.8에 대해 빌드되었지만 2.7.3을 동적으로로드했습니다.
나는 온갖 종류의 조사를하고 여러 가지 시도를했습니다. 이 질문에 여러 번 답변을 받았지만 제안 된 솔루션 중 어느 것도 저에게 효과가 없다는 것을 알고 있습니다.
Lion으로 업그레이드 한 후 Ruby에서 세그멘테이션 오류가 발생합니다. 노코 기리라고 꽤 확신합니다. 그래서 Homebrew를 통해 libxml2를 설치했습니다. 나는 달렸다 brew link libxml2
. 그런 다음 해당 버전의 라이브러리를 사용하여 Nokogiri를 다시 설치했습니다.
증거를 위해 :
$ nokogiri -v
# Nokogiri (1.5.0)
---
warnings: []
nokogiri: 1.5.0
ruby:
version: 1.9.2
platform: x86_64-darwin11.0.0
description: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
engine: ruby
libxml:
binding: extension
compiled: 2.7.8
loaded: 2.7.8
이미 gemfile의 맨 위에 Nokogiri를 포함 시켰으며 환경 파일에도 필요했습니다. 왜 아직도 그 경고를 받고 있는지 모르겠습니다.
올바른 버전의 libxml2를로드하고 있는지 확인하기위한 제안이나 아이디어가 있습니까?
이 경고를 통해 아침의 더 좋은 시간을 보냈습니다. 이 수정 사항은 Mac OS Lion 사용자를위한 것입니다. 위의 수정 사용
bundle config build.nokogiri --with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib --with-xslt-dir=/opt/local
MacPorts를 통해 libxml2가 설치된 Snow Leopard 용입니다.
Lion을 사용하면 libxml2가 부트 스트랩 프로세스의 일부로로드됩니다. libxml2 Nokogiri가 가리키는 것과 관계없이 libxml2에 대한 Lion 시스템 기본 라이브러리가 런타임에 사용됩니다. Lion은 /usr
(아님 /usr/local
)에 있는 libxml2.2.7.3을 사용합니다 .
다른 많은 곳에서 언급했듯이 경고를 무시할 수 있습니다. 나처럼 경고가 당신을 미치게 만든다면 다음과 같이 할 수 있습니다.
bundle config build.nokogiri --with-xml2-dir=/usr --with-xslt-dir=/opt/local --with-iconv-dir=/opt/local
흥미롭게도 nokogiri -v
명령 줄에 입력 하면 반대 경고가 표시됩니다.
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
이것은 libxml2가로드되는 방법에 더 많은 것이 있음을 시사합니다. Ruby와 Rails는 시스템로드 된 libxml2를 사용하고 명령 줄은 환경 경로에서 libxml2를 사용합니다. 어쨌든 이것은 나를 위해 오류를 침묵시킵니다.
다시 말하겠습니다 – 이것은 오직 Lion만을위한 것입니다. 이전 수정 사항은 Snow Leopard에서 작동합니다.
이것이 답의 끝입니다. 여기서 그만 읽으세요.
좋아, 당신은 읽는 것을 멈추지 않았습니다. 음 ...
권장하지 않음 !!!!!!
경고를 받았습니다. 에서 찾은 libxml2를 비활성화하여 Mac OSX가 부트 스트랩에서 libxml2 라이브러리를로드하고 있는지 확인할 수 있습니다 /usr/lib
. 의 모든 버전을 복사하는 것과 같은 작업 libxml2*.dylib
을 수행하십시오 libxml2*.dylib.old
(내 컴퓨터에서는 libxml2.2.7.3
, libxml2.2
및 libxml2
).
이 작업을 수행 한 후 Nokogiri를 실행해도 오류가 발생하지 않습니다. 이로드 libxml2를 찾을 수없는 지금은 결국 발견, 환경 경로를 따를 것이다 때문이다 libxml2.2.7.8
에서 /opt/local
.
그러나 이전 libxml 파일을 다시 복사 할 수 없습니다. 이는 OS에 부트 스트랩에로드 된 libxml2가 필요하기 때문입니다.
전원을 껐다가 다시 켜면 컴퓨터가 손상됩니다. 로그인 화면이 중단되고 중단됩니다. 전원을 끄고 전원 단일 사용자 모드에서 다시 (보류 Command- S재부팅 동안). 부트 스트랩이 발생하는 것을 볼 수 있습니다. 낮고 보라, libxml2를로드 할 수 없다는 오류가 발생하고 작동이 중지됩니다.
전원을 껐다가 다시 켜십시오. 이번에는 복구 모드로 부팅합니다 (보류 Command- R또는 Option복구 디스크 선택). 복구 모드에서 터미널 ( utilities/terminal
)을 엽니 다 . /usr/lib
HD에 마운트 하고 (try /Volumes/Macintosh\ HD/usr/lib
) libxml2 파일을 다시 복사합니다. 재부팅하면 모두 괜찮습니다.
를 사용하여 Nokogiri를 설치 한 경우 gem install nokogiri
실행 gem pristine nokogiri
하여 gem의 C 확장을 다시 컴파일 하여이 경고를 해결할 수 있습니다 .
를 사용하여 Nokogiri를 설치 한 경우 Bundler가 설치된 위치에 관계없이 gem의 C 확장을 다시 컴파일 bundle install
하여이 경고를 해결할 수 있습니다 bundle exec gem pristine nokogiri
.
homebrew 및 bundler를 사용하는 경우이 문제를 해결하려면을 gem 'nokogiri'
맨 위에 추가 Gemfile
한 후 다음 명령을 실행 하십시오 .
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew install libxslt
bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
bundle install
번 들러를 사용하지 않는 경우 다음 명령을 대신 실행하십시오.
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew install libxslt
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
In your app, you should require nokogiri first, to force the app to load the dynamic libxml2 library instead of the older system version of libxml2 loaded by gems that failed to specify which library to load.
None of this worked for me.
I had libxml2 installed at a later version (2.7.8) with brew. This caused nokogiri to compile against it and the later problems. Solution, remove it, then build, then install if desired.
Here's what worked:
brew uninstall libxml2
(if previously installed)gem uninstall nokogiri
gem install nokogiri
brew install libxml2
(optional)
The solution (for me) after updating to Mountain Lion was much simplier:
gem uninstall nokogiri
# (and ignore the warnings about dependencies)
gem install nokogiri
As per the comment from patrickmcgraw above, simply putting nokogiri as the first entry in my Gemfile worked for me. I'm putting it as a separate answer because the original comment has been buried.
source 'http://rubygems.org'
gem 'nokogiri'
gem 'rails', '3.0.20'
etc...
Bundler has options to set the default build locations. So for instance, with libxml2 installed via macports:
$ bundle config build.nokogiri --with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib --with-xslt-dir=/opt/local
After doing this and bundle install
, the warning went away.
There's also some helpful examples for setting build options on the nokogiri wiki.
Looks like you have updated your system libraries after installing the gem, so you have to update Nokogiri. To use the current lib version:
gem install nokogiri -- --use-system-libraries
I had similar problem and just solved this way:
In my case, I have RVM installed, and I had @global and @project gem sets. Both of them had nokogiri installed and one of them had built with with different libxml.
Rebuilding both of them (I have reason to do this) solved the problem.
Hope this helps..
gem uninstall nokogiri
bundle #install nokogiri again
If that fails with "libxml2 is missing." and you see gems/nokogiri-1.5.0/ext/nokogiri/mkmf.log trying to use "/usr/bin/gcc-4.2 ...", then you're missing /usr/bin/gcc-4.2
Solution:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Before:
$ ll /usr/bin/gcc*
lrwxr-xr-x 1 root wheel 12 Jan 15 00:16 /usr/bin/gcc -> llvm-gcc-4.2
After:
$ ll /usr/bin/gcc*
lrwxr-xr-x 1 root wheel 12 Jan 15 00:16 /usr/bin/gcc -> llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 12 Jan 15 21:07 /usr/bin/gcc-4.2 -> /usr/bin/gcc
If you're really missing libxml2 libxslt, then
brew update
brew install libxml2 libxslt
brew link libxml2 libxslt
bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2/ --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib/ --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
bundle
FYI: I'm running Mountain Lion with brew, and bundler.
gem install libxml-ruby helps me
I actually had 2 versions of libxml installed, one from source, one from an RPM.
The following is my complete solution
I uninstalled source (from the source directory)
sudo make uninstall
Remove bundles
rm -rf ~/.bundle ~/.bundler
Updated LD (might have to do this as root, not sudo)
sudo ldconfig
Then reinstalled the bundle
bundle install
Just ran into this myself (OS X Lion 10.7.5). My exact message was: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.3
I tried a few suggestions mentioned here, none worked, but this did:
gem install nokogiri -- --with-xml2-dir=/usr --with-xslt-dir=/opt/local --with-iconv-dir=/opt/local
The explanation is: "This happens because the Lion system default libxml2 (loaded at bootstrap) is used, regardless of which libxml2 Nokogiri was built against."
Credits to: https://coderwall.com/p/o5ewia
OS : Maverick 10.9.3
Ruby 1.9.3
WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.9.0
My solution:
gem uninstall nokogiri
brew update
cd /usr/local
brew versions libxml2
git checkout 5dd45d7 /usr/local/Library/Formula/libxml2.rb # libxml version 2.9.0
brew install libxml2
bundle install or gem install nokogiri -v "1.5.11"
Hope this help
If you have this message and your nokogiri is out-of-date with the version available from the gem source, simply run bundle update nokogiri
to get the new code and recompile. Your error should go away.
'programing tip' 카테고리의 다른 글
List를 구현하는 Set을 보존하는 게재 신청서가 있습니까? (0) | 2020.09.23 |
---|---|
Python과 Numpy를 사용하여 r- 제곱을 어떻게 계산합니까? (0) | 2020.09.23 |
내 레일 애플리케이션에 대한 uuid를 생성해야합니다. (0) | 2020.09.23 |
snackBar의 레이아웃을 사용자 지정하는 방법은 무엇입니까? (0) | 2020.09.23 |
액체 템플릿 태그를 이스케이프하는 방법? (0) | 2020.09.23 |