

























|
 |  |  |  | Building on Windows using Microsoft Visual C++ |  |  |  |  |
| |
Xerces-C++ source distribution comes with Microsoft Visual C++ projects and solutions to
help you build Xerces-C++. The following describes the steps you need
to build Xerces-C++.
 |  |  |  | Building Xerces-C++ library |  |  |  |  |
| |
To build Xerces-C++ from the source distribution (using MSVC), you will
need to open the solution containing the project. If you are
building your application, you may want to add the Xerces-C++
project inside your application's solution.
The solutions containing the Xerces-C++ project files and
all other samples are in the following sub-directories in the
xerces-c-src_2_8_0 directory:
 |  |  |  |
(For VC6) Projects\Win32\VC6\xerces-all\xerces-all.dsw
(For VC7.1) Projects\Win32\VC7.1\xerces-all\xerces-all.sln
(For VC8) Projects\Win32\VC8\xerces-all\xerces-all.sln
|  |  |  |  |
Once you have the solution open, you need to build the
project marked XercesLib. You can select
Debug/Release, Static/DLL, and, for VC8, 32/64 bit
builds using the Configuration Manager dialog.
If you want to include the Xerces-C++ project into
your own solution, you need to pick up:
 |  |  |  |
(For VC6) Projects\Win32\VC6\xerces-all\XercesLib\XercesLib.dsp
(For VC7.1) Projects\Win32\VC7.1\xerces-all\XercesLib\XercesLib.vcproj
(For VC8) Projects\Win32\VC8\xerces-all\XercesLib\XercesLib.vcproj
|  |  |  |  |
You must make sure that you are linking your application with
the xerces-c_2.lib library (or Debug/Static version of it
and also make sure that the associated DLL is somewhere in your
path.
 | If you are linking your application to a static library,
then you will need to compile your application with the
XML_LIBRARY preprocessor define in order
to turn off the DLL import/export mechanism. This is
also the case for the Mingw-msys platform. |
 | If you are working on the AlphaWorks version which uses ICU,
you must have the ICU data DLL named icudata.dll
available from your path setting. For finding out where you
can get ICU from and build it, look at the
How to Build ICU. |
 | If the library is built with the ICU message loader,
or message catalog loader, then you need to make sure
the XERCESC_NLS_HOME environment variable points to the
$XERCESCROOT/msg directory where the message files reside. |
|
| |
If you are using the source package, inside the same solution
(xerces-all.dsw or xerces-all.sln), you'll find several other
projects. These are for the samples. Select all the samples
and right click on the selection. Then choose "Build (selection
only)" to build all the samples in one shot.
|
|
 |  |  |  | Building on UNIX/Linux/Mac OS X platforms |  |  |  |  |
