XERCES not found

All about Linux portage
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: XERCES not found

Post by daniel »

Have you checked the 'advanced' checkbox? And typed 'Xerces' in the Search field?
Daniel, CloudCompare admin
jgpallero
Posts: 44
Joined: Thu Dec 12, 2013 2:00 pm

Re: XERCES not found

Post by jgpallero »

daniel wrote:Have you checked the 'advanced' checkbox? And typed 'Xerces' in the Search field?
Thank you for your answer. I clicked now the advanced option and now I can see the Xerces_INCLUDE_DIR in the 'Ungrouped entries' group, but only this Xerces_INCLUDE_DIR and the XERCES_ROOT. Putting the correct path in Xerces_INCLUDE_DIR and also in XERCES_ROOT (and also if I doesn't put it) I obtain the same error:

Code: Select all

CMake Error at contrib/E57Support.cmake:36 (message):
  Unable to find Xerces library.  Please make XERCES_ROOT point to the root
  of Xerces directory.
Call Stack (most recent call first):
  contrib/AllSupport.cmake:8 (include)
  CMakeLists.txt:68 (include)
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: XERCES not found

Post by daniel »

I guess you'll have to find where this 'XERCES_ROOT' variable is defined and how it is used...
Daniel, CloudCompare admin
jgpallero
Posts: 44
Joined: Thu Dec 12, 2013 2:00 pm

Re: XERCES not found

Post by jgpallero »

daniel wrote:I guess you'll have to find where this 'XERCES_ROOT' variable is defined and how it is used...
I interpret the XERCES_ROOT option as for example the LIBE57_INSTALL_DIR, i.e., as the path to the xserces installation. For example, I've installed my libe57 in /opt/e57 and the configuration runs OK for /apt/e57 being the value of LIBE57_INSTALL_DIR. I've installed my xerces in /opt/xercesc, so I've put this path in XERCES_ROOT and /opt/xercesc/include/ in Xerces_INCLUDE_DIR
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: XERCES not found

Post by daniel »

I mean you should look for the CMake script that issues this error (even when you input the 'right' Xerces folder) in order to understand what is expected.

This is not a CC script at least (up to my knowledge).

On Windows, I can leave this variable empty if I fill the other ones (XERCES_LIBRARY_XXX, etc.).
Daniel, CloudCompare admin
jgpallero
Posts: 44
Joined: Thu Dec 12, 2013 2:00 pm

Re: XERCES not found

Post by jgpallero »

The part in E57Support.cmake about Xerces search is

Code: Select all

	# Find Xerces
	# we use libE57 own Xerces find module
	set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/contrib/cmake/Modules/" )

	set( Xerces_USE_STATIC_LIBS ON )
	find_package( Xerces QUIET )
	if ( NOT Xerces_FOUND )
		set( XERCES_ROOT CACHE PATH "Location of the Xerces library" )
		message( FATAL_ERROR "Unable to find Xerces library. Please make XERCES_ROOT point to the root of Xerces directory." )
	else()
		include_directories( ${Xerces_INCLUDE_DIR} ${Boost_INCLUDE_DIR} )
	endif()
I think the line

Code: Select all

set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/contrib/cmake/Modules/" )
points to trunk-2.6.1/contrib/cmake/Modules/ in order to use the FindXerces.cmake script, which is the one you say comes from E57, I think. I'm not an expert using CMAKE, so I can't interpret anymore
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: XERCES not found

Post by daniel »

Apparently the script looks for the file 'xercesc/sax2/SAX2XMLReader.hpp' under 'XERCES_ROOT/include'.

Then it defines:
  • Xerces_INCLUDE_DIR
  • Xerces_LIBRARY_DEBUG
  • Xerces_LIBRARY_RELEASE
And the error message is issued if those 3 variables are not defined.
Daniel, CloudCompare admin
jgpallero
Posts: 44
Joined: Thu Dec 12, 2013 2:00 pm

Re: XERCES not found

Post by jgpallero »

Finally, I've reached to configure CC, but in a dirty way. I'll try to explain how I did:

First, I commented some lines in E57Support.cmake in order to omit some checks and assume that the Xerces_INCLUDE_DIR exists:

Code: Select all

# Find Xerces
	# we use libE57 own Xerces find module
	set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/contrib/cmake/Modules/" )

	set( Xerces_USE_STATIC_LIBS ON )
	find_package( Xerces QUIET )
# 	if ( NOT Xerces_FOUND )
# 		set( XERCES_ROOT CACHE PATH "Location of the Xerces library" )
# 		message( FATAL_ERROR "Unable to find Xerces library. Please make XERCES_ROOT point to the root of Xerces directory." )
# 	else()
		include_directories( ${Xerces_INCLUDE_DIR} ${Boost_INCLUDE_DIR} )
# 	endif()
Then, I commented also some lines in FindXerces.cmake in order to set the XERCES_ROOT directly in the cmake:

Code: Select all

# if( NOT $ENV{XERCES_ROOT} STREQUAL "" )
    set(XERCES_ROOT "/opr/xercesc/")
# endif()
I don't kno why the check if( NOT $ENV{XERCES_ROOT} STREQUAL "" ) does not pass although XERCES_ROOT is set in cmake.gui

In cmake-gui also set the Xerces_INCLUDE_DIR.

Then, I configure and I only obtain some 'project developers' warnings, but the configuration is done. The warning is

Code: Select all

CMake Warning (dev) at contrib/E57Support.cmake:57 (target_link_libraries):
  Link library type specifier "debug" is followed by specifier "optimized"
  instead of a library name.  The first specifier will be ignored.
Call Stack (most recent call first):
  contrib/AllSupport.cmake:33 (target_link_LIBE57)
  ccViewer/CMakeLists.txt:96 (target_link_contrib)
This warning is for project developers.  Use -Wno-dev to suppress it.
Now, I generate the makefile and execute it. I obtain several errors:

First, I obtain this error:

Code: Select all

[ 25%] Building CXX object libs/qCC_io/CMakeFiles/QCC_IO_LIB.dir/E57Filter.cpp.o
/home/topo/Desktop/trunk-2.6.1/libs/qCC_io/E57Filter.cpp:26:31: fatal error: E57/E57Foundation.h: No existe el fichero o el directorio
 #include <E57/E57Foundation.h>
                               ^
compilation terminated.
The problem is that in the E75 installation, inside the include file the subfolder 'e57' is created, but the file E57Filter.cpp in CC considers that the subfolder is E57, in capital letters. This error can be avoided changing the subfolder name in the E57 installation or changing the include in the CC file

The second error is:

Code: Select all

[ 20%] Building CXX object libs/qCC_io/CMakeFiles/QCC_IO_LIB.dir/E57Filter.cpp.o
In file included from /home/topo/Desktop/trunk-2.6.1/libs/qCC_io/E57Filter.cpp:23:0:
/home/topo/Desktop/trunk-2.6.1/libs/qCC_io/E57Header.h:4:27: fatal error: E57Foundation.h: No existe el fichero o el directorio
 #include <E57Foundation.h>
                           ^
So there is another CC file with a wrong include. It can be fixed changing the line

Code: Select all

#include <E57Foundation.h>
to

Code: Select all

#include <e57/E57Foundation.h>
in E57Filter.cpp

Finally, the last error is

Code: Select all

[ 23%] Building CXX object libs/qCC_io/CMakeFiles/QCC_IO_LIB.dir/moc_AsciiOpenDlg.cxx.o
make[2]: *** No rule to make target '/opt/e57/lib/E57RefImpl.lib', needed by 'libs/qCC_io/libQCC_IO_LIB.so'.  Alto.
CMakeFiles/Makefile2:436: recipe for target 'libs/qCC_io/CMakeFiles/QCC_IO_LIB.dir/all' failed
The compilation proccess tries to find /opt/e57/lib/E57RefImpl.lib, but in linux the created E57 library is /opt/e57/lib/libE57RefImpl.a. At this point, I don't know how can I continue
jgpallero
Posts: 44
Joined: Thu Dec 12, 2013 2:00 pm

Re: XERCES not found

Post by jgpallero »

The FindXerces.cmake can also be modified in order to use the libxerces from the Debian repositories as:

Code: Select all

# if( NOT $ENV{XERCES_ROOT} STREQUAL "" )
#     set(XERCES_ROOT "/opr/xercesc/")
    set(Xerces_INCLUDE_DIR "/usr/include")
    set(Xerces_LIBRARY_DEBUG "/usr/lib/x86_64-linux-gnu/libxerces-c.a")
    set(Xerces_LIBRARY_RELEASE "/usr/lib/x86_64-linux-gnu/libxerces-c.a")
#     set(Xerces_INCLUDE_DIR "/opr/xercesc/include/")
# endif()
In this case, there is not any warning at configure step, but I obtain this error at compilation time:

Code: Select all

[ 19%] Built target QCC_DB_LIB
Linking CXX shared library libQCC_IO_LIB.so
/usr/bin/ld: /opt/e57/lib/libE57RefImpl.a(E57Foundation.cpp.o): no se puede usar la reubicación R_X86_64_32 contra `.rodata' cuando se hace un objeto compartido; recompile con -fPIC
/opt/e57/lib/libE57RefImpl.a: error adding symbols: Valor erróneo
collect2: error: ld returned 1 exit status
libs/qCC_io/CMakeFiles/QCC_IO_LIB.dir/build.make:1196: recipe for target 'libs/qCC_io/libQCC_IO_LIB.so' failed
In the E57 compilation, only a static library was created, and I can't find (if it exists) the option to create a shared one
jgpallero
Posts: 44
Joined: Thu Dec 12, 2013 2:00 pm

Re: XERCES not found

Post by jgpallero »

jgpallero wrote:In the E57 compilation, only a static library was created, and I can't find (if it exists) the option to create a shared one
Can be CC compiled as static?
Post Reply