E57 support in linux [was XERCES not found]
Posted: Mon Jul 20, 2015 12:55 pm
Hello:
I've opened this thread in order to explain how could I compile CC with E57 support in linux. My OS is Debian Sid, but I think the steps are also valid for other distributions. Some compilation problems were solved after the discussion in this thread: viewtopic.php?f=12&t=584
First of all, as not all the dependencies for E57 are available in the Debian repos, manual compilation of libe57 was needed. The E57 library can be downloaded from http://www.libe57.org (now, sourceforge is apparently down, so it can't be downloaded). All E57 dependencies (xerces, etc.) are in the Debian repositories, so we need to compile only libe57 itself. The build system is CMAKE, so it can be managed graphically via cmake-gui. After the cmake-gui launch, we need to check the "Advanced" option, in order to see all the configuration options. And here is the tricky part: we need to addd the -fPIC value to the options CMAKE_CXX_FLAGS and CMAKE_C_FLAGS. Apparently, there is not a way to generate libe57 as shared library (at least I've not found it at all), so only the static version will be constructed. But the compilation of the files without the -fPIC option make impossible the posterior use of libe57 in the CloudCompare compilation. Finally, we compile and install the library, for example in /opt/e57
Then, the CloudCompare compilation. The next instructions are valid for the 2.6.1 code. At this point, in the cmake-gui menu, we select the option OPTIO_USE_LIBE57. When we try to configure, we obtain two errors:
The first one is about the lack of the E57 path. We can fix it in the LIBE57_INSTALL_DIR option of the 'Ungrouped Entries' section. We run again configure and we have only the second error, whixh relies about the Xerces library paths. If we check the "Advanced" option in the cmake-gui interface, we can see two options related to Xerces in the 'ungrouped Entries" section: Xerces_INCLUDE_DIR and XERCES_ROOT. The first one contains by default /usr/include, wich is correct if we use the xerces library from the Debian repositories. But the XERCES_ROOT option does not apparently work. In order to fix the Xerces path, we need to modify the trunk-2.6.1/contrib/cmake/Modules/FindXerces.cmake file. We need to comment three lines and add two new ones:
We need to add explicitly the paths for the xerces library (it is important to be the shared one). The script checks the XERCES_ROOT variable, but although its value is set in the cmake-gui, the variable is always empty and the if sentence is never true in the script.
At this point, we can yet configure the project without errors, generate the makefiles and start compilation. The first error in the compilation proccess is
The problem is that the file trunk-2.6.1/libs/qCC_io/E57Filter.cpp includes the E57/E57Foundation.h, but the path are wrong. The previous E57 library installation created the e57/ subfolder inside the Include/ directory, but the include expects the E57/ folder is in upper case. But, at least in linux, upper case are not the same as lower case for paths in C/C++. There is two possible ways to fix the bug: change the name of the e57/ subfolder to E57/ or modify the trunk-2.6.1/libs/qCC_io/E57Filter.cpp file in order to include the correct path. I've modified the file and I've invoked make again.
The next error is
Apparently, the E57 files support is coded only for Windows systems, so the compilation script search only for Windows libraries. We need to open the file trunk-2.6.1/contrib/E57Support.cmake and change the line
by
At this point, we need to configure again the project in the cmake-gui interface, generate again the makefiles and execute again make.
Following this instructions, I was able to compile CC with E57 in Debian GNU/Linux
Thanks
I've opened this thread in order to explain how could I compile CC with E57 support in linux. My OS is Debian Sid, but I think the steps are also valid for other distributions. Some compilation problems were solved after the discussion in this thread: viewtopic.php?f=12&t=584
First of all, as not all the dependencies for E57 are available in the Debian repos, manual compilation of libe57 was needed. The E57 library can be downloaded from http://www.libe57.org (now, sourceforge is apparently down, so it can't be downloaded). All E57 dependencies (xerces, etc.) are in the Debian repositories, so we need to compile only libe57 itself. The build system is CMAKE, so it can be managed graphically via cmake-gui. After the cmake-gui launch, we need to check the "Advanced" option, in order to see all the configuration options. And here is the tricky part: we need to addd the -fPIC value to the options CMAKE_CXX_FLAGS and CMAKE_C_FLAGS. Apparently, there is not a way to generate libe57 as shared library (at least I've not found it at all), so only the static version will be constructed. But the compilation of the files without the -fPIC option make impossible the posterior use of libe57 in the CloudCompare compilation. Finally, we compile and install the library, for example in /opt/e57
Then, the CloudCompare compilation. The next instructions are valid for the 2.6.1 code. At this point, in the cmake-gui menu, we select the option OPTIO_USE_LIBE57. When we try to configure, we obtain two errors:
Code: Select all
CMake Error at contrib/E57Support.cmake:15 (message):
No LibE57 install dir specified (LIBE57_INSTALL_DIR)
Call Stack (most recent call first):
contrib/AllSupport.cmake:8 (include)
CMakeLists.txt:68 (include)
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)
Code: Select all
# if( NOT $ENV{XERCES_ROOT} STREQUAL "" )
# set(XERCES_ROOT $ENV{XERCES_ROOT})
set(Xerces_LIBRARY_DEBUG "/usr/lib/x86_64-linux-gnu/libxerces-c-3.1.so")
set(Xerces_LIBRARY_RELEASE "/usr/lib/x86_64-linux-gnu/libxerces-c-3.1.so")
# endif()
At this point, we can yet configure the project without errors, generate the makefiles and start compilation. The first error in the compilation proccess is
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 next error is
Code: Select all
[ 21%] 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
make[1]: *** [libs/qCC_io/CMakeFiles/QCC_IO_LIB.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
Code: Select all
target_link_libraries( ${ARGV0} debug ${LIBE57_INSTALL_DIR}/lib/E57RefImpl-d.lib optimized ${LIBE57_INSTALL_DIR}/lib/E57RefImpl.lib )
Code: Select all
target_link_libraries( ${ARGV0} debug ${LIBE57_INSTALL_DIR}/lib/libE57RefImpl-d.a optimized ${LIBE57_INSTALL_DIR}/lib/libE57RefImpl.a )
Following this instructions, I was able to compile CC with E57 in Debian GNU/Linux
Thanks