2016-06-30 29 views
6

Ich versuche, libxml-ruby zu installieren. Ich habe libxml2 installiert, libxslt und coreutilslibxml-ruby: Fehler beim Erstellen der gem nativen Erweiterung

Ich habe auch andere Beiträge die Frage in Bezug auf, aber keiner gelöst es für mich.

brew list libxslt

/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/bin/xslt-config 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/bin/xsltproc 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/include/libexslt/ (3 files) 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/include/libxslt/ (21 files) 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/lib/libexslt.0.dylib 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/lib/libxslt.1.dylib 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/lib/pkgconfig/ (2 files) 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/lib/ (5 other files) 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/share/aclocal/libxslt.m4 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/share/doc/ (90 files) 
/opt/boxen/homebrew/Cellar/libxslt/1.1.28_1/share/man/ (3 files) 

brew list libxml2

/opt/boxen/homebrew/Cellar/libxml2/2.9.4/bin/xml2-config 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/bin/xmlcatalog 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/bin/xmllint 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/include/libxml2/ (47 files) 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/lib/libxml2.2.dylib 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/lib/cmake/libxml2/libxml2-config.cmake 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/lib/pkgconfig/libxml-2.0.pc 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/lib/ (3 other files) 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/share/aclocal/libxml.m4 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/share/doc/ (153 files) 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/share/gtk-doc/ (55 files) 
/opt/boxen/homebrew/Cellar/libxml2/2.9.4/share/man/ (4 files) 

gem install libxml-ruby erzeugt den folgenden Fehler:

Building native extensions. This could take a while... 
ERROR: Error installing libxml-ruby: 
    ERROR: Failed to build gem native extension. 

    current directory: /opt/rubies/2.3.0/lib/ruby/gems/2.3.0/gems/libxml-ruby-2.9.0/ext/libxml 
/opt/boxen/rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160630-68248-1qaz7dk.rb extconf.rb 
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 
    --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=/opt/boxen/rbenv/versions/2.3.0/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: 

    /opt/boxen/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-14/2.3.0-static/libxml-ruby-2.9.0/mkmf.log 

extconf failed, exit code 1 

Gem files will remain installed in /opt/boxen/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/libxml-ruby-2.9.0 for inspection. 
Results logged to /opt/boxen/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-14/2.3.0-static/libxml-ruby-2.9.0/gem_make.out 
+0

gelöst zu installieren Haben Sie bestätigen "libxml/xmlversion.h" befindet sich in einem der vier Verzeichnisse, von denen es behauptete, dass es "/ opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include überprüft/libxml2'? –

Antwort

3

Die hohe Ausgabe hier gezeigt wird:

checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no 

Grundsätzlich teilt Ihnen das Installationsprogramm mit, dass es libxml/xmlversion.h nicht finden kann, aber im Allgemeinen kann es Ihren Standort libxml2 wahrscheinlich nicht finden. Es teilt Ihnen mit, in welchen vier Verzeichnissen es sich befindet. Im ersten Schritt überprüfen Sie diese Verzeichnisse, ob libxml2 da ist.

Angenommen, es ist nicht in einem dieser vier Standorte, müssen Sie es finden. Führen Sie find/-name xmlversion.h aus (möglicherweise sudo), um herauszufinden, wo libxml2 installiert wurde. Basierend auf this answer Ich vermute Ihr Problem ist, dass brew es zu /usr/local/Cellar/libxml2 installiert ist, aber Sie sollten das bestätigen. Sobald Sie den Standort haben, können Sie Ihren gem install Befehl manuell darauf zeigen. Etwas wie folgt aus: (aber füllen path/to mit Ihrem tatsächlichen Pfad)

gem install libxml-ruby --with-xml2-dir=/path/to/libxml2 --with-xml2-lib=/path/to/libxml2/lib --with-xml2-include=/path/to/libxml2/include 
+0

Danke, ich habe die Optionen benutzt, um den Edelstein zu installieren und es hat funktioniert. Aber ich brauche diese Optionen in der Bundle-Konfiguration. Ich habe die folgende Konfiguration versucht, aber es hat nicht funktioniert: 'BUNDLE_BUILD__LIBXML-RUBY:" - mit-xml2-lib =/opt/boxen/homebrew/opt/libxml2/lib - mit-xml2-include =/opt/boxen/homebrew/opt/libxml2/include/libxml2 - mit-xslt-lib =/opt/boxen/homebrew/opt/libxslt/lib - mit-xslt-include =/opt/boxen/homebrew/opt/libxslt/Include "' –

+0

@CarlMarkham Ich würde empfehlen, die Bundle-Konfiguration Problem als eine separate Frage zu veröffentlichen, so dass Sie die gesamte Befehls-Terminal und Ausgabe übergeben können. –

+0

Aufbauend auf dieser Antwort. Das Folgende funktionierte für mich. Verwenden Sie "find", um Ihre xmlversion.h Datei zu finden -> gem install libxml-ruby - - mit-xml2-include =/Programme/Xcode.app/Inhalte/Entwickler/Plattformen/MacOSX.platform/Entwickler/SDKs/MacOSX.sdk/usr/include/libxml2/--use-system-libraries – Jay

12

hatte ich ein ähnliches Problem, nachdem ich Gebräu verwendet hatte libxml2

Brew Link, um das Problem brew link --force libxml2

+0

Einzige Lösung, die für mich funktioniert hat – Mark