You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Paul Scruby <xm...@scruby.com> on 2003/04/24 16:05:46 UTC

Re: Static library and XML dev question

*Doug Chinnery wrote:*
 > 1) Do a build as you normally would.
 > 2) cd to $XERCESCROOT/obj/[platform]
 > 3) run "ar r libxerces-c.a *.o

I have tried building Xerces with these configurations

  'runConfigure -plinux -c/usr/local/gcc2/bin/gcc -x/usr/local/gcc2/bin/g++ -minmem -nsocket -tnative -rpthread'

and

  'runConfigure -plinux -c/usr/local/gcc2/bin/gcc -x/usr/local/gcc2/bin/g++ -minmem -nsocket -tnative'


and creating a static library from the compiled object files. 

  'ar r libxerces-c.a *.o'


However, when I compile my application, the linker is having some 
problems resolving some of the symbols in the Xecres library.

  /net/homes/pscruby/localsdk/xerces-c-src2_2_0/lib/libxerces-c.a(LinuxPlatformUtils.o): In function `xercesc_2_2::XMLPlatformUtils::makeMutex(void)': 

  LinuxPlatformUtils.o(.text+0x140f): undefined reference to `pthread_mutexattr_init' 

  LinuxPlatformUtils.o(.text+0x141a): undefined reference to `pthread_mutexattr_settype' 

  LinuxPlatformUtils.o(.text+0x14a5): undefined reference to `pthread_mutexattr_destroy' 

  collect2: ld returned 1 exit status 


Can anyone offer some more tips to get a static Xecres library working?

---------------------------------------------------------------------

*
Peter Kryszkiewicz wrote:
*> I've had the same situation you're describing (deriving data classes
 > from DOMNodes) and tried the Java JAXB package with great success. I
 > jump back and forth between C++ and Java, whatever works best for the
 > situation at hand. I used the  Java Data binding package (JAXB) to
 > produce a general 3d interface to a new web site I'm developing using
 > Radiance, POVRay etc for the 3d models. The 3d world stuff I put in an
 > XML file and I use a Schema to validate it. Now here's the neat part.
 > The JAXB process builds classes and datatypes from the Schema, and then
 > writes the output to SVG  and Java3D (two of my output formats) in a
 > pretty smooth fashion. In between I can do all kinds of user input
 > processing and so on. I'm not stuck on either C++ or Java and will
 > eventually convert my classes to C++ if performance issues get in the
 > way, but I find that Java is getting pretty good at
 > RAD for a start.

*Gareth Reakes wrote:
*> I would stick with the SAX solution although I am sure that either would
 > work. I don't think you need the overhead of a lot of the code in the
 > DOMParser. If you want to see an example of DOMNode derivation check out
 > the head of cvs of Pathan. We implement namespace node in just this way
 > although because they are created on the fly the parser does not change.
 >   There is much experience on this list with parer changing so feel free
 > ask questions. You may encounter some problems with the memory
 > management  model. For example, if you want to use the recycle
 > functionality and  allocate memory from the same pool as xerces does for
 > nodes you will need  to increase the number "15" in release and allocate
 > in DOMDocumentImpl.

I looked at JAXB briefly and I have considered doing something similar 
with my schema using XSLT for C++.  However, I want to avoid creating of 
hardcoded classes for each data type, even if they are automatically 
generated.  I would like to use something more generic like DOM, but DOM 
appears to be too heavy to extend beyond simple text Nodes. 

My application is a rendering interface for the visual-effects industry 
so it needs to parse gigabytes of render data for processing on server 
farms.  I need to develop a C++ API, and the performance of the data 
framework is critical so perhaps I should stick to Xerces-c's 
implementation of SAX2.  I think I can remove some of the work with some 
clever use of templates, but I still need to implement wrapper classes 
for each data type in one form or another.  I will let you know how I 
get on.

Thanks,

Paul


Re: Static library and XML dev question

Posted by Sir Woody Hackswell <wo...@hackswell.com>.
On Thu, 24 Apr 2003, Paul Scruby wrote:

> However, when I compile my application, the linker is having some 
> problems resolving some of the symbols in the Xecres library.
> 
>   /net/homes/pscruby/localsdk/xerces-c-src2_2_0/lib/libxerces-c.a(LinuxPlatformUtils.o): In function `xercesc_2_2::XMLPlatformUtils::makeMutex(void)': 
> 
>   LinuxPlatformUtils.o(.text+0x140f): undefined reference to `pthread_mutexattr_init' 
> 
>   LinuxPlatformUtils.o(.text+0x141a): undefined reference to `pthread_mutexattr_settype' 
> 
>   LinuxPlatformUtils.o(.text+0x14a5): undefined reference to `pthread_mutexattr_destroy' 
> 
>   collect2: ld returned 1 exit status 
> 
> 
> Can anyone offer some more tips to get a static Xecres library working?

You need to link against the static pthreads library as well. The libxerces 
static library will only include xerces stuff, nothing else.  You need 
to link your application, libxerces, AND pthreads together. When you link, 
it will be somthing like:

ld -o filename filename.o libxerces.a /path/to/libpthread.a

Or... make a hybrid executable (static xerces, dynamic libc and pthread):

ld -o filename filename.o libxerces.a -lpthread


These commands are probably not exact... I'm just pulling something off the 
top of my head here. ;)


-Richard Balint
 
-----
"The [Hitchhiker's] Guide [to the Galaxy] contains vast amount of 
information on every conceivable concept, much of it completely 
erroneous or actively dangerous." 

That's about the best description of the Internet I've seen! ;)

Sir.Woody@Hackswell.com       http://sir.woody.hackswell.com


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org