You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Eric <er...@swiftdesign.com> on 2000/02/16 01:15:51 UTC

Compiling Xerces-C 1.1.0 under the Sun WorkShop 5.0 compiler

Below is a script I wrote that patches in support for the Sun WorkShop
5.0 compiler
on the Xerces-C 1.1.0 source tree.

This script does the following:
       Removes NO_NATIVE_BOOL.  (Sun WorkShop 5.0 now has native bool
support.)
       Makes various changes to support the external template instance
placement and linkage method.
       Removes -lC parameter to the linker. Explicitly specifying it
confuses WorkShop.
       Adds -mt as a parameter  to the compiler and linker when
compiling the samples. This is already set up correctly
       in the src directory.

In order to support the external template instance method, Makefile.incl
had to be changed.
Make now directs the compiler to output its object files to
$XERCESCROOT/obj
rather than creating them in the current directory followed by a copy to
$XERCESCROOT/obj.
This is needed to ensure that the template repository is created
properly.

Note: Because object files are directly compiled into $XERCESCROOT you
will see
the following sorts of error messages during the make:
cp: cannot access BinFileInputStream.o
cp: cannot access BinInputStream.o
cp: cannot access BinMemInputStream.o
.
.
.
They can be safely ignored.

I would be willing to be spend some more time to get Xerces-C compiling
out of the box
under the Sun WorkShop 5.0 compiler.


Any questions,
-Eric Yankowitz
eric@swiftdesign.com

To run the script modify the "export SRCROOT=....." and  "export
PACKAGE=......"
lines WITHIN the script and ensure that your path points to gnu make,
gnu autoconf,
and gnu m4 ahead of any other versions.


#! /bin/ksh

export SRCROOT=/home/statemnt/libs/xerces
export PACKAGE=/home/statemnt/pack/cpp/xml/xerces-csrc_1_1_0_d05.tar.gz

export XERCESCROOT=$SRCROOT/xerces-csrc_1_1_0_d05
cd $SRCROOT

echo "Attempting to remove any previous installations @ $XERCESCROOT"
echo

rm -rf $XERCESCROOT

echo "Unpacking $PACKAGE"
echo
gzip -dc $PACKAGE | tar xvf -

cd $XERCESCROOT/src
echo "Running: autoconf"
echo
autoconf

echo "Configuring the source tree"
echo
./runConfigure -psolaris -ccc -xCC -d -nfileonly -rpthread

echo "Patching up files for WorkShop Compilers 5.0 98/12/15 C++ 5.0"
echo

echo "Sun WorkShop 5.0 Compiler supports native bools."
echo "Removing NO_NATIVE_BOOL define."
echo
mv util/Compilers/SunCCDefs.hpp util/Compilers/SunCCDefs.hpp.orig
sed -e "s/^#define NO_NATIVE_BOOL$//" util/Compilers/SunCCDefs.hpp.orig
>
util/Compilers/SunCCDefs.hpp

echo "External template instance placement and linkage is prefered, so I
am"
echo "defining XML4C_TMPLSINC."
echo
echo "#define XML4C_TMPLSINC" >> util/Compilers/SunCCDefs.hpp


echo "Patching Makefile.incl for external template instance support."
echo "To ensure creating a correct template repository, Object files"
echo "will now be directly outputed to $XERCESCROOT/obj."
echo "Also, The -lC option is redundant and causes problems, so I am
removing it."
echo
mv Makefile.incl Makefile.incl.orig
sed -e "186s/-lC -lc//" -e "189s/-lC -lc//" \
    -e "180s/-instances=static//" \
    -e  "424s/\\$.@./$\(ALL_OBJECTS_DIR\)\/$\(@F\)/" \
    -e  "430s/\\$.@./$\(ALL_OBJECTS_DIR\)\/$\(@F\)/" \
    -e  "432s/\\$.@./$\(ALL_OBJECTS_DIR\)\/$\(@F\)/" \
    Makefile.incl.orig > Makefile.incl

make

cd ../samples
echo "Removing -lC from the samples/runConfigure"
echo
mv ./runConfigure ./runConfigure.orig
sed -e"247d" ./runConfigure.orig > ./runConfigure
chmod +x ./runConfigure

echo "Setting/Removing the following in samples/Makefile.incl:"
echo "  Removing -lC"
echo "  Setting external template instances"
echo "  Setting multi-threading"
echo
mv Makefile.incl Makefile.incl.orig
sed -e "129s/-lC -lc//" \
    -e "126s/-instances=static//" \
    -e "126,127s/$/ -mt/" \
 Makefile.incl.orig > Makefile.incl

./runConfigure -psolaris -ccc -xCC -d

make


