|
| | | | Building XML4C on UNIX platforms | | | | |
| |
XML4C 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 XML4C 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 XML4C on. The following table lists the
relevant platforms and compilers.
Operating System
| C++, C Compilers
|
Redhat Linux 6.1
| g++, gcc (egcs)
|
AIX 4.2.1 and higher
| xlC_r, xlc_r
|
Solaris 2.6
| CC, cc
|
HP-UX 11
| aCC, cc
|
If you are not using any of these compilers, you are taking a calculated risk
by exploring new grounds. Your effort in making XML4C 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
LD_LIBRARY_PATH , on AIX it is LIBPATH ,
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 XML4C with ICU,
look at the Building ICU.
It tells you where you can get ICU and how to build XML4C with it. |
| |
As 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 configure ) is already in your src
directory. If not, type:
| | | | cd $XERCESCROOT/src
autoconf | | | | |
This generates a shell-script called configure . It is tempting to run
this script directly as is normally the case, but wait a minute. If you are
using the default compilers like
gcc and
g++ you do not have a problem. But
if you are not on the standard GNU compilers, 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 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) | | | | |
| XML4C 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. |
One of the common ways to build XML4C 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 XML4C system. | | | | |
| The error message concerning conf.h
is NOT an indication of a problem. This code has been inserted to make it
work on AS/400, but it gives this message which appears to be an error. The problem
will be fixed in future. |
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.
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 XML4C.
|
|
|
|