Problem 2003 - XML-related compilation error with 10.03.p0[1,2]
Summary: XML-related compilation error with 10.03.p0[1,2]
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: analysis (show other problems)
Version: 10.3
Hardware: PC Linux
: P2 major
Assignee: Ivana.Hrivnacova
URL:
Depends on:
Blocks:
 
Reported: 2017-09-06 14:55 CEST by Nicola Mori
Modified: 2017-12-12 22:16 CET (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Nicola Mori 2017-09-06 14:55:24 CEST
On my system (Scientific Linux 5 32 bit with custom-built gcc 6.3.0) I get this error when compiling version 10.03.p02 with -DGEANT4_USE_GDML=ON (with both Xerces-C versions 3.1.4 ans 3.2.0):


In file included from /wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/raxml:9:0,
                 from /wizard/02/software/source/geant4.10.03.p02/source/analysis/xml/include/G4XmlAnalysisReader.hh:44,
                 from /wizard/02/software/source/geant4.10.03.p02/source/analysis/xml/src/G4XmlAnalysisReader.cc:30:
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader: In member function 'bool tools::xml::loader::parse_buffer(size_t, const char*, XML_StartElementHandler, XML_EndElementHandler, void*)':
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:221:9: error: 'XML_Index' was not declared in this scope
        {XML_Index pos = XML_GetCurrentByteIndex(_parser);
         ^~~~~~~~~

The error is present also in version 10.03.p01.
Comment 1 Nicola Mori 2017-09-06 15:06:52 CEST
The error persists also with -DGEANT4_USE_GDML=OFF, so it's probably unrelated with this setting (and maybe also with the Xerces-C version). This is the full invocation of the compiler and error message obtained with make VERBOSE=1:

[  6%] Building CXX object source/analysis/CMakeFiles/G4analysis.dir/xml/src/G4XmlAnalysisReader.cc.o
cd /wizard/02/software/source/geant4.10.03.p02.build/source/analysis && /wizard/02/software/install/GCC_6.3.0/bin/c++   -DG4VERBOSE -DG4_STORE_TRAJECTORY -DG4analysis_EXPORTS -DGEANT4_DEVELOPER_Release -I/wizard/02/software/source/geant4.10.03.p02/source/externals/clhep/include -I/wizard/02/software/source/geant4.10.03.p02/source/global/management/include -I/wizard/02/software/source/geant4.10.03.p02/source/intercoms/include -I/wizard/02/software/source/geant4.10.03.p02/source/analysis/accumulables/include -I/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include -I/wizard/02/software/source/geant4.10.03.p02/source/analysis/management/include -I/wizard/02/software/source/geant4.10.03.p02/source/analysis/hntools/include -I/wizard/02/software/source/geant4.10.03.p02/source/analysis/csv/include -I/wizard/02/software/source/geant4.10.03.p02/source/externals/zlib/include -I/wizard/02/software/source/geant4.10.03.p02.build/source/externals/zlib -I/wizard/02/software/source/geant4.10.03.p02/source/run/include -I/wizard/02/software/source/geant4.10.03.p02/source/analysis/root/include -I/wizard/02/software/source/geant4.10.03.p02/source/analysis/xml/include  -W -Wall -pedantic -Wno-non-virtual-dtor -Wno-long-long -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wno-variadic-macros -Wshadow -pipe -DG4USE_STD11 -O3 -DNDEBUG -fno-trapping-math -ftree-vectorize -fno-math-errno -fPIC   -std=c++11 -o CMakeFiles/G4analysis.dir/xml/src/G4XmlAnalysisReader.cc.o -c /wizard/02/software/source/geant4.10.03.p02/source/analysis/xml/src/G4XmlAnalysisReader.cc
In file included from /wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/raxml:9:0,
                 from /wizard/02/software/source/geant4.10.03.p02/source/analysis/xml/include/G4XmlAnalysisReader.hh:44,
                 from /wizard/02/software/source/geant4.10.03.p02/source/analysis/xml/src/G4XmlAnalysisReader.cc:30:
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader: In member function 'bool tools::xml::loader::parse_buffer(size_t, const char*, XML_StartElementHandler, XML_EndElementHandler, void*)':
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:221:9: error: 'XML_Index' was not declared in this scope
        {XML_Index pos = XML_GetCurrentByteIndex(_parser);
         ^~~~~~~~~
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:222:19: error: expected ';' before 'pmn'
         XML_Index pmn = tools::mx<XML_Index>(pos-10,0);
                   ^~~
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:223:19: error: expected ';' before 'pmx'
         XML_Index pmx = tools::mn<XML_Index>(pos+10,XML_Index(aSize)-1);
                   ^~~
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:225:23: error: expected ';' before 'p'
        {for(XML_Index p=pmn;p<=pmx;p++) {c[0] = *(aBuffer+p);m_out << c;}
                       ^
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:225:29: error: 'p' was not declared in this scope
        {for(XML_Index p=pmn;p<=pmx;p++) {c[0] = *(aBuffer+p);m_out << c;}
                             ^
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:225:32: error: 'pmx' was not declared in this scope
        {for(XML_Index p=pmn;p<=pmx;p++) {c[0] = *(aBuffer+p);m_out << c;}
                                ^~~
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:227:23: error: expected ';' before 'p'
        {for(XML_Index p=pmn;p<pos;p++) m_out << " ";
                       ^
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:227:29: error: 'p' was not declared in this scope
        {for(XML_Index p=pmn;p<pos;p++) m_out << " ";
                             ^
/wizard/02/software/source/geant4.10.03.p02/source/analysis/g4tools/include/tools/xml/loader:227:31: error: 'pos' was not declared in this scope
        {for(XML_Index p=pmn;p<pos;p++) m_out << " ";
                               ^~~
make[2]: *** [source/analysis/CMakeFiles/G4analysis.dir/xml/src/G4XmlAnalysisReader.cc.o] Error 1
make[2]: Leaving directory `/wizard/02/software/source/geant4.10.03.p02.build'
make[1]: *** [source/analysis/CMakeFiles/G4analysis.dir/all] Error 2
make[1]: Leaving directory `/wizard/02/software/source/geant4.10.03.p02.build'
make: *** [all] Error 2
Comment 2 Nicola Mori 2017-09-07 12:21:49 CEST
    I found that he problem is due to the fact that in my build the system expat is used, which is rather old:

      -- Found EXPAT: /usr/lib/libexpat.so (found version "1.95.8")

    and which does not contain the XML_Index typedef in expat_external.h. I think that the CMake configuration should enforce a minimum required version for system expat in order to avoid this problem.
    Anyway, configuring the build with internal expat using -DGEANT4_USE_SYSTEM_EXPAT=OFF fixes the build.
Comment 3 Ben Morgan 2017-09-14 17:29:23 CEST
A version check on the system expat has been introduced in tag cmake-V10-03-36 (will be in 10.4 and any additional patches to 10.3). If the system version isn't sufficient, then an error will be emitted indicating the issue and recommending the use of the vendor "G4expat". The minimum version of expat supported has been identified as 2.0.1.

Ivana, this can be marked as RESOLVED FIXED.
Comment 4 Ivana.Hrivnacova 2017-12-12 22:16:29 CET
Closing