Opened 17 years ago

Closed 17 years ago

#1577 closed defect (fixed)

Compiling OGR/ILI with Xerces 3.0

Reported by: Kosta Owned by: Mateusz Łoskot
Priority: low Milestone: 1.4.2
Component: OGR_SF Version: unspecified
Severity: trivial Keywords: ili xerces
Cc: warmerdam, pka

Description

In order to compile the ILI-reader with Xerces 3.0 the following include should be added (should be backward compatilbe with Xerces 2.x):

Index: ogr/ogrsf_frmts/ili/iom/reader.cpp
===================================================================
--- ogr/ogrsf_frmts/ili/iom/reader.cpp (revision 11280)
+++ ogr/ogrsf_frmts/ili/iom/reader.cpp (working copy)
@@ -27,6 +27,8 @@
 #include <string.h>
 
 #include <xercesc/util/XMLString.hpp>
+#include <xercesc/sax/Locator.hpp>
+#include <xercesc/sax2/Attributes.hpp>
 #include <xercesc/sax2/XMLReaderFactory.hpp>
 
 #include <iom/iom_p.h>

and

Index: ogr/ogrsf_frmts/ili/ili2readerp.h
===================================================================
--- ogr/ogrsf_frmts/ili/ili2readerp.h (revision 11280)
+++ ogr/ogrsf_frmts/ili/ili2readerp.h (working copy)
@@ -43,6 +43,7 @@
 #include <set>
 
 #include <util/PlatformUtils.hpp>
+#include <sax2/Attributes.hpp>
 #include <sax2/DefaultHandler.hpp>
 #include <sax2/ContentHandler.hpp>
 #include <sax2/SAX2XMLReader.hpp>

Change History (13)

comment:1 by warmerdam, 17 years ago

Cc: warmerdam added
Keywords: ili xerces added
Milestone: 1.4.2
Owner: changed from warmerdam to Mateusz Łoskot

Mateusz,

Could you verify this, and apply the change it if seems safe (in trunk and 1.4 branch).

comment:2 by Mateusz Łoskot, 17 years ago

Status: newassigned

Kosta,

As I see there is no official release nor RC of Xerces 3.0, so where can I find it?

in reply to:  2 comment:3 by Kosta, 17 years ago

Replying to mloskot:

Kosta,

As I see there is no official release nor RC of Xerces 3.0, so where can I find it?

I use the Xerces sources from the SVN repo:

http://svn.apache.org/repos/asf/xerces/c/trunk

comment:4 by Mateusz Łoskot, 17 years ago

Kosta,

I see. Personally, I'm not sure about fixing/supporting the very development version of Xerces, so I'd like to hear Frank's opinion.

Frank, do you like the idea about supporting Xerces SVN version?

comment:5 by Kosta, 17 years ago

OK, I see, too... :-)

But this is a trivial patch, adding only 2 missing include directives to header files that already exist in the current Xerces sources...

And I think this should be fixed, since GDAL/OGR now uses some Xerces classes/structs/types, which are defined in their Xerces header files but are never included by GDAL/OGR (only indirectly via other Xerces header files)...

comment:6 by warmerdam, 17 years ago

Mateusz,

I'm in favor of the change as long as it doesn't break anything with any of the 2.x versions. I see it as future proofing GDAL against a future Xerces 3 release.

comment:7 by Mateusz Łoskot, 17 years ago

Frank,

Understood.

Kosta,

Could you provide me with some steps how do you build Xerces from SVN?

I tried to follow official instructions for UNIX but it's not very helpful.

I set XERCESCROOT=/path/to/copy/of/xerces/trunk and I tried to run:

cd $XERCESCROOT/src/xercesc
autoconf

without any luck because here is the whole content I have there:

mloskot:~/dev/apache/xerces/_svn/trunk/src/xercesc$ ls
com  dom  framework  internal  NLS  parsers  sax  sax2  util  validators  xinclude

so I am not able to generate ./configure.

