Building Xalan-C++

This page was created for users who have downloaded the source distribution of Xalan-C++ and are looking for guidance on how to build the Xalan-C++ libraries themselves. Rebuilding Xalan-C++ Rebuilding sample applications
| Rebuilding Xalan-C++ |
| What you need from the distributions Steps for doing a Windows Build Steps for doing a Windows Build with Visual Studio .NET Steps for doing a UNIX build Steps for doing a Build with Message Localization Support
| What you need from the distributions |
| To rebuild Xalan-C++, you need the Xalan-C++ source files, the Xerces-C++ header files, and for Windows the Xerces-C++ .lib file. If you want to rebuild with the ICU, you will need to download the ICU source package to build the ICU libraries.
| You can also download Xalan-C++ source distributions from Xalan-C downloads: Xalan-C_1_10_0-src.zip and Xalan-C_1_10_0-src.tar.gz. Xerces-C++ source distributions are available from Xerces-C downloads: xerces-c2_7_0-src.zip and xerces-c2_7_0-src.tar.gz.
Keep in mind that at any given point in time the Xalan-C++ and Xerces-C++ source trees in the Apache XML repository may not be consistent. When we release a version of Xalan-C++ we certify that it is compatible with a given version of Xerces-C++. To be safe, use the Xerces distributions that we certify as compatible. Reminder: Xalan-C++ version 1.10 is compatible with Xerces-C++ version 2.7.0. For information on using the International Components for Unicode (ICU), see Using the ICU. The recommended version of ICU for Xalan-C++ version 1.10 is International Components for Unicode(ICU) version 3.2. You may be able to use newer ICU releases as they appear.
| Steps for doing a Windows build |
3. | To build Xalan-C++ on Windows, you need Xerces-C++ and a C++ compiler for Windows (either MS Visual C++ 6.0 installed with Service Pack 5 for Visual C++ OR Visual Studio .NET). If you are using a different Service Pack, you must rebuild all of the Xerces and Xalan binaries. Before you do the following, be sure you have provided Visual C++ the paths to the Xerces headers and libraries. Create the XERCESCROOT environment variable and set it to the path of the root directory of Xerces-C++. If you are building with ICU, create the ICUROOT environment variable and set it the the path of the ICU root directory. Use Visual C++ to open the Xalan workspace (.dsw) from the xml-xalan\c\Projects\Win32\VC6. If you are building with ICU, then use XalanICU.dsw. Otherwise, open the Xalan.dsw workspace.
   | You may need to restart Visual Studio .NET in order for ICUROOT and XERCESCROOT to take effect.
As an alternative method to the steps described above, would be to go to "Tools" and select "Options" from Visual C++. From the "Options" window, click on the "Directories" tab and do the following: Show Directories for: Executable files. Add the Xerces bin directory to the list. Show Directories for: Include files. Add the Xerces include directory to the list. If you are building with ICU, add the ICU include directory to the list as well. Show Directories for: Library files. Add the Xerces lib directory to the list. If you are building with ICU, add the ICU lib directory to the list as well.
| Steps for doing a Windows Build with Microsoft Visual Studio .NET |
3. | For users who want to build with Visual Studio .NET, Create the XERCESCROOT environment variable and set it to the path of the root directory of Xerces-C++. If you are building with ICU, create the ICUROOT environment variable and set it to the path of the ICU root directory. Use Visual Studio .NET to open the Xalan solution (.sln) from the xml-xalan\c\Projects\Win32\VC7.1. If you are building with ICU, then use XalanICU.sln. Otherwise, open the Xalan.sln solution file.
   | You may need to restart Visual Studio .NET in order for ICUROOT and XERCESCROOT to take effect.
