attcs / Octree

Octree/Quadtree/N-dimensional linear tree
MIT License
113 stars 13 forks source link

Cannot Install in Ubuntu 18 #2

Closed samarthjain96 closed 1 year ago

samarthjain96 commented 1 year ago

Hi, I am not able to install and use the repository in ubuntu 18. Can you lay down the steps how I can use it and what other dependencies and libraries I need to install for the same. One of the error I am getting while compiling is shown below.

jainsamarth@sjain:~/Downloads/Octree/build(master)$ make -j
[ 50%] Building CXX object CMakeFiles/MyExample.dir/test.cpp.o
In file included from /home/jainsamarth/Downloads/Octree/test.cpp:1:
In file included from /home/jainsamarth/Downloads/Octree/octree.h:43:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/execution:32:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/pstl/glue_execution_defs.h:50:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/pstl/algorithm_impl.h:22:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/pstl/parallel_backend.h:20:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/pstl/parallel_backend_tbb.h:19:
In file included from /home/jainsamarth/tbb/include/tbb/blocked_range.h:20:
In file included from /home/jainsamarth/tbb/include/tbb/tbb_stddef.h:452:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/memory:72:
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/align.h:96:16: error: no member named 'is_constant_evaluated' in namespace 'std'
      if (std::is_constant_evaluated())
          ~~~~~^
In file included from /home/jainsamarth/Downloads/Octree/test.cpp:1:
/home/jainsamarth/Downloads/Octree/octree.h:114:16: error: no member named 'span' in namespace 'std'
    using std::span;
          ~~~~~^
/home/jainsamarth/Downloads/Octree/octree.h:138:3: error: expected unqualified-id
  concept AdaptorBasicsConcept =
  ^
/home/jainsamarth/Downloads/Octree/octree.h:148:3: error: expected unqualified-id
  concept AdaptorConcept =
  ^
/home/jainsamarth/Downloads/Octree/octree.h:176:19: error: use of undeclared identifier 'AdaptorBasicsConcept'
    static_assert(AdaptorBasicsConcept<base, vector_type, box_type, geometry_type>);
                  ^
/home/jainsamarth/Downloads/Octree/octree.h:176:40: error: unexpected type name 'base': expected expression
    static_assert(AdaptorBasicsConcept<base, vector_type, box_type, geometry_type>);
                                       ^
/home/jainsamarth/Downloads/Octree/octree.h:314:35: error: no template named 'span'
    static box_type box_of_points(span<vector_type const> const& vPoint)
                                  ^
/home/jainsamarth/Downloads/Octree/octree.h:314:59: error: expected ')'
    static box_type box_of_points(span<vector_type const> const& vPoint)
                                                          ^
/home/jainsamarth/Downloads/Octree/octree.h:314:34: note: to match this '('
    static box_type box_of_points(span<vector_type const> const& vPoint)
                                 ^
/home/jainsamarth/Downloads/Octree/octree.h:330:34: error: no template named 'span'
    static box_type box_of_boxes(span<box_type const> const& vExtent)
                                 ^
/home/jainsamarth/Downloads/Octree/octree.h:330:55: error: expected ')'
    static box_type box_of_boxes(span<box_type const> const& vExtent)
                                                      ^
/home/jainsamarth/Downloads/Octree/octree.h:330:33: note: to match this '('
    static box_type box_of_boxes(span<box_type const> const& vExtent)
                                ^
/home/jainsamarth/Downloads/Octree/octree.h:317:24: error: use of undeclared identifier 'vPoint'
      for (autoc& pt : vPoint)
                       ^
/home/jainsamarth/Downloads/Octree/octree.h:333:23: error: use of undeclared identifier 'vExtent'
      for (autoc& e : vExtent)
                      ^
/home/jainsamarth/Downloads/Octree/octree.h:386:26: error: no member named 'ranges' in namespace 'std'
      autoc rMin = *std::ranges::max_element(aRMinMax[0]);
                    ~~~~~^
/home/jainsamarth/Downloads/Octree/octree.h:387:26: error: no member named 'ranges' in namespace 'std'
      autoc rMax = *std::ranges::min_element(aRMinMax[1]);
                    ~~~~~^
/home/jainsamarth/Downloads/Octree/octree.h:386:13: error: variables defined in a constexpr function must be initialized
      autoc rMin = *std::ranges::max_element(aRMinMax[0]);
            ^
/home/jainsamarth/Downloads/Octree/octree.h:544:20: error: no type named 'strong_ordering' in namespace 'std'
    using R = std::strong_ordering;
              ~~~~~^
/home/jainsamarth/Downloads/Octree/octree.h:547:26: error: use of undeclared identifier 'R'
        return lhs[id] ? R::greater : R::less;
                         ^
/home/jainsamarth/Downloads/Octree/octree.h:547:39: error: use of undeclared identifier 'R'
        return lhs[id] ? R::greater : R::less;
                                      ^
/home/jainsamarth/Downloads/Octree/octree.h:549:12: error: use of undeclared identifier 'R'
    return R::equal;
           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
CMakeFiles/MyExample.dir/build.make:62: recipe for target 'CMakeFiles/MyExample.dir/test.cpp.o' failed
make[2]: *** [CMakeFiles/MyExample.dir/test.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/MyExample.dir/all' failed
make[1]: *** [CMakeFiles/MyExample.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Thanks

attcs commented 1 year ago

Hi!

Reading this log, it seems to me, it is not compiled with the C++20 feature set.

I did not test for GCC and am not particularly familiar with it. For cross-platform checks, I use Clang, which usually ensures language conformity. Are you sure it is compiled with C++20 support and that your GCC version supports the following features?

  1. Concepts
  2. if constexpr()
  3. std::span
  4. std::ranges
  5. std::strong_ordering
samarthjain96 commented 1 year ago

Hi, I tried with g++/gcc 11 and C++ 20. This is my CMakeList.

cmake_minimum_required(VERSION 3.10)

project(
  ModernCMakeExample LANGUAGES CXX VERSION 0.1)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++2a")

include_directories(/home/jainsamarth/tbb/include)

add_executable(MyExample test.cpp)
target_link_libraries(MyExample PRIVATE ~/tbb/build/linux_intel64_gcc_cc11.1.0_libc2.27_kernel5.8.0_release/libtbb.so octree.h octree_container.h)

The log is

/home/jainsamarth/Downloads/Octree/octree.h:887:81: error: there are no arguments to ‘log2’ that depend on a template parameter, so a declaration of ‘log2’ must be available [-fpermissive]
  887 |       autoc nDepthEstimated = std::min(nDepthMax, static_cast<depth_type>(ceil((log2(nElementInNodeAvg) + 1) / static_cast<float>(nDimension))));

I haven't tested with clang yet.

attcs commented 1 year ago

Hi, After trying to compile with GCC 11.3, I resolved a few ussies, but - if I understand well - the currently used library does not support the execution policies with std::span, maybe TBB would do. Could you do another try? Thx!

attcs commented 1 year ago

I solved the GCC compilation and added a mini CMake project to the repo in the GCC folder.