Ticket #1988 (closed defect: fixed)

Opened 1 year ago

Last modified 10 months ago

If Xerces is on by default, the Xerces include dir is not correct

Reported by: ajolma Assigned to: mloskot
Priority: normal Milestone: 1.5.0
Component: ConfigBuild Version: svn-trunk
Severity: normal Keywords: xerces
Cc: warmerdam, dron

Description

Xerces seems to get included by default if Xerces is installed in a system. However, in configure.in with_xerces remains empty unless it is "yes". The result is that XERCES_INCLUDE becomes -I/include and not -I/usr/include as it should. Some of this is visible in my build.log (Fedora 7 with xerces-c and xerces-c-devel): http://map.hut.fi/files/Geoinformatica/snapshots/build.log

Attachments

config.log (127.6 kB) - added by whatnick on 12/08/07 06:18:41.
MingW Config log

Change History

11/13/07 10:44:02 changed by warmerdam

  • status changed from new to closed.
  • cc set to mloskot, dron.
  • component changed from default to ConfigBuild.
  • version changed from unspecified to svn-trunk.
  • keywords set to xerces.
  • resolution set to fixed.

Ari,

I think Andrey has corrected this problem with r12747 and r12744. Please reopen if the problem persists.

11/15/07 09:19:47 changed by mloskot

  • status changed from closed to reopened.
  • resolution deleted.

I'm reopening this ticket because recent changes seem to introduce new issues.

Now, when using all 3 options together, the --with-xerces=yes causes the remaining two options are skipped automatically without parsing and re-running Xerces files detection in custom location:

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

I think the fix in r12747 is not good, because of two issues:

  • Setting with_xerces=no in line 1410 causes that condition in line 1415 is fails what prevents form testing passed include location and lib flags.
  • Not throwing detection failure if --with-xerces=yes is passed might be confusing, becasue user does not get any information about what's the reason Xerces has not been detected.

I'm going to attach patch re-fixing this problem.

11/15/07 09:27:22 changed by warmerdam

  • status changed from reopened to new.
  • owner changed from warmerdam to mloskot.
  • cc changed from mloskot, dron to warmerdam, dron.
  • milestone set to 1.5.0.

Over to Mateusz to take care of.

11/15/07 22:41:17 changed by mloskot

  • status changed from new to assigned.

11/15/07 22:43:28 changed by mloskot

  • status changed from assigned to closed.
  • resolution set to fixed.

I've completely rewritten Xerces detection script and now it's available through external macro AX_LIB_XERCES located in gdal/m4/ax_xerces.m4.

The new version have been applied only to trunk (r12798)

How to request Xerces C++ Parser support with ./configure:

  1. Using no Xerces options:
    ./configure 
    

to implicitly ask it to detect Xerces under standard prefixes

  1. Using single option, variant 1:
    ./configure --with-xerces (or --with-xerces=yes)
    

to achieve the same effect as the command above

  1. Using single option, variant 2:
    ./configure --with-xerces=/usr/local/xerces-2.8.0
    

to detect Xerces under custom prefix /usr/local/xerces-2.8.0

  1. Using all three options together to a) request the Xerces support and b) tell the script where to look for headers and library files:
    ./configure --with-xerces=yes --with-xerces-inc=/incorrect/path --with-xerces-lib="-L/usr/local/xerces-2.8.0/lib -lxerces-c -lpthread"
    

In this 4th case, --with-xerces=yes is mandatory and its value must be yes, otherwise the two options --with-xerces-inc and --with-xerces-lib will be ignored automatically and Xerces detection will likely fail.

Summarizing, user must use single option --with-xerces (with values: yes, no or prefix path) or all three options together, no other combination is supported.

The main tests of Xerces detection script were run on Mac OS X 10.4 with Xerces installed under custom prefix: /usr/local/xerces-2.8.0