Re: Compiling Xerces-C 1.1.0 under the Sun WorkShop 5.0 compiler

Posted by Eric Yankowitz <er...@swiftdesign.com>.
Compiling and linking with -instances=static gave me the following
output:

ld: fatal: symbol
`RefHashTableOfEnumerator<DTDAttDef>::~RefHashTableOfEnumerator
#Nvariant 1()'
is multiply defined:
     (file /home/eyankowi/tmp/xerces-csrc_1_1_0_d05/obj/DTDAttDefList.o
and file
 /home/eyankowi/tmp/xerces-csrc_1_1_0_d05/obj/DTDElementDecl.o);
ld: fatal: File processing errors. No output written to
/home/eyankowi/tmp/xerces-csrc_1_1_0_d05/lib/libxerces-c1_1.so


There may be a way to fix this error, but as Sun doesn't recommend this
method,
it may not be worth the effort.

-Eric Yankowitz
eric@swiftdesign.com

Eric Yankowitz wrote:
> 
> The Sun Documentation recommends using the external method:
>    * External instances are suitable for all development and
>      provide the best overall template compilation.
>    * Static instances are suitable for very small programs
>      or debugging and have restricted uses.
>    ..stuff deleted...
>    You should use the external instances method, which is the default,
> unless there
>    is a very good reason to do otherwise.
> 
> This is from:
> http://docs.sun.com:80/ab2/coll.32.5/CPPPUG/@Ab2PageView/14127?Ab2Lang=C&Ab2Enc=iso-8859-1
> 
> The linker also complained about duplicate symbols. Off the top, I
> don't remember if it was a warning or an error. I'll check tomorrow,
> because I don't have access right now.
> 
> Since the shared library was linked with -mt, libc reported
> a mutex error at runtime and crashed when the sample programs
> were compiled and linked without -mt.
> 
> >From the Sun Documentation:
>   If you compile and link in separate steps and you compile
>   with -mt, be sure to link with -mt, as shown in the following example,
>   or you might get unexpected results.
> 
>   demo% CC -c -mt myprog.cc
>   demo% CC -mt myprog.o
> 
> This is from:
> http://docs.sun.com:80/ab2/coll.32.5/CPPPUG/@Ab2PageView/7898?Ab2Lang=C&Ab2Enc=iso-8859-1
> 
> Hope this helps,
> 
> -Eric Yankowitz
> eric@swiftdesign.com
> 
> Arundhati Bhowmick wrote:
> >
> > Eric,
> > Thanks a lot for your effort on Sun CC 5.0. However before I introduce the
> > changes I'd like to make sure the changes work with old version of sun CC as
> > well. Besides I need to clarify few questions regarding your changes -
> > 1. Why do you need external template instance? What fails if its not? The
> > 'instance=static'  option was introduced to avoid creating of external
> > templates for one of our customer so I need to understand exactly what your
> > requirments are on this.
> > 2. Why do you need -mt switch in samples when they are not using any
> > threading operations?
> >
> > Arundhati

Re: Compiling Xerces-C 1.1.0 under the Sun WorkShop 5.0 compiler

Posted by Eric Yankowitz <er...@swiftdesign.com>.
The Sun Documentation recommends using the external method:
   * External instances are suitable for all development and
     provide the best overall template compilation. 
   * Static instances are suitable for very small programs
     or debugging and have restricted uses. 
   ..stuff deleted...
   You should use the external instances method, which is the default,
unless there
   is a very good reason to do otherwise.

This is from:
http://docs.sun.com:80/ab2/coll.32.5/CPPPUG/@Ab2PageView/14127?Ab2Lang=C&Ab2Enc=iso-8859-1

The linker also complained about duplicate symbols. Off the top, I
don't remember if it was a warning or an error. I'll check tomorrow,
because I don't have access right now.

Since the shared library was linked with -mt, libc reported
a mutex error at runtime and crashed when the sample programs
were compiled and linked without -mt.

Re: Compiling Xerces-C 1.1.0 under the Sun WorkShop 5.0 compiler

Posted by Arundhati Bhowmick <ar...@hyperreal.org>.
Eric,
Thanks a lot for your effort on Sun CC 5.0. However before I introduce the
changes I'd like to make sure the changes work with old version of sun CC as
well. Besides I need to clarify few questions regarding your changes -
1. Why do you need external template instance? What fails if its not? The
'instance=static'  option was introduced to avoid creating of external
templates for one of our customer so I need to understand exactly what your
requirments are on this.
2. Why do you need -mt switch in samples when they are not using any
threading operations?

Arundhati

Eric wrote:

> Below is a script I wrote that patches in support for the Sun WorkShop
> 5.0 compiler
> on the Xerces-C 1.1.0 source tree.
>
> This script does the following:
>        Removes NO_NATIVE_BOOL.  (Sun WorkShop 5.0 now has native bool
> support.)
>        Makes various changes to support the external template instance
> placement and linkage method.
>        Removes -lC parameter to the linker. Explicitly specifying it
> confuses WorkShop.
>        Adds -mt as a parameter  to the compiler and linker when
> compiling the samples. This is already set up correctly
>        in the src directory.
>
> In order to support the external template instance method, Makefile.incl
> had to be changed.
> Make now directs the compiler to output its object files to
> $XERCESCROOT/obj
> rather than creating them in the current directory followed by a copy to
> $XERCESCROOT/obj.
> This is needed to ensure that the template repository is created
> properly.
>
> Note: Because object files are directly compiled into $XERCESCROOT you
> will see
> the following sorts of error messages during the make:
> cp: cannot access BinFileInputStream.o
> cp: cannot access BinInputStream.o
> cp: cannot access BinMemInputStream.o
> .
> .
> .
> They can be safely ignored.
>
> I would be willing to be spend some more time to get Xerces-C compiling
> out of the box
> under the Sun WorkShop 5.0 compiler.
>
> Any questions,
> -Eric Yankowitz
> eric@swiftdesign.com
>
> To run the script modify the "export SRCROOT=....." and  "export
> PACKAGE=......"
> lines WITHIN the script and ensure that your path points to gnu make,
> gnu autoconf,
> and gnu m4 ahead of any other versions.
>
> #! /bin/ksh
>
> export SRCROOT=/home/statemnt/libs/xerces
> export PACKAGE=/home/statemnt/pack/cpp/xml/xerces-csrc_1_1_0_d05.tar.gz
>
> export XERCESCROOT=$SRCROOT/xerces-csrc_1_1_0_d05
> cd $SRCROOT
>
> echo "Attempting to remove any previous installations @ $XERCESCROOT"
> echo
>
> rm -rf $XERCESCROOT
>
> echo "Unpacking $PACKAGE"
> echo
> gzip -dc $PACKAGE | tar xvf -
>
> cd $XERCESCROOT/src
> echo "Running: autoconf"
> echo
> autoconf
>
> echo "Configuring the source tree"
> echo
> ./runConfigure -psolaris -ccc -xCC -d -nfileonly -rpthread
>
> echo "Patching up files for WorkShop Compilers 5.0 98/12/15 C++ 5.0"
> echo
>
> echo "Sun WorkShop 5.0 Compiler supports native bools."
> echo "Removing NO_NATIVE_BOOL define."
> echo
> mv util/Compilers/SunCCDefs.hpp util/Compilers/SunCCDefs.hpp.orig
> sed -e "s/^#define NO_NATIVE_BOOL$//" util/Compilers/SunCCDefs.hpp.orig
> >
> util/Compilers/SunCCDefs.hpp
>
> echo "External template instance placement and linkage is prefered, so I
> am"
> echo "defining XML4C_TMPLSINC."
> echo
> echo "#define XML4C_TMPLSINC" >> util/Compilers/SunCCDefs.hpp
>
> echo "Patching Makefile.incl for external template instance support."
> echo "To ensure creating a correct template repository, Object files"
> echo "will now be directly outputed to $XERCESCROOT/obj."
> echo "Also, The -lC option is redundant and causes problems, so I am
> removing it."
> echo
> mv Makefile.incl Makefile.incl.orig
> sed -e "186s/-lC -lc//" -e "189s/-lC -lc//" \
>     -e "180s/-instances=static//" \
>     -e  "424s/\\$.@./$\(ALL_OBJECTS_DIR\)\/$\(@F\)/" \
>     -e  "430s/\\$.@./$\(ALL_OBJECTS_DIR\)\/$\(@F\)/" \
>     -e  "432s/\\$.@./$\(ALL_OBJECTS_DIR\)\/$\(@F\)/" \
>     Makefile.incl.orig > Makefile.incl
>
> make
>
> cd ../samples
> echo "Removing -lC from the samples/runConfigure"
> echo
> mv ./runConfigure ./runConfigure.orig
> sed -e"247d" ./runConfigure.orig > ./runConfigure
> chmod +x ./runConfigure
>
> echo "Setting/Removing the following in samples/Makefile.incl:"
> echo "  Removing -lC"
> echo "  Setting external template instances"
> echo "  Setting multi-threading"
> echo
> mv Makefile.incl Makefile.incl.orig
> sed -e "129s/-lC -lc//" \
>     -e "126s/-instances=static//" \
>     -e "126,127s/$/ -mt/" \
>  Makefile.incl.orig > Makefile.incl
>
> ./runConfigure -psolaris -ccc -xCC -d
>
> make