Compiling CCLib using CGAL

Any question about the database & algorithms library 'CCLib'
Post Reply
20cent
Posts: 9
Joined: Sat Dec 15, 2018 4:58 pm

Compiling CCLib using CGAL

Post by 20cent »

As I need to proceed 2.5D Delaunay triangulation, I am trying to compile CC with CGAL... and failing !
Indeed, if I compile without CGAL, the process runs fine, but when I set CCORE_LIB_USE_CGAL to "yes", I get the following error at make runtime:

Code: Select all

In file included from /opt/cloudcompare/libs/qCC_db/extern/CCCoreLib/src/ErrorFunction.cpp:7:
/opt/cloudcompare/libs/qCC_db/extern/CCCoreLib/include/CCConst.h:29:38: error: ‘(1.8e+2 / 3.1415926535897931e+0)’ is not a constant expression
  constexpr double RAD_TO_DEG = (180.0/M_PI);
                                ~~~~~~^~~~~~
and similar message with constexpr double DEG_TO_RAD = (M_PI/180.0)

I bravely changed RAD_TO_DEG and DEG_TO_RAD expressions to decimals actual values in CCConst.h file, but again further new errors occur:

Code: Select all

/opt/cloudcompare/libs/qCC_db/src/ccCameraSensor.cpp:56:54: error: ‘(5.4500000000000002e+0 * 1.0e-3)’ is not a constant expression
  constexpr float focal_mm  = static_cast<float>(5.45 * 1.0e-3); // focal length (real distance in meter)
                                                 ~~~~~^~~~~~~~
Obviously I have something wrong with constexpr... and it's clearly beyond my knowledge :-(

Has anyone a suggestion to help me solve this issue ?
Thanks,
Vincent.
20cent
Posts: 9
Joined: Sat Dec 15, 2018 4:58 pm

Re: Compiling CCLib using CGAL

Post by 20cent »

Reply to myself, perhaps this could be helpful to debian users:

I finally could compileCGAL support using clang compiler (CMAKE_CXX_COMPILER=/usr/bin/clang).
You may encounter an error complaining about an undefined symbol reference:

Code: Select all

/usr/bin/ld: CMakeFiles/CloudCompare.dir/cc2.5DimEditor.cpp.o: undefined reference to symbol '_ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.3'
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO manquant dans la ligne de commande
the workaround that did the trick for me (quite sure it's not the academic way!) I added:

Code: Select all

CMAKE_CXX_FLAGS =-lstdc++ -lm
At the install step, make install puts libCC*.so in /usr/local/bin despite CMAKE_INSTALL_LIBDIR destination set to /usr/local/lib. The quick and dirty way to get around this problem and start CloudCompare is to set LD_LIBRARY_PATH variable:

Code: Select all

export LD_LIBRARY_PATH=/usr/local/bin
Now I can use CC to efficiently interpolate big point clouds to rasters. Thanks for this so nice software!

PS: GNU/Linux CC users/devs, please comment on my amateurish workaround!

Yours,
V.
Jälv
Posts: 28
Joined: Sun Jul 02, 2017 8:35 pm

Re: Compiling CCLib using CGAL

Post by Jälv »

Can you give the version of your OS and the version of Clang and GCC ?
20cent
Posts: 9
Joined: Sat Dec 15, 2018 4:58 pm

Re: Compiling CCLib using CGAL

Post by 20cent »

Hello Jälv,
how disgraceful! I omitted the bare minimum elements of diagnostic.

Code: Select all

vincent@pc1:~$ lsb_release -d && clang --version && gcc --version
Description:	Debian GNU/Linux 10 (buster)
clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
gcc (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Thanks for your interest to my question!
Vincent.
Post Reply