Upgrading Mac Libraries

Does anyone know how to upgrade open source libraries bundled with Mac OS X? My specific concern is with the version of libxml installed on this server (2.6.16) which has serious bugs in RELAX NG validation. I want to upgrade that to version 2.6.26.

I do not want to simply add a new version of the library somewhere else. At a minimum I need a library PHP can find. Currently that’s in /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libxml2.dylib and this is the file I need to replace. How do I create that file from the usual PHP sources? Or alternately how do I tell PHP to use a version of libxml from a different location?

3 Responses to “Upgrading Mac Libraries”

  1. Todd Ditchendorf Says:

    I’ve been advised from some people I trust that you should not replace the library in the sdk directory.

    Out of curiousity, I just did a PHP 5.2.0 for Apache 1.3 install using Marc Liyanage’s installer… I noticed that my phpinfo() page claims that php is using a libxml2 located in: /usr/local/php5/. And the latest libxml2 (2.2.6.26) is indeed installed under lib there. I would guess php is using this. My php.ini file seems to be silent on the issue…

  2. Elliotte Rusty Harold Says:

    I just installed PHP 5.2.0 from source. Maybe I should try Marc Liyanage’s installer instead. That might be the simplest option, except “This module will only work with the original Apache web server as shipped by Apple.” and I’m using a custom compiled Apache 2.

  3. greg Says:

    First, I doubt it’s using the lib in the SDK. That’s a symbols-only stub, not a loadable library with code in it.

    Second, libxml2.dylib is a symlink to libxml2.2.dylib, which is the actual stub. Resymlinking libxml2.dylib would solve the problem.

    Third, the real lib is in /usr/lib, and it’s also a symlink. So resymlinking it would let you change which lib PHP is using.

    You could also change PHP’s dylib load path (see ‘man dylib’), so it searches someplace other than /usr/lib first. That way all the other clients of libxml2.dylib won’t be unintentionally redirected to the new lib.

    I’m not sure exactly how you’d resymlink the stub lib in the SDK, or whether that’s even the best approach. Ask on Apple’s Xcode-users list for suggestions. I know that simply resymlinking has been suggested in the past, but there might be better suggestions.

Leave a Reply