$ tree -d /usr/local/xerces-2.8.0
/usr/local/xerces-2.8.0
|-- include
|   `-- xercesc
|       |-- dom
|       |   |-- deprecated
|       |   `-- impl
|       |-- framework
|       |   `-- psvi
|       |-- internal
|       |-- parsers
|       |-- sax
|       |-- sax2
|       |-- util
|       |   |-- Compilers
|       |   |-- MsgLoaders
|       |   |   `-- InMemory
|       |   |-- NetAccessors
|       |   |   `-- Socket
|       |   |-- Platforms
|       |   |   `-- MacOS
|       |   |-- Transcoders
|       |   |   `-- MacOSUnicodeConverter
|       |   `-- regx
|       `-- validators
|           |-- DTD
|           |-- common
|           |-- datatype
|           `-- schema
|               `-- identity
`-- lib

I've run the same test againt Xerces 2.7.0 installed under prefix /usr/local/xerces-2.7.0 and Xerces 3.0.0 (SVN) installed in /usr/local/xerces-3.0.0.

Tests of different combinations of Xerces C++ Parser options provided by ./configure script:

  1. Xerces support requested implicitly (default behavior). Xerces availability is checked under standard prefixes /usr and /usr/local (in this example, there is no Xerces in there, but in custom location /usr/local/xerces-2.8.0, so detection fails but gracefully)
    ./configure
    
    checking for Xerces C++ Parser... no
    
  1. Xerces requested explicitly and expected to be found under standard prefixes (/usr or /usr/local)
    ./configure --with-xerces=yes (or --with-xerces)
    
    checking for Xerces C++ Parser... no
    configure: WARNING: Xerces C++ Parser support requested but headers or library not found. Specify valid prefix of Xerces C++ using --with-xerces=[DIR] or provide headers and linker flags using --with-xerces-inc and --with-xerces-lib
    
  1. Explicitly request to disable Xerces support
    ./configure --with-xerces=no (or --without-xerces)
    
    checking for Xerces C++ Parser... no
    
  1. Xerces requested explicitly by specifying valid custom installation prefix
    ./configure --with-xerces=/usr/local/xerces-2.8.0
    
    checking for Xerces C++ Parser headers in /usr/local/xerces-2.8.0/include and /usr/local/xerces-2.8.0/include/xercesc... found
    checking for Xerces C++ Parser libraries... found
    checking for Xerces C++ Parser... yes
    checking if Xerces C++ Parser version is >= 2.7.0... yes
    
  1. Xerces requested explicitly using (incorrect) installation prefix (--with-xerces option) together with include and lib options. Detection fails because value of --with-xerces option is not set to yes, so next two options are ignored automatically. If value of --with-xerces is not yes then it's considered to be an installation prefix (but the path is incorrect in this example, no Xerces lives there)
    ./configure --with-xerces=/usr/local --with-xerces-inc=/usr/local/xerces-2.8.0/include --with-xerces-lib="-L/usr/local/xerces-2.8.0/lib -lxerces-c -lpthread"
    
    checking for Xerces C++ Parser headers in /usr/local/include and /usr/local/include/xercesc... not found
    checking for Xerces C++ Parser... no
    
  1. Similar example to the one above, Xerces requested explicitly but --with-xerces=yes is missing, so latter two options are ignored
    ./configure --with-xerces-inc=/usr/local/xerces-2.8.0/include --with-xerces-lib="-L/usr/local/xerces-2.8.0/lib -lxerces-c -lpthread"
    
    checking for Xerces C++ Parser... no
    
  1. Xerces requested explicitly but --with-xerces-lib option with linker flags is missing
    ./configure --with-xerces=yes --with-xerces-inc=/usr/local/xerces-2.8.0/include
    
    checking for Xerces C++ Parser... no
    configure: WARNING: Xerces C++ Parser support requested but headers or library not found. Specify valid prefix of Xerces C++ using --with-xerces=[DIR] or provide headers and linker flags using --with-xerces-inc and --with-xerces-lib
    
  1. Xerces requested explicitly but using invalid include path, then linker flags are ignored even if correct
    ./configure --with-xerces=yes --with-xerces-inc=/incorrect/path --with-xerces-lib="-L/usr/local/xerces-2.8.0/lib -lxerces-c -lpthread"
    
    checking for Xerces C++ Parser headers in /incorrect/path and /incorrect/path/xercesc... not found
    checking for Xerces C++ Parser... no
    
  1. Xerces requested explicitly using valid include path but invalid linker flags
    ./configure --with-xerces=yes --with-xerces-inc=/usr/local/xerces-2.8.0/include --with-xerces-lib="incorrect flags"
    
    checking for Xerces C++ Parser headers in /usr/local/xerces-2.8.0/include and /usr/local/xerces-2.8.0/include/xercesc... found
    checking for Xerces C++ Parser libraries... not found
    checking for Xerces C++ Parser... no
    
  1. Xerces requested explicitly using valid include path but valid linker flags
    ./configure --with-xerces=yes --with-xerces-inc=/usr/local/xerces-2.8.0/include --with-xerces-lib="-L/usr/local/xerces-2.8.0/lib -lxerces-c -lpthread"
    
    checking for Xerces C++ Parser headers in /usr/local/xerces-2.8.0/include and /usr/local/xerces-2.8.0/include/xercesc... found
    checking for Xerces C++ Parser libraries... found
    checking for Xerces C++ Parser... yes
    checking if Xerces C++ Parser version is >= 2.7.0... yes
    
  1. Xerces disabled explicitly by using --with-xerces=no, include and lib flags are ignored automatically
    ./configure --with-xerces=no --with-xerces-inc=/usr/local/xerces-2.8.0/include --with-xerces-lib="-L/usr/local/xerces-2.8.0/lib -lxerces-c -lpthread"
    
    checking for Xerces C++ Parser... no
    

