[xsd-users] multiple definitions errors

Henderson, H.C. (Henk) henk.henderson at tno.nl
Tue Sep 19 10:17:24 EDT 2017


Hello Boris,

Thank you for the suggestions. I think that I have already done what you suggest but I have a couple of questions.
Let me tell you which steps I have done on a system without xsd and xerces on it:

1) 
I first installed the binary xsd-4.0.0-14.el7.x86_64.rpm on my CentOS 7 system that can be found on the  CodeSythesis site with the command

>rpm -Uvh  xsd-4.0.0-14.el7.x86_64.rpm

2)
After the install the xsd program can be found in the directory /usr/bin.
With the xsd program I generate code from my xsd file.
For each xsd I use the command (for example for the file MsdlSimpleTypes.xsd with the result in the output directory msdlGenCode)

> ./xsd cxx-tree --generate-serialization --output-dir msdlGenCode MsdlSimpleTypes.xsd

3)
In this step I include all the generated code from the msdlGenCode directory in my eclipse project so I can use it.

4) 
The I try to compile my code (For my code I have to build a shared object that will be included as a plugin in a standard application) .
The hxx-files of xsd can be found since the rpm installer placed them in the directory  /usr/include and that path is present in my project.
In my generated code there are a lot of includes like cxx/tree/......hxx 

Compiling fails since I also need xerces include files that are not there. In the installer on linux xerces is not included.

And here my first question. How do I know which version of xerces the xsd is using ???

When I go to the CodeSynthesis website (on the page CodeSythesis XSD Download) I find a link to xerces
There I find xerces-c-3.2.0.tar.gz. Since I don't know which version to us I continue with this version, is that OK ???
For this version is no binary available so I try to build that with the instructions given on another page:
========================================================================================================================
Xerces-C++

If you already have Xerces-C++ libraries and development files installed on your system, you can skip this sections and proceed to the next section.

Download the latest Xerces-C++ source release from the Xerces-C++ download page. Then follow these build instructions:

$ cd
$ gzip -d xerces-c-3.1.1.tar.gz
$ tar xf xerces-c-3.1.1.tar
$ cd xerces-c-3.1.1
$ ./configure --disable-threads --disable-network \
--disable-shared CXXFLAGS=-O2 CFLAGS=-O2
$ cd src
$ make

The above command sequence builds Xerces-C++ as a static library. If you would prefer to build a shared library, replace the --disable-shared option with --disable-static.
========================================================================================================================

I followed the suggestions changing 3.1.1 in 3.2.0 and ALSO changed the --disable-shared in --disable-static but after doing the make instruction I cannot find a xerces shared object file.

5)
When I include the directory xerces-c-3.2.0 in my include path of my eclipse project then the code compiles and links. So the result of my program is a shared object but when I run my application with the shared object as plugin then I get the undefined symbol message of xerces. That could be correct since there is no xerces shared library.

6)
After that I also try to use the xerces-c-3.1.1 binary installer (xerces-c-3.1.1-x86-64-linux-gcc-3.4.tar.gz)  that can be found in the archive. Of course after the install I build my program again with the changed xerces include directory  That gives the same undefines  symbol error. In my library path (LD_LIBRARY_PATH) the location of the xerces shared library is added. 

Note that (g++ --version) gives Red Hat version 4.8.5-11 so I am using a different compiler.

Conclusion: What to do to get the correct xerces version that can be used in combination with the xsd I installed ????

In windows that wasn't an issue since there the libraries and include files for xerces are included in the same xsd installer so there is always a combination that works together.

7)
So I also tried to build the xsd myself (see previous mail) to be sure that the same xerces version is used, but maybe that is not needed when I there are two binary installers (one for xsd and one for xerces that belongs to each other. In all cases I could never build a xerces shared library so that method for sure don't work.

Thanks,
Henk

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: vrijdag 15 september 2017 13:59
To: Henderson, H.C. (Henk) <henk.henderson at tno.nl>
Cc: 'xsd-users at codesynthesis.com' <xsd-users at codesynthesis.com>; Berg, T.W. (Tom) van den <tom.vandenberg at tno.nl>
Subject: Re: [xsd-users] multiple definitions errors

Henderson, H.C. (Henk) <henk.henderson at tno.nl> writes:

> Error loading 
> /home/hendersonhc/Tools/eclipse_ws_cpp/LLBMLPlugin/Release
> /libLLBMLPlugin.so /home/hendersonhc/Tools/eclipse_ws_cpp/LLBMLPlugin/
> Release/libLLBMlPlugin.so: undefined symbol:
> _ZKN11xerces_3_213XMLAttDefList14isSerializableEv)

This kind of errors usually mean that you've built your library with one build/version of Xerces-C++ but the library is being picked up from a different build/version.

My suggestion would be to remove any custom builds (including from /usr/local), install the latest version from your distribution's packages, and use that.


> I have followed the build instructions:
> 
> http://www.codesynthesis.com/projects/xsd/extras/build-unix.xhtml

These instructions are for building the XSD compiler itself, not for building your application. I would suggest that you don't try this and instead use the pre-built XSD compiler binary from the download page.

Boris
This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.




More information about the xsd-users mailing list