[xsd-users] Mac OS X need to link against static Boost / xerces_c

Chris Green greenc at fnal.gov
Thu Dec 5 01:18:39 EST 2013


Hi,

We've been building on linux for a while now linked against static Boost 
and xerces_c libraries by starting with the rollup source (e.g. 
xsd-3.3.0-2+dep.tar.bz2) and applying patches of the form:

--- libxsd-frontend/build/import/libxsd-frontend/stub.make	2010-04-27 14:31:24.000000000 -0500
+++ libxsd-frontend/build/import/libxsd-frontend/stub.make	2013-04-24 13:25:00.164019000 -0500
@@ -13,7 +13,7 @@
  
  ifeq ($(libxsd_frontend_installed),y)
  
-$(call export,l: -lxsd-frontend -lfrontend-elements -lcult -lboost_filesystem -lxerces-c,cpp_options: )
+$(call export,l: -lxsd-frontend -lfrontend-elements -lcult $(BOOST_LIB)/libboost_filesystem.a $(XERCESCROOT)/lib/libxerces-c.a /lib64/libpthread.so.0,cpp_options: )
  
  else
  

This works just fine on linux (RHEL5 and 6 derivatives). However, an 
attempt to do something analogous (without the pthread, of course) for a 
build on Mountain Lion produces link errors of the form:

make VERBOSE=1 install_prefix=/Users/greenc/work/cet-is/test-products/cstxsd/v3_3_0_p02a/Darwin64bit+12-gcc48 CXXFLAGS="-O3 -gdwarf-2 -I${BOOST_FQ_DIR}/include -I${XERCESCROOT}/includde" CPPFLAGS="-I${BOOST_FQ_DIR}/include -I${XERCESCROOT}/include" install
ld /Users/greenc/work/cet-is/test-products/cstxsd/v3_3_0_p02a/Darwin64bit+12-gcc48/xsd-3.3.0-2+dep/xsd/xsd/xsd
Undefined symbols for architecture x86_64:
   "_CFRelease", referenced from:
       xercesc_3_1::MacOSUnicodeConverter::upperCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
       xercesc_3_1::MacOSUnicodeConverter::lowerCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
<snip>

I'm by no means an expert compiling on OS X, although it seems that the 
static xerces_c library introduces a need to link against (at least) the 
CoreFoundations framework. Unfortunately I have been unable to decipher 
the make / build-3.0 abstractions to the point where I can get something 
to work. Any suggestions would be appreciated.

I should note that we need to do this because all of our own code is 
built for C++2011 (-std=c++11), and therefore C++2011-compiled versions 
of Boost and xerces_c are what are available in LD_LIBRARY_PATH at the 
time we are invoking xsd -- either xsd has to be compiled statically 
against these libraries or it must be compiled C++2011. We have been 
unable to do the latter thus far, so we've been relying on the former 
solution. With our new need to have this working under Mac OS X however, 
our old solution has not translated in the trivial way we would have liked.

I'm at the limits of my competency in this area, I'm afraid, so pointers 
gratefully received.

Thanks,
Chris.



More information about the xsd-users mailing list