bingmann / cobs

COBS - Compact Bit-Sliced Signature Index (for Genomic k-Mer Data or q-Grams)
https://panthema.net/cobs
MIT License
83 stars 15 forks source link

Error when using make -j4 #11

Open Danderson123 opened 4 years ago

Danderson123 commented 4 years ago

Hello, I am a Mac user and appear to have successfully compiled using GCC. However, when I run make -j4 I get the following errors:

/Users/danielanderson/cobs/cobs/construction/classic_index.cpp: In function 'void cobs::classic_construct_from_documents(const cobs::DocumentList&, const std::experimental::filesystem::v1::__cxx11::path&, const cobs::ClassicIndexParameters&)':
/Users/danielanderson/cobs/cobs/construction/classic_index.cpp:139:68: error: no matching function for call to 'min(size_t&, long long unsigned int)'
  139 |         params.mem_bytes / (batch_size / 8 * params.signature_size));
      |                                                                    ^
In file included from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/bits/char_traits.h:39,
                 from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/ios:40,
                 from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/istream:38,
                 from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/fstream:38,
                 from /Users/danielanderson/cobs/cobs/construction/classic_index.cpp:10:
/usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~

/Users/danielanderson/cobs/cobs/construction/compact_index.cpp: In function 'void cobs::compact_combine_into_compact(const std::experimental::filesystem::v1::__cxx11::path&, const std::experimental::filesystem::v1::__cxx11::path&, uint64_t, uint64_t, bool)':
/Users/danielanderson/cobs/cobs/construction/compact_index.cpp:122:64: error: no matching function for call to 'min(size_t&, long long unsigned int)'
  122 |                 batch_size, tlx::div_ceil(data_size, page_size));
      |                                                                ^
In file included from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/bits/char_traits.h:39,
                 from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/string:40,
                 from /Users/danielanderson/cobs/cobs/cortex_file.hpp:13,
                 from /Users/danielanderson/cobs/cobs/document_list.hpp:12,
                 from /Users/danielanderson/cobs/cobs/construction/classic_index.hpp:13,
                 from /Users/danielanderson/cobs/cobs/construction/compact_index.cpp:9:
/usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~

/Users/danielanderson/cobs/cobs/construction/compact_index.cpp:131:78: error: no matching function for call to 'min(size_t&, uint64_t)'
  131 |                 size_t this_batch = std::min(batch_size, data_size / row_size);
      |                                                                              ^
In file included from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/bits/char_traits.h:39,
                 from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/string:40,
                 from /Users/danielanderson/cobs/cobs/cortex_file.hpp:13,
                 from /Users/danielanderson/cobs/cobs/document_list.hpp:12,
                 from /Users/danielanderson/cobs/cobs/construction/classic_index.hpp:13,
                 from /Users/danielanderson/cobs/cobs/construction/compact_index.cpp:9:
/usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'

/Users/danielanderson/cobs/cobs/construction/classic_index.cpp: In function 'void cobs::classic_combine_streams(std::vector<std::basic_ifstream<char> >&, std::vector<long long unsigned int>&, const std::experimental::filesystem::v1::__cxx11::path&, unsigned int, uint8_t, uint64_t, uint64_t, uint64_t, uint64_t, cobs::Timer&, const std::vector<std::__cxx11::basic_string<char> >&)':
/Users/danielanderson/cobs/cobs/construction/classic_index.cpp:255:62: error: no matching function for call to 'min(size_t&, uint64_t)'
  255 |             std::min(batch_size, signature_size - current_row);
      |                                                              ^
In file included from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/bits/char_traits.h:39,
                 from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/ios:40,
                 from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/istream:38,
                 from /usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/fstream:38,
                 from /Users/danielanderson/cobs/cobs/construction/classic_index.cpp:10:
/usr/local/Cellar/gcc/9.3.0_1/include/c++/9.3.0/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
johnlees commented 4 years ago

This compiles ok for me on Linux, but fails on OS X. I think it may be because size_t will typically be 64 bits on Linux, but 32 bits on OS X. I think the fix for this is to make the various places where hashes are defined as:

std::vector<size_t>& hashes

to explicitly use 64 bits as in other defintions:

std::vector<uint64_t>& hashes

However this will still fail when compiling aio_search_file as we don't have the linux kernel headers:

../cobs/query/compact_index/aio_search_file.hpp:13:10: fatal error: linux/aio_abi.h: No such file or directory
   13 | #include <linux/aio_abi.h>
      |          ^~~~~~~~~~~~~~~~~

@bingmann Do you know any way around this, or have any plans to officially support OS X? Also, would it be helpful if I raised a PR for the consistent integer widths?

johnlees commented 4 years ago

This compiles ok for me on Linux, but fails on OS X. I think it may be because size_t will typically be 64 bits on Linux, but 32 bits on OS X. I think the fix for this is to make the various places where hashes are defined as:

Or it may be that they are the same width, but unsigned long long vs unsigned long, which are treated as distinct by the compiler despite being the same - I'm not sure! Either way changing the size_t to a specified width doesn't seem like a bad idea

bingmann commented 4 years ago

Yes, changing size_t to the correct specific data types is of course wise. Regarding the other issues, I don't have a Mac, so I can't fix that.