You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by wwp <su...@free.fr> on 2020/12/22 08:27:14 UTC

Xalan-C++ 1.12 cmake configuration and build issues

Hello,


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 

gcc 8.2.0:
$ export LD_LIBRARY_PATH=/mypath/gcc/8.2.0/lib64:$LD_LIBRARY_PATH
$ export PATH=/mypath/gcc/8.2.0/bin:$PATH

$ export PKG_CONFIG_PATH=/mypath/xerces/3.2.3/lib/pkgconfig:$PKG_CONFIG_PATH

I'm describing the issues and questions I've had during my attempt to
configure and build Xalan-C++ 1.12..


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?


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).

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.


3. ICU seems required or checked whereas I explicitly want the built-in
transcoder (default).

I come up to here:

-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /usr/lib64/ccache/cc
-- Check for working C compiler: /usr/lib64/ccache/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/lib64/ccache/c++
-- Check for working CXX compiler: /usr/lib64/ccache/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring Apache Xalan-C++ version 1.12.0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Doxygen: /bin/doxygen (found version "1.8.5") found components: doxygen dot
-- Performing Test CXX_FLAG_Wall
-- Performing Test CXX_FLAG_Wall - Success
-- Performing Test CXX_FLAG_Wcast_align
-- Performing Test CXX_FLAG_Wcast_align - Success
-- Performing Test CXX_FLAG_Wcast_qual
-- Performing Test CXX_FLAG_Wcast_qual - Success
-- Performing Test CXX_FLAG_Wctor_dtor_privacy
-- Performing Test CXX_FLAG_Wctor_dtor_privacy - Success
-- Performing Test CXX_FLAG_Wextra
-- Performing Test CXX_FLAG_Wextra - Success
-- Performing Test CXX_FLAG_Wformat_2
-- Performing Test CXX_FLAG_Wformat_2 - Success
-- Performing Test CXX_FLAG_Wimplicit_atomic_properties
-- Performing Test CXX_FLAG_Wimplicit_atomic_properties - Failed
-- Performing Test CXX_FLAG_Wmissing_declarations
-- Performing Test CXX_FLAG_Wmissing_declarations - Success
-- Performing Test CXX_FLAG_Wno_long_long
-- Performing Test CXX_FLAG_Wno_long_long - Success
-- Performing Test CXX_FLAG_Woverlength_strings
-- Performing Test CXX_FLAG_Woverlength_strings - Success
-- Performing Test CXX_FLAG_Woverloaded_virtual
-- Performing Test CXX_FLAG_Woverloaded_virtual - Success
-- Performing Test CXX_FLAG_Wredundant_decls
-- Performing Test CXX_FLAG_Wredundant_decls - Success
-- Performing Test CXX_FLAG_Wreorder
-- Performing Test CXX_FLAG_Wreorder - Success
-- Performing Test CXX_FLAG_Wswitch_default
-- Performing Test CXX_FLAG_Wswitch_default - Success
-- Performing Test CXX_FLAG_Wunused_variable
-- Performing Test CXX_FLAG_Wunused_variable - Success
-- Performing Test CXX_FLAG_Wwrite_strings
-- Performing Test CXX_FLAG_Wwrite_strings - Success
-- Performing Test CXX_FLAG_Wno_variadic_macros
-- Performing Test CXX_FLAG_Wno_variadic_macros - Success
-- Performing Test CXX_FLAG_fstrict_aliasing
-- Performing Test CXX_FLAG_fstrict_aliasing - Success
-- Looking for signal
-- Looking for signal - found
-- Looking for SetConsoleCtrlHandler
-- Looking for SetConsoleCtrlHandler - not found
-- Looking for usleep
-- Looking for usleep - found
-- Looking for Sleep
-- Looking for Sleep - not found
-- Looking for gmtime_r
-- Looking for gmtime_r - found
-- Looking for localtime_r
-- Looking for localtime_r - found
-- Looking for _create_locale
-- Looking for _create_locale - not found
-- Looking for isnan
-- Looking for isnan - found
-- Looking for _isnan
-- Looking for _isnan - not found
-- Performing Test XALAN_HAVE_STD_ISNAN
-- Performing Test XALAN_HAVE_STD_ISNAN - Success
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for direct.h
-- Looking for direct.h - not found
-- Found the following ICU libraries:
--   uc (required)
--   data (required)
--   i18n (required)
-- Found ICU: /usr/include (found version "50.2")
-- Found XercesC: -L/mypath/xerces/3.2.3/lib (found suitable version "3.2.3", minimum required is "3.1")
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Performing Test XALAN_HAVE_STD_THREAD
-- Performing Test XALAN_HAVE_STD_THREAD - Success
-- Looking for C++ include nl_types.h
-- Looking for C++ include nl_types.h - found
-- Looking for catopen
-- Looking for catopen - found
-- Looking for catclose
-- Looking for catclose - found
-- Looking for catgets
-- Looking for catgets - found
-- Performing Test CXX_matching-delete-operator
-- Performing Test CXX_matching-delete-operator - Success
-- Performing Test HAVE_PATH_MAX
-- Performing Test HAVE_PATH_MAX - Success
--
-- Xalan-C++ configuration summary
-- -------------------------------
--
--   Version:                     1.12.0
--   Library major version:       112
--   Library minor version:       0
--
--   Installation directory:      /mypath/xalan-c-1.12
--   C compiler:                  /usr/lib64/ccache/cc
--   C++ compiler:                /usr/lib64/ccache/c++
--
--   Build shared libraries:      ON
--   Thread implementation:       standard
--   Transcoder:                  default
--   Message Loader:              inmemory
--   Message Loader Locale:       en_US
-- Configuring done
-- Generating done
-- Build files have been written to: /mypath/build/xalan-c-1.12/build

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?

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.


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


Regards,

-- 
wwp
https://useplaintext.email/

Re: Xalan-C++ 1.12 cmake configuration and build issues

Posted by wwp <su...@free.fr>.
Hello Roger,


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

> On 22 Dec 2020, at 08:27, wwp <su...@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/

Re: Xalan-C++ 1.12 cmake configuration and build issues

Posted by Roger Leigh <rl...@codelibre.net>.
On 22 Dec 2020, at 08:27, wwp <su...@free.fr> wrote:
> 
> Hello,
> 
> 
> 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?

> 
> 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.


> 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.

> 
> 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.  But it will be used if available because it offers more functionality and provides better behaviour than without.

> 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.

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.

> 
> 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.


Regards,
Roger