An alternative method to the steps described above, would be to go to "Tools" and select "Options" from Visual Studio .NET. From the "Options" window, click on the "Projects" folder to expand the list. Select "VC++ Directories" from the list and do the following: Show Directories for: Executable files. Add the Xerces bin directory to the list. Show Directories for: Include files. Add the Xerces include directory to the list. If you are building with ICU, add the ICU include directory to the list as well. Show Directories for: Library files. Add the Xerces lib directory to the list. If you are building with ICU, add the ICU lib directory to the list as well.
| Steps for doing a UNIX build |
6. | For users who want to build in the UNIX environment, The Xalan build files are written for GNU make, and will not work with other make utilities. Set the XERCESCROOT environment variable to the path to the root directory of Xerces-C++. Set the XALANCROOT environment variable to the path to the c directory in the root directory of the Xalan-C++ distribution. For example, if the distribution is located in "/home/mydir", you would set the XALANCROOT to "/home/mydir/xml-xalan/c". (Optional) If you decide to build with ICU, integrate the build with ICU by installing the ICU (see Using the ICU) and defining XALAN_USE_ICU to a value, for example: export XALAN_USE_ICU=true. Set the ICUROOT environment variable to the path to the root directory of ICU. Note that building Xalan with ICU requires that Xerces must also be built with ICU. Change directory to XALANCROOT. You can also build Xalan-C outside of the source tree, but you will need to adjust the path to the runConfigure script in the next step. Run the runConfigure utility and provide the platform, C compiler, and C++ compiler flags as indicated below. The runConfigure utility is used to generate the appropriate Makefile for the desired build platform based on the options specified by the user. Valid options for the runConfigure utility are: `./runConfigure -p <value> -c <value> -x <value> [-[flag] <value>]`
   flag | Description
   p | Build platform. Option must be provided by user. Valid values include: aix, linux, freebsd, netbsd, solaris, hp-10, hp-11, hp-11-ia64, irix, tru64, macosx, cygwin.
   c | C compiler name. Example: gcc, cc, c89, xlc_r, etc.
   x | C++ compiler name. Example: g++, xlC_r, CC, etc.
   d | Indicates build is a debug build. Takes no values. Default is no debug.
   t | Transcoder to use. Valid value is 'icu'. Default is null.
   m | Type of localization support method. Valid values include: inmem, icu, and nls. Default is inmem.
   M | Locale for Message Localization Support. Default is "en_US"
   r | Threads option. Valid values include: pthread or dce. Default is pthread. (valid on HP-UX only)
   b | Specify whether it is a 32-bit or 64-bit build. Valid values are 32 and 64. Default is 32-bit
   P | Install root directory. Used if invoking build with gmake install or gmake install-package. Default install root directory is /usr/local
   l | Extra link options other than the default. Default is null
   z | Extra compiler options other than the default. Default is null
   C | Extra configuration options.
   h | To get help on the above commands. Default is no help.
   Linux using GCC: `./runConfigure -p linux -c gcc -x g++` Linux using the Intel compiler: `./runConfigure -p linux -c icc -x icc` AIX (32-bit): `./runConfigure -p aix -c xlc_r -x xlC_r` AIX (64-bit): `./runConfigure -p aix -c xlc_r -x xlC_r -b 64` Cygwin (32-bit): `./runConfigure -p cygwin -c gcc -x g++` HP-UX 11 (32-bit): `./runConfigure -p hp-11 -c cc -x aCC` HP-UX 11 (64-bit): `./runConfigure -p hp-11 -c cc -x aCC -b 64` HP-UX 11 for Itanium (32-bit): `./runConfigure -p hp-11-ia64 -c cc -x aCC` HP-UX 11 for Itanium (64-bit): `./runConfigure -p hp-11-ia64 -c cc -x aCC -b 64` Solaris (32-bit): `./runConfigure -p solaris -c cc -x CC` Solaris (64-bit): `./runConfigure -p solaris -c cc -x CC -b 64` if you choose to install the distribution after building the libraries and executables, then you will need to indicate where you would like the distribution to be installed. To specify the install directory for your distribution, specify the flag -P <install directory>. for example, building and installing on the AIX platform: `./runConfigure -p aix -c xlc_r -x xlC_r -P $HOME/my_xalan`
   | The standard binary directories bin, lib, and include are created in the specified directory only if the install or install-package option is specified in the build process.
8. To see the other runConfigure flags you may include, use the help flag: `./runConfigure -h` Purge the previous build: `make clean` Run the new build: `make` or `make targ` where targ can be one of:
   targ | Description
   all | Build the libraries and Xalan executable. This is the default target if no targ is specified.
   clean | Deletes existing binaries, executables, libraries, tests, and samples.
   install | Build the library, executables, and samples, and copy them (along with the header files) the specified install location.
   install-package | Installs the library, executables, and samples to the specified location.
   Samples | Builds the samples.
   Tests | Builds the tests.
