|
Building Xerces-CThis page answers the following questions:
Building on Windows NT/98Xerces-C comes with Microsoft Visual C++ projects and workspaces to help you build Xerces-C. The following describes the steps you need to build Xerces-C. Building Xerces-C libraryTo build Xerces-C from it source (using MSVC), you will need to open the workspace containing the project. If you are building your application, you may want to add the Xerces-C project inside your applications's workspace. The workspace containing the Xerces-C project file and all other samples is: xerces-c-src1_4_0\Projects\Win32\VC6\xerces-all\xerces-all.dsw Once you are inside MSVC, you need to build the project marked XercesLib. If you want to include the Xerces-C project separately, you need to pick up: xerces-c-src1_4_0\Projects\Win32\VC6\xerces-all\XercesLib\XercesLib.dsp You must make sure that you are linking your application with the xerces-c_1.lib library and also make sure that the associated DLL is somewhere in your path.
Building samplesInside the same workspace (xerces-all.dsw), 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 platformsXerces-C uses GNU tools like Autoconf and GNU Make to build the system. You must first make sure you have these tools installed on your system before proceeding. If you don not have required tools, ask your system administrator to get them for you. These tools are free under the GNU Public Licence and may be obtained from the Free Software Foundation. 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 Autoconf 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.
If you are not using any of these compilers, you are taking a calculated risk by exploring new grounds. Your effort in making Xerces-C work on this new compiler is greatly appreciated and any problems you face can be addressed on the Xerces-C mailing list. 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
Setting build environment variablesBefore doing the build, you must first set your environment variables to pick-up the compiler and also specify where you extracted Xerces-C on your machine. While the first one is probably set for you by the system administrator, just make sure you can invoke the compiler. You may do so by typing the compiler invocation command without any parameters (e.g. xlc_r, or g++, or cc) and check if you get a proper response back. Next set your Xerces-C root path as follows: export XERCESCROOT=<full path to xerces-c-src1_4_0> This should be the full path of the directory where you extracted Xerces-C. Building Xerces-C libraryAs mentioned earlier, you must be ready with the GNU tools like autoconf and gmake before you attempt the build. The autoconf tool is required on only one platform and produces
a set of portable scripts (configure) that you can run on all
other platforms without actually having the autoconf tool installed
everywhere. In all probability the autoconf-generated script
(called cd $XERCESCROOT/src autoconf This generates a shell-script called 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 tell the script is 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 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', 'linux', 'solaris', 'hp-10', 'hp-11', 'irix', 'unixware') -c <C compiler name> (e.g. xlc_r, gcc, cc) -x <C++ compiler name> (e.g. xlC_r, g++, CC, aCC) -d (specifies that you want to build debug version) -m <message loader> can be 'inmem', 'icu', 'iconv' -n <net accessor> can be 'fileonly', 'libwww' -t <transcoder> can be 'icu' or 'native' -r <thread option> can be 'pthread' or 'dce' (only used on HP-11) -l <extra linker options> -z <extra compiler options> -h (to get help on the above commands)
One of the common ways to build Xerces-C is as follows: runConfigure -plinux -cgcc -xg++ -minmem -nfileonly -tnative The response will be something like this: Generating makefiles with the following options ... Platform: linux C Compiler: gcc C++ Compiler: g++ Extra compile options: Extra link options: Message Loader: inmem Net Accessor: fileonly Transcoder: native Thread option: Debug is OFF creating cache ./config.cache checking for gcc... gcc checking whether the C compiler (gcc -O -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER ) works... yes checking whether the C compiler (gcc -O -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking for c++... g++ checking whether the C++ compiler (g++ -O -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER ) works... yes checking whether the C++ compiler (g++ -O -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER ) is a cross-compiler... no checking whether we are using GNU C++... yes checking whether g++ accepts -g... yes checking for a BSD compatible install... /usr/bin/install -c checking for autoconf... autoconf checking for floor in -lm... yes checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for XMLByte... no checking host system type... i686-pc-linux-gnu updating cache ./config.cache creating ./config.status creating Makefile creating util/Makefile creating util/Transcoders/ICU/Makefile creating util/Transcoders/Iconv/Makefile creating util/Transcoders/Iconv390/Makefile creating util/Transcoders/Iconv400/Makefile creating util/Platforms/Makefile creating util/Compilers/Makefile creating util/MsgLoaders/InMemory/Makefile creating util/MsgLoaders/ICU/Makefile creating util/MsgLoaders/MsgCatalog/Makefile creating util/MsgLoaders/MsgFile/Makefile creating validators/DTD/Makefile creating framework/Makefile creating dom/Makefile creating parsers/Makefile creating internal/Makefile creating sax/Makefile creating ../obj/Makefile creating conf.h cat: ./conf.h.in: No such file or directory conf.h is unchanged Having build problems? Read instructions at http://xml.apache.org/xerces-c/build.html Still cannot resolve it? Find out if someone else had the same problem before. Check the mailing list archives at http://archive.covalent.net. In future, you may also directly type the following commands to create the Makefiles. export TRANSCODER=NATIVE export MESSAGELOADER=INMEM export USELIBWWW=0 export CC=gcc export CXX=g++ export CXXFLAGS=-O -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER export CFLAGS=-O -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER export LIBS= -lpthread configure If the result of the above commands look OK to you, go to the directory XERCESCROOT and type "gmake" to make the XERCES-C system.
So now you see what the wrapper script has actually been doing! It has
invoked Now that the Makefiles are all created, you are ready to do the actual build. gmake Is that it? Yes, that's all you need to build Xerces-C. Building samplesSimilarly, you can build the samples by giving the same commands in the
cd $XERCESCROOT/samples runConfigure -plinux -cgcc -xg++ gmake The samples get built in the export LD_LIBRARY_PATH=$XERCESCROOT/lib:$LD_LIBRARY_PATH You are now set to run the sample applications. Building Xerces-C on Windows using Visual Age C++A few unsupported projects are also packaged with Xerces-C. Due to origins of Xerces-C inside IBM labs, we do have projects for IBM's Visual Age C++ compiler on Windows. The following describes the steps you need to build Xerces-C using Visual Age C++. Building Xerces-C libraryRequirements:
To include the ICU library:
Instructions:
Building on OS/2 using Visual Age C++OS/2 is a favourite IBM PC platforms. The only option in this platform is to use Visual Age C++ compiler. Here are the steps you need to build Xerces-C using Visual Age C++ on OS/2. Building Xerces-C libraryRequirements:
There are two ways to build Xerces-C. The "From Existing" method only requires VAC++. The "From Scratch" method requires both Object Rexx and VAC++ installed. The "From Existing" Method
The "From Scratch" Method
Packaging the BinariesThere is an packageBinaries -s x:\xerces-c-src1_4_0 -o x:\temp\xerces-c1_4_0-os2 (Match the source directory to your system; the target directory can be anything you want.)
Building on AS/400The following addresses the requirements and build of Xerces-C natively on the AS/400. Building Xerces-C libraryRequirements:
Recommendations:
Setup Instructions:
qsh: gunzip -d <tar file.gz> pax -r -f <uncompressed tar file>
XERCESCROOT - <the full path to your Xerces-C sources> PLATFORM - 'OS400' MAKE - '/usr/bin/gmake' OUTPUTDIR - <identifies target as400 library for *module, *pgm and *srvpgm objects> ICUROOT - (optional if using ICU) <the path of your ICU includes>
#!/usr/bin/sh /usr/bin/grep -e "$@" You may want to put the environment variables and library list
setup instructions in a Configure To configure the make files for an AS/400 build do the following: qsh cd <full path to Xerces-C>/src runConfigure -p os400 -x icc -c icc -m MsgFile -t Iconv400 Troubleshooting: error: configure: error: installation or configuration problem: C compiler cannot create executables. If during DLTMOD <your OUTPUTDIR library>/CONFT* and DLTPGM your <OUTPUTDIR library>/CONFT* Build qsh gmake -e The above gmake will result in a service program being created
in your specified library and a symbolic link to that service program
placed in <path to Xerces-C/lib>. You can either bind your
XML application programs directly to the parser's service program
via the After building the Xerces-C service program, create a binding directory by doing the following (note, this binding directory is used when building the samples): qsh cd <full path to Xerces-C>/lib> qar -cuv libxercesc1_1.a *.o command = CRTBNDDIR BNDDIR(yourlib/libxercesc) TEXT('/yourlib/Xerces-C/lib/libxercesc1_1.a') command = ADDBNDDIRE BNDDIR(yourlib/libxercesc) OBJ((yourlib/LIBXERCESC *SRVPGM) ) Troubleshooting: If you are on a V4R3 system, you will get a bind problem
To build for transcoder ICU:
Creating AS400 XML parser message file: As specified earlier, the EDTF <full path to Xerces-C>/src/util/MsgLoaders/MsgFile/CrtXMLMsgs In the prolog of
Note that the Xerces-C source code for resolving parser messages is
using by default message file <full path to Xerces-C>/src/util/MsgLoaders/MsgFile/MsgLoader.cpp <full path to Xerces-C>/src/util/Platforms/OS400/OS400PlatformUtils.cpp Troubleshooting: If you are using the parser and are failing to get any message text
for error codes, it may be because of the Building Samples on AS/400qsh cd <full path to Xerces-C>/samples runConfigure -p os400 -x icc -c icc gmake -e Troubleshooting: If you take a Building on Macintosh using CodeWarriorBuilding Xerces-C libraryThe directions in this file cover installing and building Xerces-C and ICU under the MacOS using CodeWarrior.
There are some things to be aware of when creating your own projects using Xerces-C.
How to Build ICUAs mentioned earlier, Xerces-C may be built in stand-alone mode using native encoding support and also using ICU where you get support over 180 different encodings. ICU stands for International Components for Unicode and is an open source distribution from IBM. You can get ICU libraries from IBM's developerWorks site or go to the ICU download page directly. Buiding ICU for Xerces-CYou can find generic instructions to build ICU in the ICU documentation. What we describe below are the minimal steps needed to build ICU for Xerces-C. Not all ICU components need to be built to make it work with Xerces-C.
Building ICU on WindowsTo build ICU from its source, invoke the project
You must make sure that you are linking your application
with the xerces-c_1.lib library and also make sure
that the associated Xerces-C DLL is somewhere in your path. Note
that at runtime, your application will need the ICU data DLL called
Building ICU on UNIX platformsTo build ICU on all UNIX platforms you at least need the
First make sure that you have defined the following environment variables: export ICUROOT = <icu_installdir> Next, go to the directory, the following commands will create
a shell script called cd $ICUROOT cd source autoconf Commands for specific UNIX platforms are different and are described separately below. You will get a more detailed description of the use of
configure in the ICU documentation. The differences lie in the
arguments passed to the configure script, which is a
platform-independent generated shell-script (through
For AIX: Type the following: env CC="xlc_r -L/usr/lpp/xlC/lib" CXX="xlC_r -L/usr/lpp/xlC/lib" C_FLAGS="-w -O" CXX_FLAGS="-w -O" configure --prefix=$ICUROOT gmake gmake install The first line is different for different platforms as outlined below: For Solaris and Linux: env CC="cc" CXX="CC" C_FLAGS="-w -O" CXX_FLAGS="-w -O" ./configure --prefix=$ICUROOT For HP-UX with the aCC compiler: env CC="cc" CXX="aCC" C_FLAGS="+DAportable -w -O" CXX_FLAGS="+DAportable -w -O" ./configure --prefix=$ICUROOT For HP-UX with the CC compiler: env CC="cc" CXX="CC" C_FLAGS="+DAportable -w -O" CXX_FLAGS="+eh +DAportable -w -O" ./configure --prefix=$ICUROOT Building Xerces-C with ICU using bundled Perl scriptsTo simplify the builds, we use the bundled perl script 'packageBinaries.pl'. It requires some setup, but once it is done, repeating it becomes easy. Here's how we do it. Prerequisites:
Steps are:
Download Xerces-C from http://xml.apache.org/xerces-c/dist directory. Download the appropriate archive for ICU from: http://oss.software.ibm.com/developerworks/opensource/icu/project/download/index.html For Windows Extract Xerces-C source files from the .zip archive using WinZip, say
in the root directory (an arbitrary drive x:). It should create a directory like
' Extract the ICU files, using WinZip, in root directory of the disk
where you have installed Xerces-C, sources. After extraction, there
should be a new directory ' There are two options to build Xerces-C with ICU. One is to use the MSDEV GUI environment, and the other is to invoke the compiler from the command line. Using, the GUI environment, requires one to edit the project files.
Here, we will describe only the second option. It involves using the
perl script ' Start a command prompt to get a new shell window. Make sure you have
perl, cygwin tools ( set XERCESCROOT=x:\xerces-c-src1_4_0 set ICUROOT=x:\icu cd x:\xerces-c-src1_4_0\scripts perl packageBinaries.pl -s x:\xerces-c-src1_4_0 -o x:\temp\xerces-c1_4_0-win32 -t icu (Match the source directory to your system; the target directory can be anything you want.) If everything is setup right and works right, then you should see a binary drop created in the target directory specified above. This script will build both ICU and Xerces-C, copy the files (relevant to the binary drop) to the target directory. For a description of options available, you can enter: perl packageBinaries.pl How to build XML for COM on WindowsTo build the COM module for use with XML on Windows platforms, you must first set up your machine appropriately with necessary tools and software modules and then try to compile it. The end result is an additional library that you can use along with the standard Xerces-C for writing VB templates or for use with IE 5.0 using JavaScript. Setting up your machine for COMTo build the COM project you will need to install the MS PlatformSDK. Some of the header files we use don't come with Visual C++ 6.0. You may download it from Microsoft's Website at http://www.microsoft.com/msdownload/platformsdk/setuplauncher.htm or directly FTP it from ftp://ftp.microsoft.com/developr/PlatformSDK/April2000/Msi/WinNT/x86/InstMsi.exe. The installation is huge, but you don't need most of it. So you may do a custom install by just selecting "Build Environment" and choosing the required components. First select the top level Platform SDK. Then click the down arrow and make all of the components unavailable. Next open the "Build Environment" branch and select only the following items:
Important: When the installation is complete you need to update VC6's
include path to include
Building COM module for Xerces-COnce you have set up your machine, build Xerces-C COM module
by choosing the project named 'xml4com' inside the workspace. Then select your
build mode to be xml4com - Win32 Release MinDependency. Finally build the
project. This will produce a DLL named Testing the COM moduleThere are some sample test programs in the You may also want to check out the NIST DOM test suite at http://xw2k.sdct.itl.nist.gov/BRADY/DOM/. You will have to modify the documents in the NIST suite to load the Xerces COM object instead of the MSIE COM object. How to build the User Documentation?The user documentation (this very page that you are reading
on the browser right now), was generated using an XML
application called StyleBook. This application makes use of
Xerces-J and Xalan to create the HTML file from the XML source
files. The XML source files for the documentation are part of
the Xerces-C module. These files reside in the
Pre-requisites for building the user documentation are:
Invoke a command window and setup PATH to include the JDK 1.2.2 bin directory Next, cd to the Xerces-C source drop root directory, and enter
This should generate the .html files in the 'doc/html' directory. I wish to port Xerces to my favourite platform. Do you have any suggestions?All platform dependent code in Xerces has been isolated to a couple of files, which should ease the porting effort. Here are the basic steps that should be followed to port Xerces.
That is the work required in a nutshell! What should I define XMLCh to be? And what is the relationship between XMLCh and wchar_t?XMLCh should be defined to be a type suitable for holding a
utf-16 encoded (16 bit) value, usually an All XML data is handled within xerces-c as strings of XMLCh characters. Regardless of the size of the type chosen, the data stored in variables of type XMLCh will always be utf-16 encoded values. Unlike XMLCh, the encoding of wchar_t is platform dependent. Sometimes it is utf-16 (AIX, Windows), sometimes ucs-4 (Solaris, Linux), sometimes it is not based on Unicode at all (HP/UX, AS/400, system 390). Some earlier releases of xerce-c defined XMLCh to be the same type as wchar_t on most platforms, with the goal of making it possible to pass XMLCh strings to library or system functions that were expecting wchar_t paramters. This approach has been abandonded because of
How do I build a single-threaded library on Unix platforms?To build a single-threaded library on Unix platforms you have to update
one or more of the following files For Aix -
For Solaris -
For Linux -
For HPUX -
Where can I look for more help?If you have read this page, followed the instructions, and still cannot resolve your problem(s), there is more help. You can find out if others have solved this same problem before you, by checking the Apache XML mailing list archives at http://archive.covalent.net. Copyright © 2000 The Apache Software Foundation. All Rights Reserved. |
|||||||||||||||||||||||||||||||||||||||||||||
With any suggestions or questions please feel free to contact us |