質問

Is it possible to build a version of xerces-c-3.1.dylib that will work with multiple versions of OSX? Ideally, 10.4+, but 10.5+, or even 10.6+ would be OK. How?

I am working with an external (command-line) program (ie not one I control) that requires but does not include the dylib and the goal is to not have to rebuild it on every machine.

The Xerces-C++ project does not have pre-compiled binaries for OSX so I attempted to build one from source (under OSX 10.8.4) by:

  1. Download the latest source code (I used xerces-c-3.1.1.tar.gz)

  2. Run ./configure CFLAGS="-arch x86_64 -mmacosx-version-min=10.4" CXXFLAGS="-arch x86_64 -mmacosx-version-min=10.4"

  3. Run make. The libxerces-c-3.1.dylib file can be found in the hidden folder src/.lib.

  4. Copy this file to /usr/local/lib

This dylab runs fine on 10.8.4 and 10.7.5 machines. Problem is does not work on 10.6.8 (and presumably older) machines. On 10.6.8 I get the following error:

dyld: Library not loaded: /usr/lib/libcurl.4.dylib
  Referenced from: /usr/local/lib/libxerces-c-3.1.dylib
  Reason: Incompatible library version: libxerces-c-3.1.dylib requires
version 7.0.0 or later, but libcurl.4.dylib provides version 6.0.0

Any ideas?

役に立ちましたか?

解決

Found it!

To build a compatibility version of libxerces-c-3.1.dylib:

  1. Download and expand the Xerces 3.1 source tarball from http://xerces.apache.org/xerces-c/download.cgi

  2. from the resulting directory run the configure script using the following options: ./configure --enable-netaccessor-socket CFLAGS="-arch x86_64 -mmacosx-version-min=10.5" CXXFLAGS="-arch x86_64 -mmacosx-version-min=10.5"

  3. Switch to the src directory

  4. Run make

  5. libxerces-c-3.1.dylib can be found under .../src/.libs/ and (at least for my application) should be copied to /usr/local/lib/

I tested this by compiling a version of libxerces-c-3.1.dylib under OSX 10.8.4 using the command line tools from Xcode 4.6.3. I was then able to use the result under 10.6, 10.7, and 10.8 (all the versions I had available). The solution required two changes to the Xerces configuration settings:

  • Specifying a minimum osx compatibility version. I chose 10.5, but have only been able to test back to 10.6

  • Using an alternative to curl for internet access. Specifically using the "sockets" netaccessor seems to work. This was necessary since the version of libcurl.4.dylib included with 10.6 only supports up to 6.0.0, but the version expected when built on a newer system is 7.0.0. For other options see the net accessor table from: the xerces-c build guide

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top