Perhaps, you used the ./configure that is available on the top-level of trunk (remote URL is: http://svn.apache.org/repos/asf/xerces/c/trunk) ?

comment:8 by Kosta, 17 years ago

Mateusz,

I built Xerces only under Windows XP/Vista using the "official" VS2005 project files.

comment:9 by pka, 17 years ago

Cc: pka added

comment:10 by Mateusz Łoskot, 17 years ago

Kosta,

I understand but if we want to support Xerces 3 we need to have it working on Unix too.

Unfortunately, I have had no luck with building Xerces under Linux. As I reported previously, the manual is not very helpful. There is ./configure already and I tried to use it but no luck:

mloskot:~/dev/apache/xerces/_svn/trunk$ ./configure
...
configure: 
configure: Report:
configure:   NetAccessor: curl
configure:   File Manager: POSIX
configure:   Atomic Op Manager: POSIX
configure:   Mutex Manager: POSIX
configure:   Message Loader: icu
configure:   Transcoder: icu

as the summary says it seems everything is correct and I try to build:

mloskot:~/dev/apache/xerces/_svn/trunk$ make
make  all-recursive
make[1]: Entering directory `/home/mloskot/dev/apache/xerces/_svn/trunk'
Making all in lib
make[2]: Entering directory `/home/mloskot/dev/apache/xerces/_svn/trunk/lib'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/mloskot/dev/apache/xerces/_svn/trunk/lib'
Making all in src
make[2]: Entering directory `/home/mloskot/dev/apache/xerces/_svn/trunk/src'
Making all in xercesc/util/MsgLoaders/ICU/resources
make[3]: Entering directory `/home/mloskot/dev/apache/xerces/_svn/trunk/src/xercesc/util/MsgLoaders/ICU/resources'
generating XercesMessages3_0_0_en_US.res
/usr/bin/genrb --package-name XercesMessages3_0_0 en_US.txt
building /obj/.libs/libXercesMessages3_0_0.so
/usr/bin/pkgdata --name XercesMessages3_0_0 --mode dll -v -d . res-file-list-unix.txt
/usr/bin/pkgdata: No -O option found, trying 'icu-config --incfile'.
/usr/bin/pkgdata: icu-config: using '-O /usr/lib/icu/3.4.1/Makefile.inc'
# Reading res-file-list-unix.txt..
Warning: Found path 'XercesMessages3_0_0_' in file name. Assuming compatibility (-E) mode.
# Output file: ./lib$(LIBNAME).so
make  -f ./XercesMessages3_0_0_dll.mak    
make[4]: Entering directory `/home/mloskot/dev/apache/xerces/_svn/trunk/src/xercesc/util/MsgLoaders/ICU/resources'
cat res-file-list-unix.txt > ./XercesMessages3_0_0_dll.lst
LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH  /usr/sbin/gencmn -c -e XercesMessages3_0_0 -n XercesMessages3_0_0 -E -t dat -d . 0 ./XercesMessages3_0_0_dll.lst
LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH  /usr/sbin/genccode -a gcc -n XercesMessages3_0_0 -e XercesMessages3_0_0 -d . XercesMessages3_0_0.dat
generating assembly code for XercesMessages3_0_0.dat
cc -g -Wall -O2 -fno-strict-aliasing   -D_REENTRANT -D_REENTRANT -I/usr/include  -c -DPIC -fPIC -o XercesMessages3_0_0_dat.o ./XercesMessages3_0_0_dat.s
rm -rf ./XercesMessages3_0_0_dat.s
cc -DHAVE_CONFIG_H  -D_REENTRANT -D_REENTRANT -I/usr/include -g -Wall -O2 -fno-strict-aliasing    -shared -o libXercesMessages3_0_0.so ./XercesMessages3_0_0_dat.o -Wl,-Bsymbolic
ls -l libXercesMessages3_0_0.so
-rwxr-xr-x 1 mloskot mloskot 107844 2007-04-25 18:25 libXercesMessages3_0_0.so
make[4]: Leaving directory `/home/mloskot/dev/apache/xerces/_svn/trunk/src/xercesc/util/MsgLoaders/ICU/resources'
mkdir -p /obj/.libs
mkdir: cannot create directory `/obj': Permission denied
make[3]: *** [/obj/.libs/libXercesMessages3_0_0.so] Error 1
make[3]: Leaving directory `/home/mloskot/dev/apache/xerces/_svn/trunk/src/xercesc/util/MsgLoaders/ICU/resources'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/mloskot/dev/apache/xerces/_svn/trunk/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/mloskot/dev/apache/xerces/_svn/trunk'
make: *** [all] Error 2
mloskot:~/dev/apache/xerces/_svn/trunk$ 

I wouldn't expect that building Xerces requires root privileges but it seems that it tries to pollute the root filesystem with compilation intermediate files:

mkdir -p /obj/.libs
mkdir: cannot create directory `/obj': Permission denied

Anyway, I posted about this issue to the xerces-c-user and as long as anyone will help to solve it, I'm moving forward with it.

comment:11 by Mateusz Łoskot, 17 years ago

Here is my post to xerces-c-user:

Building Xerces from SVN and reply.

comment:12 by Mateusz Łoskot, 17 years ago

There were a few bugs in SVN version of the Xerces 3, so it doesn't compile with GCC 4.x. I discussed it on the Xerces list and everything has been fixed. There is still a minor bug in the ./configure but I was told to disable msgloader for ICU. So, this is the command I used to build Xerces 3.0.0 (SVN) with successs:

./configure --disable-msgloader-icu  && make clean && make

Here is the command I used to configure and build GDAL with Xerces 3.0.0:

./configure --with-xerces=yes \
   --with-xerces-inc=/usr/local/include \
   --with-xerces-lib="-L/usr/local/lib -lxerces -lpthread"

make
  • GDAL built with Xerces 3.0.0 links to
$ ldd /home/mloskot/dev/gdal/_svn/trunk/gdal/libgdal.so |grep xerces
     libxerces-3.0.so => /usr/local/lib/libxerces-3.0.so (0xb6293000)
     libxerces-c.so.27 => /usr/lib/libxerces-c.so.27 (0xb4443000)
  • GDAL built with Xerces 2.7.0 links to
$ ldd /home/mloskot/dev/gdal/_svn/trunk/gdal/libgdal.so |grep xerces
     libxerces-c.so.27 => /usr/lib/libxerces-c.so.27 (0xb626c000)

I also run autotest cases for GML against both versions and everything works.

comment:13 by Mateusz Łoskot, 17 years ago

Resolution: fixed
Status: assignedclosed

The patch has been applied (r11354).

Note: See TracTickets for help on using tickets.