| Steps for doing a Build with Message Localization Support |
| Message Localization Support is a new feature to allow users to build Xalan-C++ such that diagnostic messages are issued in the language of their choice. Message localization support comes in three flavours: Building static messages in the form of a library (DLL or shared object) which can be bound to the Xalan executable. This method is referred to as "in memory". By default, Xalan-C++ is built using "in memory" method. Building messages in the form of a library using localization support provided by the International Components for Unicode (ICU). Building messages in the form of a message catalog. This method utilizes the localization support provided by the Unix National Language Support (NLS) system. This method is supported for UNIX platforms only. Regardless of which method you choose, a message file containing translated messages in the language of your choice must be provided. The standard message file provided in the Xalan-C++ version 1.10 source package is in XML Localization Interchange File Format (XLIFF) format and conforms to the XLIFF 1.1 standard (please see http://www.oasis-open.org/committees/xliff/documents/xliff-specification.htm for more information.) All message files must be written and conform with the XLIFF 1.1 standard. Once an XLIFF message file has been created, the XLIFF file should be stored under xml-xalan/c/src/xalanc/NLS/<locale_name> directory (for example, the default XLIFF message file provided is XalanMsg_en_US.xlf). To build, you will need to follow the same steps as shown above for building in Unix or Windows but with a small change. For building on Windows platform with "In Memory" method: Create the environment variable XERCESCROOT and set it to the path to the root directory of Xerces-C++. Create the environment variable ICUROOT and set it to the path to the ICU root directory. Open the Xalan.dsw workspace using Microsoft Visual C++. The "inmem" localization method should be configured by default. Select the Localization project, and go to Settings and click on the "General" tab. Verify the build command line to use "nmake /f BuildMessages.mak TYPE=inmem LOCAL=en_US" Run "Build all" with the configuration of your choice. For building on the Windows platform with ICU method: Create the environment variable XERCESCROOT and set it to the path to the root directory of Xerces-C++. Create the environment variable ICUROOT and set it to the path to the ICU root directory. Open the XalanICU.dsw workspace using Microsoft Visual C++. Select the AllInOneWithICU project, and ensure that the project depends on the LocalizationWithICU project. Select the LocalizationWithICU project, and go to Settings and click on the "General" tab. Modify the build command line to use "nmake /f BuildMessages.mak TYPE=icu LOCAL=en_US" Open the tools.ini file under Projects\Win32\VC6\Utils\Localization and add the ICU root directory to the ICUROOT variable setting. Run "Build all" with the configuration of your choice. For building on the Unix platform: Repeat steps 1 through 5 as outlined under "Steps for doing a UNIX Build" Run the runConfigure and provide the platform, C compiler, C++ compiler, the message locale system flavour you are intending to build, and the locale support. Example 1: to use the NLS method for localization support using the default locale en_US: AIX (32-bit): `./runConfigure -p aix -c xlc_r -x xlC -m nls` AIX (64-bit): .`/runConfigure -p aix -c xlc_r -x xlC_r -b 64 -m nls` Example 2: to use the 'icu' method for localization support using the locale fr_FR: AIX (32-bit): `./runConfigure -p aix -c xlc_r -x xlC_r -m icu -M fr_Fr` AIX (64-bit): `./runConfigure -p aix -c xlc_r -x xlC_r -b 64 -m icu -M fr_Fr` Perform steps 7 and 8 as outlined under "Steps for doing a UNIX Build" After Xalan-C++ and associated libraries have been successfully built, the message catalog will be stored in the directory xml-xalan/c/bin.
Localization Build Type | File Name
ICU or "in memory" method: | libxalanMsg110.so (for UNIX) XalanMessages_1_10.dll and XalanMessages_1_10.lib (for Windows)
NLS method: | xalanMsg1_10.cat can be found in $XALANCROOT/nls/<locale_name>/ directory
The location of the message library, Xalan-C++ and Xerces-C++ binaries need to be added to the PATH and library path variables. Depending on the Message Localization Support method you've chosen, the following steps will need to be performed such that Xalan-C++ will be able to utilize the message library. For an "in memory" or "icu" build, the location of the Xalan-C++ and Xerces-C++ executables need to be added to the PATH variable. The location of the message library will need to be added to: the LIBPATH variable for AIX users the LD_LIBRARY_PATH variable for RedHat, SuSE, and Solaris users the SHLIB_PATH variable for HP-UX users. For an NLS build, the message catalog will need to be added to the NLSPATH.

Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.