libxml-ruby: Failed to build gem native extension

后端 未结 7 1200
逝去的感伤
逝去的感伤 2021-02-07 19:24

I\'m trying to install libxml-ruby. I have installed libxml2, libxslt and coreutils

I have also read other posts rega

7条回答
  •  梦如初夏
    2021-02-07 20:05

    macOS comes with libmxl2 installed, always, there is no need to use a utility like brew to install it first. Yet the headers are not found in /usr/include/libxml but in /usr/include/libxml2/libxml.

    The configure script of the libxml-ruby gem tries to detect if libxml is installed by compiling code that looks like this:

    #include

    But when compiling with the compiler shipped with Xcode, only this code would work:

    #include

    The trick is to let the configure script know where to find the headers. On a macOS system with Xcode installed, the following will work:

    gem install libxml-ruby -v '3.1.0' -- --with-xml2-include=`xcrun --show-sdk-path`/usr/include/libxml2
    

提交回复
热议问题