topskychen / voxelizer

A fast parallel CPU-based surface & solid voxelizer.
MIT License
76 stars 20 forks source link

MacOSX 10.11.6 : errors when building #1

Closed iamyoukou closed 7 years ago

iamyoukou commented 7 years ago

Hi, when I make in build, I got these errors

[ 7%] Building CXX object bin/CMakeFiles/voxelizer.dir/voxelizerMain.cpp.o In file included from /Users/YJ-work/Desktop/cpp_programs/voxelizer/src/voxelizerMain.cpp:7: In file included from /Users/YJ-work/Desktop/cpp_programs/voxelizer/src/voxelizer.h:16: In file included from /Users/YJ-work/Desktop/cpp_programs/voxelizer/src/commons.h:17: In file included from /opt/local/include/fcl/collision.h:43: In file included from /opt/local/include/fcl/collision_object.h:45: In file included from /opt/local/include/fcl/ccd/motion_base.h:46: In file included from /opt/local/include/fcl/BV/RSS.h:41: /opt/local/include/fcl/math/constants.h:47:9: error: unknown type name 'constexpr' constexpr FCL_REAL pi = FCL_REAL(3.141592653589793238462643383279502884197169399375... ^ /opt/local/include/fcl/math/constants.h:47:27: error: expected ';' after top level declarator constexpr FCL_REAL pi = FCL_REAL(3.141592653589793238462643383279502884197169399375... ^ ; /opt/local/include/fcl/math/constants.h:50:9: error: unknown type name 'constexpr' constexpr FCL_REAL phi = FCL_REAL(1.618033988749894848204586834365638117720309179805... ^ /opt/local/include/fcl/math/constants.h:50:27: error: expected ';' after top level declarator constexpr FCL_REAL phi = FCL_REAL(1.618033988749894848204586834365638117720309179805... ^ ; In file included from /Users/YJ-work/Desktop/cpp_programs/voxelizer/src/voxelizerMain.cpp:7: In file included from /Users/YJ-work/Desktop/cpp_programs/voxelizer/src/voxelizer.h:16: In file included from /Users/YJ-work/Desktop/cpp_programs/voxelizer/src/commons.h:17: In file included from /opt/local/include/fcl/collision.h:43: In file included from /opt/local/include/fcl/collision_object.h:45: In file included from /opt/local/include/fcl/ccd/motion_base.h:46: /opt/local/include/fcl/BV/RSS.h:114:50: error: no member named 'pi' in namespace 'fcl::constants' return (l[0] l[1] 2 r + 4 constants::pi r r * r);


In file included from /Users/YJ-work/Desktop/cpp_programs/voxelizer/src/voxelizerMain.cpp:7:
In file included from /Users/YJ-work/Desktop/cpp_programs/voxelizer/src/voxelizer.h:16:
In file included from /Users/YJ-work/Desktop/cpp_programs/voxelizer/src/commons.h:18:
/opt/local/include/fcl/shape/geometric_shapes.h:142:29: error: no member named 'pi' in namespace
      'fcl::constants'
    return 4.0 * constants::pi * radius * radius * radius / 3.0;
                 ~~~~~~~~~~~^
/opt/local/include/fcl/shape/geometric_shapes.h:180:36: error: no member named 'pi' in namespace
      'fcl::constants'
    const FCL_REAL pi = constants::pi;
                        ~~~~~~~~~~~^
/opt/local/include/fcl/shape/geometric_shapes.h:207:23: error: no member named 'pi' in namespace
      'fcl::constants'
    return constants::pi * radius * radius *(lz + radius * 4/3.0);
           ~~~~~~~~~~~^
/opt/local/include/fcl/shape/geometric_shapes.h:212:56: error: no member named 'pi' in namespace
      'fcl::constants'
    FCL_REAL v_cyl = radius * radius * lz * constants::pi;
                                            ~~~~~~~~~~~^
/opt/local/include/fcl/shape/geometric_shapes.h:213:60: error: no member named 'pi' in namespace
      'fcl::constants'
    FCL_REAL v_sph = radius * radius * radius * constants::pi * 4 / 3.0;
                                                ~~~~~~~~~~~^
/opt/local/include/fcl/shape/geometric_shapes.h:247:23: error: no member named 'pi' in namespace
      'fcl::constants'
    return constants::pi * radius * radius * lz / 3;
           ~~~~~~~~~~~^
/opt/local/include/fcl/shape/geometric_shapes.h:290:23: error: no member named 'pi' in namespace
      'fcl::constants'
    return constants::pi * radius * radius * lz;
           ~~~~~~~~~~~^
12 errors generated.
make[2]: *** [bin/CMakeFiles/voxelizer.dir/voxelizerMain.cpp.o] Error 1
make[1]: *** [bin/CMakeFiles/voxelizer.dir/all] Error 2
make: *** [all] Error 2

How can I fix these?
topskychen commented 7 years ago

Hi iamyoukou,

It is my fault that I forget to list the fcl version. I have tried different versions of fcl libraries, and find out the version tags/0.3.3 should work. So there is the solution: git clone https://github.com/flexible-collision-library/fcl.git git checkout tags/0.3.3 I have mentioned it in readme now #2

iamyoukou commented 7 years ago

Thanks, man! And I just found another way to fix my problem.

  1. constexpr is used in C++11, so I put set (CMAKE_CXX_STANDARD 11) in voxelizer/CMakeLists.txt. (CMake >= 3.1)

  2. After 1., some errors about box_p(voxelizer/src/commons.h) and model_p(voxelizer/test/collisionChecker.h) will appear. To fix these two, I changed: (1) in commons.h typedef boost::shared_ptr<Box> box_p -> typedef std::shared_ptr<Box> box_p I installed fcl(version 0.5.0) using Macports; And I found that in this version (maybe just on MacOSX 10.11.6?), the CollisionObject class uses std:: in its constructor std::shared_ptr<CollisionGeometry>, instead of boost::. (2) in collisionChecker.h typedef boost::shared_ptr<Model> model_p-> typedef std::shared_ptr<Model> model_p Same reason as in (1).

Then, I built voxelizer successfully. And it works nice.

topskychen commented 7 years ago

Great to hear that ;) It seems that your version of libfcl uses the std::shared_ptr, and my library uses boost::shared_ptr. Thanks for providing a new solution ;p