Errors installing some gems on Snow Leopard - libxml2

前端 未结 3 466
一生所求
一生所求 2021-01-12 04:45

After upgrading to Snow Leopard, I found that installing some gems no longer worked, including webrat, mechanize etc. Each time I get this error:

checking f         


        
相关标签:
3条回答
  • 2021-01-12 05:15

    floyd's solution is overkill - I had the same issue and started nuking some of the same /opt/local files related to xml2, but his 'find' command does not reveal the actual libxml2 files in opt/local/lib. It may be that you just need to nuke those.

    Here are my nuked files:

    /opt/local/include/libxml2
    /opt/local/var/db/dports/distfiles/libxml2
    /opt/local/var/db/dports/receipts/libxml2
    /opt/local/var/db/dports/software/libxml2
    /opt/local/var/db/dports/rsync.rsync.darwinports.org_dpupdate_dports/textproc/libxml2
    /opt/local/share/gtk-doc/html/libxml2
    /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/textproc/libxml2
    

    BUT before you try that - just nuke the lib files sudo rm /opt/local/lib/libxml2.*

    When I tried to install after that it got into compiling it all but then barfed with an issue with libz...

    So nuke that in /opt/local/lib sudo rm -rf /opt/local/lib/libz.*

    And it compiles just fine!

    So try nuking the /opt/local/lib libxml2.* and libz.* files, see if it compiles and if not, nuke the /opt/local/includes

    0 讨论(0)
  • 2021-01-12 05:22

    The gems you are trying to install require libxml2. If you're comfortable installing from source, install libxml2.

    You may run into dependency issues where libxml2 depends on a bunch of other packages that you'll need to build and install manually. That's one reason why macports ends up being useful.

    0 讨论(0)
  • 2021-01-12 05:27

    UPDATE

    As stated in another answer, the below solution is 'overkill' because it removes MacPorts from your system, which I thought I had already done earlier. Proceed carefully. There may be a way to use MacPorts to just update the libxml2 install.


    I solved this problem (on my machine at least).

    Once I realized that nothing in that trace suggested the lack of libxml2, but rather a problem with the version being detected, I looked around for confirmation of this fact. Sure enough, the nokogiri website (where many similar bug reports pointed me) states in no uncertain terms that Snow Leopard ships with a good working version of libxml2.

    Thus, I reasoned that I must have installed a version by another means long ago. I would remember if I had installed by hand, so there was really only one option left, frickin' macports.

    $ libxml2-2.7.1 tfwright$ sudo find / -type d -name "libxml2" 
    find: /dev/fd/3: Not a directory
    find: /dev/fd/4: Not a directory
    /Developer/SDKs/MacOSX10.4u.sdk/usr/include/libxml2
    /Developer/SDKs/MacOSX10.5.sdk/usr/include/libxml2
    /Developer/SDKs/MacOSX10.6.sdk/usr/include/libxml2
    /opt/local/include/libxml2
    /opt/local/share/gtk-doc/html/libxml2
    /opt/local/var/macports/distfiles/libxml2
    /opt/local/var/macports/receipts/libxml2
    /opt/local/var/macports/software/libxml2
    /opt/local/var/macports/software/libxml2/2.6.30_0/opt/local/include/libxml2
    /opt/local/var/macports/software/libxml2/2.6.30_0/opt/local/share/gtk-doc/html/libxml2
    /opt/local/var/macports/sources/rsync.macports.org/release/ports/textproc/libxml2
    /usr/include/libxml2
    /usr/share/gtk-doc/html/libxml2
    

    Son of a...just blowing away /opt/local/var/macports, which I tried first of all, didn't seem to fix the problem, so I went to the big guns.

    sudo rm -rf \
    /opt/local \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0 \
    ~/.macports
    

    After which, everything installs fine. that's right. Never trust the recommendations of error messages! Far from needing to reinstall libxml2 with macports, I needed to scrub away all traces of macports from my system, which was haunting me from beyond the trash.

    0 讨论(0)
提交回复
热议问题