tzaeschke / phtree-cpp

PH-Tree C++ implementation
Apache License 2.0
29 stars 9 forks source link

Mac compile issue ”No matching function for call to 'min'“ #149

Closed rockingdice closed 1 year ago

rockingdice commented 1 year ago

error:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__algorithm/min.h:39:1: Candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long long' vs. 'unsigned long')

at lines:

    // COUNT_MAX indicates that a tree will never have to hold more than COUNT_MAX entries.
    // We can use this to optimize node sizes for small trees.
    constexpr static size_t LEAF_MAX = std::min(std::uint64_t(16), COUNT_MAX);           <<<<<<<< this line
    // Special case for small COUNT with smaller inner leaf or
    // trees with a single inner leaf. '*2' is added because leaf filling is not compact.
    constexpr static size_t INNER_MAX = std::min(std::uint64_t(16), COUNT_MAX / LEAF_MAX * 2);      <<<<<<<< this line

I have to change the typename size_t to std::uint64 to compile:

template <typename KeyT, typename ValueT, size_t COUNT_MAX>
class b_plus_tree_map {
template <typename KeyT, typename ValueT, std::uint64_t COUNT_MAX>
class b_plus_tree_map {
tzaeschke commented 1 year ago

What kind/version of compiler are you using?

rockingdice commented 1 year ago

@tzaeschke -- The C compiler identification is AppleClang 14.0.0.14000029 -- The CXX compiler identification is AppleClang 14.0.0.14000029

tzaeschke commented 1 year ago

@rockingdice Sorry for the delay. I also forgot to thank you for reporting the problem!

I actually found several more problems. It all works fine now when compiling with bazel. However, I couldn't get the cmake build to work, it keeps failing with "illegal instruction" reported by the linker.

Could you have a look whether it works for you now?

Otherwise I will just merge it next week.

rockingdice commented 1 year ago

@tzaeschke Sure! I'll try when possible.

tzaeschke commented 1 year ago

I merged it now. please open another issue if you find more problems.