A note about Xerces version requirement. It's possible to set (or not) minimal version requirement when calling AX_LIB_XERCES macro inside the configure.in. Currently, this requirement is set to Xerces 2.7.0 and if you try to use older version, for example 2.5.0, you might encounter warning like this:

checking for Xerces C++ Parser headers in /usr/local/xerces-2.5.0/include and /usr/local/xerces-2.5.0/include/xercesc... found
checking for Xerces C++ Parser libraries... found
checking for Xerces C++ Parser... yes
checking if Xerces C++ Parser version is >= 2.7.0... no
configure: WARNING: Found Xerces C++ Parser 2.5.0, which is older than required. Possible compilation failure.

I'm closing this ticket.

12/07/07 22:52:03 changed by whatnick

  • status changed from closed to reopened.
  • resolution deleted.

The Xerces detection is failing for MingW with the following configure line: CPPFLAGS=-DXML_LIBRARY ./configure --with-python --with-local --with-grass=/local/grass-6.3.0cvs --with-expat=yes --with-xerces=yes --with-pg=/local/pgsql/bin/pg_config.exe It was working in the older simpler version, that CPPFLAG in the beginning needs to be set for Xerces to work in MingW. Also Expat detection is failing and used to work.

12/08/07 06:18:41 changed by whatnick

  • attachment config.log added.

MingW Config log

12/09/07 08:36:32 changed by whatnick

Revision 12797 detects Xerces(and Expat) on MingW and works. could you include a failsafe simple test which is a baseline check and could be enabled somehow ?

12/09/07 12:49:15 changed by mloskot

  • status changed from reopened to closed.
  • resolution set to fixed.

We've discussed it in details on #qgis channel with whatnick. We tried to build very simple program using Xerces (as well as Expat) without any dependency on GDAL. MinGW failed on linking against Xerces (Expat). Because MinGW is not supported, I'm not inclined to test it myself but wait for someone who is able to find out why MinGW is failing and provide patches if necessary.

I'm closing this ticket as fixed.