| |
Xerces-C++ uses
GNU make
to build the libraries and samples. You must first make sure you
have GNU make installed on your system before proceeding. On some
platforms GNU make is called gmake instead of make.
If you do not have GNU make, ask your system administrator
to get it for you.
Do not jump into the build directly before reading this.
Spending some time reading the following instructions will save
you a lot of wasted time and support-related e-mail communication.
The Xerces-C++ build instructions are a little different from
normal product builds. Specifically, there are some wrapper-scripts
that have been written to make life easier for you. You are free
not to use these scripts and use the configure script and
GNU Make directly, but we want to make sure you
know what you are by-passing
and what risks you are taking. So read the following instructions
carefully before attempting to build it yourself.
Besides having all necessary build tools, you also need to know what
compilers we have tested Xerces-C++ on. The following table lists the
relevant platforms and compilers.
Operating System
| Compiler
|
32-bit
|
Windows x86
| MS Visual C++ 7.1 (2003)
|
Windows x86
| MS Visual C++ 8.0 (2005)
|
Linux x86
| GCC 3.4.x or later
|
Solaris 10 x86
| GCC 3.4.x or later
|
Solaris 10 x86
| Sun C++ 5.7 (Studio 10) or later
|
Solaris 10 SPARC
| GCC 3.4.x or later
|
Solaris 10 SPARC
| Sun C++ 5.7 (Studio 10) or later
|
AIX 5.3 PowerPC
| IBM XL C++ 7.0 or later
|
HP-UX 11i PA-RISC
| HP aCC A.03.x
|
HP-UX 11i IA-64
| HP aCC A.06.x
|
MacOS X 10.4 "Tiger" x86
| GCC 4.0.x (Xcode 2.x) or later
|
MacOS X 10.4 "Tiger" PowerPC
| GCC 4.0.x (Xcode 2.x) or later
|
64-bit
|
Windows x86-64
| MS Visual C++ 8.0 (2005)
|
Linux x86-64
| GCC 3.4.x or later
|
Solaris 10 x86-64
| GCC 3.4.x or later
|
Solaris 10 x86-64
| Sun C++ 5.7 (Studio 10) or later
|
Solaris 10 SPARC
| GCC 3.4.x or later
|
Solaris 10 SPARC
| Sun C++ 5.7 (Studio 10) or later
|
AIX 5.3 PowerPC
| IBM XL C++ 7.0 or later
|
HP-UX 11i PA-RISC
| HP aCC A.03.x
|
HP-UX 11i IA-64
| HP aCC A.06.x
|
While older platforms/compilers will most likely work, if you are not using any of
these compilers, you are taking a calculated risk
by exploring untested grounds. Your effort in making Xerces-C++ work on
new platforms/compilers is greatly appreciated and any problems you face can be addressed
on the Xerces-C++ mailing lists.
Differences between the UNIX platforms: The description below is
generic, but as every programmer is aware, there are minor differences
within the various UNIX flavors the world has been bestowed with.
The one difference that you need to watch out in the discussion below,
pertains to the system environment variable for finding libraries.
On Linux and Solaris, the environment variable name is called
LD_LIBRARY_PATH , on AIX it is LIBPATH ,
on Mac OS X it is DYLD_LIBRARY_PATH ,
while on HP-UX it is SHLIB_PATH . The following
discussion assumes you are working on Linux, but it is with subtle
understanding that you know how to interpret it for the other UNIX flavors.
 | If you wish to build Xerces-C++ with ICU,
look at the Building Xerces-C++ with ICU.
It tells you where you can get ICU and how to build Xerces-C++ with it. |
 |  |  |  | Building Xerces-C++ library |  |  |  |  |
| |
As mentioned earlier, to build Xerces-C++ from the source distribution,
you will need GNU make.
If you look into the src/xercesc sub-directory in xerces-c-src_2_8_0,
you will notice the familiar configure script. It is tempting to run
this script directly as is normally the case, but wait a minute.
Even if you are
using the default compilers like
gcc and
g++
you need to export a few more
environment variables before you can invoke configure.
Rather than make you to figure out what strange environment
variables you need to use, we have provided you with a wrapper
script that does the job for you. All you need to do is tell
the script what your compiler is, and what options you are going to use
inside your build, and the script does everything for you. Here
is what the script takes as input:
 |  |  |  |
