Hello Roger,

On Sat, 26 Dec 2020 09:28:16 +0000 Roger Leigh <rle...@codelibre.net> wrote:

> On 22 Dec 2020, at 08:27, wwp <subscr...@free.fr> wrote:
> > 
> > I'm attempting to build Xalan-C++ 1.12 following the build steps found at:
> >  https://apache.github.io/xalan-c/build.html
> > 
> > Build environment:
> > CentOS 7 (up-to-date), cmake3 version 3.17.3, gcc 8.2.0
> > Xerces-C++ 3.2.3 build from the sources, using autotools and these 
> > configure options:
> >  ./configure --disable-rpath --disable-network --without-icu 
> > --prefix=/mypath/xerces/3.2.3 
> > 
> > 1. cmake won't detect the C compiler properly (but do we care?):
> > 
> > $ mkdir build && cd build
> > $ cmake3 -DCMAKE_INSTALL_PREFIX=$TOOLS/xalan-c-1.12 -Dtranscoder=default ..
> > 
> > [snip]
> > -- The C compiler identification is GNU 4.8.5
> > -- The CXX compiler identification is GNU 8.2.0
> > [snip]
> > 
> > The system C compiler *is* gcc 4.8.5, but the one first found on the PATH 
> > is gcc 8.2.0.
> > What wrong magics is performed there? Do we care anyway?
> >   
> 
> Check your PATH, it should be picking up 8.2.0 if it’s first in the search 
> path.  Otherwise set CMAKE_XXX_COMPILER to override the defaults.
> 
> This isn’t Xerces/Xalan-specific, and I’ve used GCC on CentOS without trouble 
> for years using the devtoolset toolchains.  CMake always detected the 
> compiler perfectly, but it will depend upon it being able to find it.  Maybe 
> you don’t have a C++ compiler installed on the main system, so 8.2.0 was the 
> only possibility?

I just need gcc 8.2.0 in my build env, the reasons why I need it are
off-topic here.

But see:

$ type gcc
gcc is /mypath/gcc/8.2.0/bin/gcc
$ type g++
g++ is /mypath/gcc/8.2.0/bin/g++

cmake will display this:

-- The C compiler identification is GNU 4.8.5      (<- that's the system one, 
not the one found first on PATH)
-- The CXX compiler identification is GNU 8.2.0    (<- that's OK and expected)

With -DCMAKE_C_COMPILER=/mypath/gcc/8.2.0/bin/gcc, it works like I
want (I don't need CMAKE_CXX_COMPILER):

-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0

But something seems wrong in the C compiler identification performed
by cmake3.



> > 2. cmake won't detect Xerces-C++ 3.2.3:
> > 
> > [snip]
> > CMake Error at 
> > /usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
> >  Failed to find XercesC (missing: XercesC_LIBRARY XercesC_INCLUDE_DIR
> >  XercesC_VERSION) (Required is at least version "3.1")
> > [snip]
> > 
> > Obviously it doesn't use PKG_CONFIG_PATH to find it, which is wrong if 
> > xerces-C++ has been built using autotools (this is the recommended method 
> > on GNU/Linux).  
> 
> pkg-config and the build method used for Xerces-C++ are irrelevant.  Xalan is 
> using FindXercesC 
> (https://cmake.org/cmake/help/latest/module/FindXercesC.html 
> <https://cmake.org/cmake/help/latest/module/FindXercesC.html>) and will will 
> detect it if it can find it.
> 
> Did you set CMAKE_PREFIX_PATH to include /mypath/xerces/3.2.3?  If not, add 
> that to the cmake command-line and it should detect it without trouble.

Using CMAKE_PREFIX_PATH did it!


> > I solved it using:
> > $ cmake3 -DCMAKE_INSTALL_PREFIX=$TOOLS/xalan-c-1.12 -Dtranscoder=default 
> > -DXercesC_VERSION=3.2.3 -DXercesC_LIBRARY="-L/mypath/xerces/3.2.3/lib" 
> > -DXercesC_INCLUDE_DIR=$TOOLS/xerces/3.2.3/include ..
> > 
> > But I'm not sure this will work, probably missing a -lxerces-c in 
> > XercesC_LIBRARY.  
> 
> None of this should be necessary.  Though if you do go this way (not 
> recommended) the _LIBRARY setting should be the full path to the library, 
> rather than the directory containing the library.

OK.


> > 3. ICU seems required or checked whereas I explicitly want the built-in
> > transcoder (default).
> > 
> > Does this mean that the ICU libraries are mandatory? The build doc page
> > says "ICU C++ libraries and headers (optional)". Why does cmake check
> > for ICU libraries if they are optional and the transcoder explicitely
> > set NOT to use ICU?  
> 
> ICU is optional.

Good!


> But it will be used if available because it offers more functionality and 
> provides better behaviour than without.

That's up to the one who build to decide, or it should be made mandatory.


> > Note that if I remove the system ICU dev files, I'll get:
> > 
> > -- The following ICU libraries were not found:
> > --   uc (required)
> > --   data (required)
> > --   i18n (required)
> > -- Failed to find all ICU components (missing: ICU_INCLUDE_DIR
> > ICU_LIBRARY _ICU_REQUIRED_LIBS_FOUND)
> > 
> > Anyway, the cmake configure step does not fail.  
> 
> That’s expected.

OK.


> Look at cmake/XalanTranscoderSelection.cmake.  “icu" is first in the
> list, followed by “default”.  If ICU is autodetected, it will take
> precedence.  To be fair “default” is a misnomer; it should probably
> be “internal” or something else which better describes it.
> 
> Use “-Dtranscoder=default” to explicitly set what you want.

I use that, this is well documented.


> > 4. is there a way NOT to build the docs?
> > 
> > I could not find such a way. I don't need them, doc build
> > requirements are not clear or even specified anywhere I could find,
> > and it fails here anyway (rule xalan-c-doc-check).
> > 
> > [skipping a huge UNDOCUMENTED CODE section]
> > [  0%] Built target xalan-c-doc-check
> > make: *** [all] Error 2  
> 
> 
> This is the Doxygen API reference.  Use "-DBUILD_DOXYGEN=OFF” to
> disable.
> 
> The doc check is a warning only; this wasn’t necessarily the direct
> cause of the failure—I’d need to see more context here to see exactly
> what caused the failure.

Using "-DBUILD_DOXYGEN=OFF” did it, probably because my doxygen version
is outdated (doxygen-1.8.5-4.el7.x86_64).

Roger, thanks a bunch for your precise and detailed help, I really
appreciate.


Regards,

-- 
wwp
https://useplaintext.email/

Attachment: pgpo8LkqTQtKZ.pgp
Description: OpenPGP digital signature

Reply via email to