You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Christophe GOETZ <gc...@4js.com> on 2000/02/15 16:58:30 UTC

Building a static library with xerces-c

Hi,

Had anyone had any experience of building a static library instead of a shared
one?
I'm trying to do this on linux, but once I try to run my program I get this
error:

"If you are using ICU, then the most likely reason for this failure
is the inability to find the ICU coverter files. The converter files
have the extension .cnv and exist in a directory 'icu/data' relative
to the Xerces-C shared library. If you have installed the converter files
in a different location, you need to set up the environment variable
'ICU_DATA' to point directly to the directory containing the
converter files."

On NT there was no problem to build it statically.


Thanks,
-- 
Christophe GOETZ  -  gch@4js.com
Four J's Development Tools

Re: [Xerces-C] Building a static library with xerces-c

Posted by Michael Mason <mg...@decisionsoft.com>.
Christophe GOETZ wrote:

> Had anyone had any experience of building a static library instead of a shared
> one?

The error you're getting is because the platform specific code looks for
the LD_LIBRARY_PATH environment variable and doesn't work for a static
version. You can get around this by hacking the
src/util/Platforms/Linux/LinuxPlatformUtils.cpp file. Specifically, fix
XMLPlatformUtils::platformInit() so that it returns after setting up its
mutex:

void XMLPlatformUtils::platformInit()
{
    //
    // The atomicOps mutex needs to be created early.
    // Normally, mutexes are created on first use, but there is a
    // circular dependency between compareAndExchange() and
    // mutex creation that must be broken.

    atomicOpsMutex.fHandle = XMLPlatformUtils::makeMutex();
    XMLPlatformUtils::fgLibLocation = NULL;
    return;

    // Leave the rest of the code here if you want
}

You can then build yourself a static library and it'll work. This is a
pretty yukky hack, but there was a thread on this a while back and we
didn't really reach a conclusion. I'm happy doing this for now, and
(when I get some time... ;) will check out the latest code and try to
fix something more satisfactory.

Hope this helps,

Mike.

-- 
Mike Mason, Software Engineer
XML Script Development Team                    Office: 44-1865-203192
http://www.xmlscript.org/                      Mobile: 44-7050-288923