runConfigure: Helper script to run "configure" for one of the
supported platforms
Usage: runConfigure "options"
where options may be any of the following:
-p <platform> (accepts 'aix', 'beos', 'linux', 'freebsd',
'netbsd', 'solaris', 'hp-10', 'hp-11', 'openserver', 'unixware',
'os400', 'os390', 'irix', 'ptx', 'tru64', 'macosx', 'cygwin',
'qnx', 'interix', 'mingw-msys')
[required; no default]
-c <C compiler name> (e.g. gcc, cc, xlc_r, qcc, icc, icpc or ecc)
[default is make default; cc for gnu make]
-x <C++ compiler name> (e.g. g++, CC, aCC, xlC_r, xlC_rv5compat, QCC,
icc, icpc or ecc) [default is make default; g++ for gnu make]
-d (specifies that you want to build debug version)
[default: no debug]
-m <message loader> can be 'inmem', 'icu', 'MsgFile' or
'iconv' [default: inmem]
-n <net accessor> can be 'fileonly', 'libwww', 'socket', 'winsock' or
'native' [default: socket]
-t <transcoder> can be 'icu', 'Iconv400', 'Uniconv390', 'Win32',
'IconvFBSD', 'IconvGNU' or 'native'
[default: native]
-r <thread option> can be 'pthread' or 'dce'
(AIX, HP-11, and Solaris) or 'sproc' (IRIX) or 'none'
[default: pthread]
-s (specifies that you want to build static libraries) [default: shared]
-b <bitsToBuild> (accepts '64', '32') [default: 32]
-l <extra linker options>
-z <extra compiler options>
-P <install-prefix>
-C <any one extra configure options>
-h (get help on the above commands)
|  |  |  |  |
 | Xerces-C++ can be built as either a standalone library or as a library
dependent on International Components for Unicode (ICU). For simplicity, the
following discussion only explains standalone builds. |
Some additional explanation may be helpful for some of the options:
- -m <message loader>, -t <transcoder>
If you specify icu as the value for either of
these options, you must already have set the
environment variable ICUROOT to point to the ICU distribution directory.
- -n <net accessor>
The default value socket handles HTTP URL's.
The value native is only supported for Mac OS X. The
value winsock is only supported on Mingw-msys.
One of the common ways to build Xerces-C++ is as follows:
 |  |  |  |
cd src/xercesc
./runConfigure -plinux -cgcc -xg++ -minmem -nsocket -tnative -rpthread
|  |  |  |  |
The response will be something like the following (extra line
breaks have been added for readability). See especially the end,
which tells you how configure was invoked.
 |  |  |  |
Generating makefiles with the following options ...
Platform: linux
C Compiler: gcc
C++ Compiler: g++
Message Loader: inmem
Net Accessor: socket
Transcoder: native
Thread option: pthread
Library type: shared
bitsToBuild option: 32
Extra compile options:
Extra link options:
Extra configure options:
Debug is OFF
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for autoconf... autoconf
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for XMLByte... no
checking build system type... i686-unknown-linux-gnu
checking host system type... i686-unknown-linux-gnu
configure: creating ./config.status
config.status: creating Makefile
config.status: creating util/Makefile
config.status: creating util/Transcoders/Cygwin/Makefile
config.status: creating util/Transcoders/Win32/Makefile
config.status: creating util/Transcoders/ICU/Makefile
config.status: creating util/Transcoders/Iconv/Makefile
config.status: creating util/Transcoders/Iconv390/Makefile
config.status: creating util/Transcoders/Uniconv390/Makefile
config.status: creating util/Transcoders/Iconv400/Makefile
config.status: creating util/Transcoders/IconvFBSD/Makefile
config.status: creating util/Transcoders/IconvGNU/Makefile
config.status: creating util/Transcoders/MacOSUnicodeConverter/Makefile
config.status: creating util/Platforms/Makefile
config.status: creating util/Platforms/Solaris/Makefile
config.status: creating util/Platforms/AIX/Makefile
config.status: creating util/Platforms/BeOS/Makefile
config.status: creating util/Platforms/QNX/Makefile
config.status: creating util/Platforms/Linux/Makefile
config.status: creating util/Platforms/FreeBSD/Makefile
config.status: creating util/Platforms/NetBSD/Makefile
config.status: creating util/Platforms/HPUX/Makefile
config.status: creating util/Platforms/OS390/Makefile
config.status: creating util/Platforms/OS400/Makefile
config.status: creating util/Platforms/IRIX/Makefile
config.status: creating util/Platforms/PTX/Makefile
config.status: creating util/Platforms/OpenServer/Makefile
config.status: creating util/Platforms/UnixWare/Makefile
config.status: creating util/Platforms/Tru64/Makefile
config.status: creating util/Platforms/MacOS/Makefile
config.status: creating util/Platforms/Win32/Makefile
config.status: creating util/Platforms/Cygwin/Makefile
config.status: creating util/Compilers/Makefile
config.status: creating util/MsgLoaders/InMemory/Makefile
config.status: creating util/MsgLoaders/ICU/Makefile
config.status: creating util/MsgLoaders/ICU/resources/Makefile
config.status: creating util/MsgLoaders/MsgCatalog/Makefile
config.status: creating util/MsgLoaders/MsgFile/Makefile
config.status: creating util/NetAccessors/Socket/Makefile
config.status: creating util/NetAccessors/WinSock/Makefile
config.status: creating util/NetAccessors/libWWW/Makefile
config.status: creating util/NetAccessors/MacOSURLAccessCF/Makefile
config.status: creating util/regx/Makefile
config.status: creating validators/Makefile
config.status: creating validators/common/Makefile
config.status: creating validators/datatype/Makefile
config.status: creating validators/DTD/Makefile
config.status: creating validators/schema/Makefile
config.status: creating validators/schema/identity/Makefile
config.status: creating framework/Makefile
config.status: creating framework/psvi/Makefile
config.status: creating dom/Makefile
config.status: creating dom/impl/Makefile
config.status: creating dom/deprecated/Makefile
config.status: creating parsers/Makefile
config.status: creating internal/Makefile
config.status: creating sax/Makefile
config.status: creating sax2/Makefile
config.status: creating ../../obj/Makefile
config.status: executing default commands
Having build problems?
Read instructions at http://xerces.apache.org/xerces-c/build.html
Still cannot resolve it?
Find out if someone else had the same problem before.
Go to http://marc.theaimsgroup.com/?l=xerces-c-dev
In future, you may also directly type the following commands to create
the Makefiles.
export TRANSCODER="NATIVE"
export MESSAGELOADER="INMEM"
export NETACCESSOR="Socket"
export THREADS="pthread"
export LIBTYPE="shared"
export BITSTOBUILD="32"
export CC="gcc"
export CXX="g++"
export CXXFLAGS=" -w -O2 -DNDEBUG -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS
-DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS -DX
ML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_
USE_NETACCESSOR_SOCKET "
export CFLAGS=" -w -O2 -DNDEBUG -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -
DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS -DXML
_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_US
E_NETACCESSOR_SOCKET "
export LDFLAGS=" "
export LIBS=" -lpthread "
configure
If the result of the above commands look OK to you, go to the directory
src/xercesc and type "make" (or "gmake") to make the XERCES-C system.
|  |  |  |  |
So now you see what the wrapper script has actually been doing! It has
invoked configure
to create the Makefiles in the individual sub-directories, but in addition
to that, it has set a few environment variables to correctly configure
your compiler and compiler flags too.
 | If you are building a 64 bit Xerces-C++
using g++ that by default generated 32 bit code (or vice
versa), then you will need to specify additional compiler
and linker options via the -z and -l runConfigure options
in order to switch the compiler into 64 bit mode (or 32 bit
mode). These options are architecture-specific and you
may need to consult the GCC manual to determine which
ones to use. For the x86-64, PowerPC, and SPARC
architectures these options are -m64 (64 bit mode) and
-m32 (32 bit mode). Note also that if you are using
the packageBinaries.pl script to build Xerces-C++
then you may need to modify this script to pass the
necessary options to runConfigure.
|
Now that the Makefiles are all created, you are ready to do the actual build.
Is that it? Yes, that's all you need to build Xerces-C++. The libraries
can be found in the lib sub-directory
 | If the library is built with the ICU message loader,
or message catalog loader, then you need to make sure
the XERCESC_NLS_HOME environment variable points to the
$XERCESCROOT/msg directory where the message files reside. |
|
|
|
|