Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to Compile on apple m1 Macos #183

Open
heijligers opened this issue Sep 3, 2024 · 6 comments
Open

Failure to Compile on apple m1 Macos #183

heijligers opened this issue Sep 3, 2024 · 6 comments

Comments

@heijligers
Copy link

heijligers commented Sep 3, 2024

I'm trying to follow the instructions on apple m1 macos and am encountering the following compile error

bazel build -c opt :hirm
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
DEBUG: Rule 'rules_boost~' indicated that a canonical reproducible form can be obtained by modifying arguments integrity = "sha256-cbYu58gx1KNH739zub4MCJ2I39ZpQmxPPY91cTiGhlA="
DEBUG: Repository rules_boost~ instantiated at:
  <builtin>: in <toplevel>
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_datascience/1fc90758b68677eb62c922214733cf0a/external/bazel_tools/tools/build_defs/repo/http.bzl:382:31: in <toplevel>
INFO: Analyzed target //:hirm (102 packages loaded, 3599 targets configured).
ERROR: /Users/datascience/PycharmProjects/github/hierarchical-irm/cxx/emissions/BUILD:109:11: Compiling emissions/string_alignment.cc failed: (Exit 1): cc_wrapper.sh failed: error executing CppCompile command (from target //emissions:string_alignment) external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object ... (remaining 28 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from emissions/string_alignment.cc:3:
./emissions/string_alignment.hh:38:8: warning: explicitly defaulted three-way comparison operator is implicitly deleted [-Wdefaulted-function-deleted]
  auto operator<=>(const StrAlignment&) const = default;
       ^
./emissions/string_alignment.hh:36:27: note: defaulted 'operator<=>' is implicitly deleted because there is no viable three-way comparison function for member 'align_pieces'
  std::vector<AlignPiece> align_pieces;
                          ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__threading_support:682:17: note: candidate function not viable: no known conversion from 'const std::vector<AlignPiece>' (aka 'const vector<variant<Deletion, Insertion, Substitution, Match>>') to '__thread_id' for 1st argument
strong_ordering operator<=>(__thread_id __x, __thread_id __y) noexcept {
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__variant/monostate.h:32:49: note: candidate function not viable: no known conversion from 'const std::vector<AlignPiece>' (aka 'const vector<variant<Deletion, Insertion, Substitution, Match>>') to 'monostate' for 1st argument
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(monostate, monostate) noexcept {
                                                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'vector'
operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/pair.h:444:1: note: candidate template ignored: could not match 'pair' against 'vector'
operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'vector'
operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/variant:1659:1: note: candidate template ignored: could not match 'variant' against 'vector'
operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'vector'
auto operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:784:1: note: candidate template ignored: could not match 'basic_string_view' against 'vector'
operator<=>(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'vector'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4077:38: note: candidate template ignored: could not match 'basic_string' against 'vector'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'vector'
operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'vector'
./emissions/string_alignment.hh:38:49: note: replace 'default' with 'delete'
  auto operator<=>(const StrAlignment&) const = default;
                                                ^~~~~~~
                                                delete
In file included from emissions/string_alignment.cc:1:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:531:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/equal.h:13:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/comp.h:47:71: error: object of type 'const StrAlignment' cannot be compared because its 'operator<=>' is implicitly deleted
    bool operator()(const _T1& __x, const _T1& __y) const {return __x < __y;}
                                                                      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/sift_down.h:96:38: note: in instantiation of member function 'std::__less<StrAlignment>::operator()' requested here
        if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + difference_type(1)))) {
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/pop_heap.h:40:41: note: in instantiation of function template specialization 'std::__floyd_sift_down<std::_ClassicAlgPolicy, std::__less<StrAlignment> &, std::__wrap_iter<StrAlignment *>>' requested here
    _RandomAccessIterator __hole = std::__floyd_sift_down<_AlgPolicy>(__first, __comp_ref, __len);
                                        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/pop_heap.h:61:8: note: in instantiation of function template specialization 'std::__pop_heap<std::_ClassicAlgPolicy, std::__less<StrAlignment>, std::__wrap_iter<StrAlignment *>>' requested here
  std::__pop_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp, __len);
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/pop_heap.h:67:8: note: in instantiation of function template specialization 'std::pop_heap<std::__wrap_iter<StrAlignment *>, std::__less<StrAlignment>>' requested here
  std::pop_heap(std::move(__first), std::move(__last),
       ^
emissions/string_alignment.cc:24:10: note: in instantiation of function template specialization 'std::pop_heap<std::__wrap_iter<StrAlignment *>>' requested here
    std::pop_heap(heap.begin(), heap.end());
         ^
./emissions/string_alignment.hh:38:8: note: explicitly defaulted function was implicitly deleted here
  auto operator<=>(const StrAlignment&) const = default;
       ^
./emissions/string_alignment.hh:36:27: note: defaulted 'operator<=>' is implicitly deleted because there is no viable three-way comparison function for member 'align_pieces'
  std::vector<AlignPiece> align_pieces;
                          ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__threading_support:682:17: note: candidate function not viable: no known conversion from 'const std::vector<AlignPiece>' (aka 'const vector<variant<Deletion, Insertion, Substitution, Match>>') to '__thread_id' for 1st argument
strong_ordering operator<=>(__thread_id __x, __thread_id __y) noexcept {
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__variant/monostate.h:32:49: note: candidate function not viable: no known conversion from 'const std::vector<AlignPiece>' (aka 'const vector<variant<Deletion, Insertion, Substitution, Match>>') to 'monostate' for 1st argument
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(monostate, monostate) noexcept {
                                                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'vector'
operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/pair.h:444:1: note: candidate template ignored: could not match 'pair' against 'vector'
operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'vector'
operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/variant:1659:1: note: candidate template ignored: could not match 'variant' against 'vector'
operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'vector'
auto operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:784:1: note: candidate template ignored: could not match 'basic_string_view' against 'vector'
operator<=>(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'vector'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4077:38: note: candidate template ignored: could not match 'basic_string' against 'vector'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'vector'
operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'vector'
In file included from emissions/string_alignment.cc:1:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:2356:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:515:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/boyer_moore_searcher.h:24:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/array:536:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1771:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/nth_element.h:15:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/sort.h:16:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/partial_sort.h:17:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/sort_heap.h:15:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/pop_heap.h:15:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/push_heap.h:56:3: error: no matching function for call to '__sift_up'
  std::__sift_up<_AlgPolicy, __comp_ref_type<_Compare> >(std::move(__first), std::move(__last), __comp, __len);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/push_heap.h:65:8: note: in instantiation of function template specialization 'std::__push_heap<std::_ClassicAlgPolicy, std::__wrap_iter<StrAlignment *>, std::__less<StrAlignment>>' requested here
  std::__push_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp);
       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/push_heap.h:71:8: note: in instantiation of function template specialization 'std::push_heap<std::__wrap_iter<StrAlignment *>, std::__less<StrAlignment>>' requested here
  std::push_heap(std::move(__first), std::move(__last),
       ^
emissions/string_alignment.cc:52:12: note: in instantiation of function template specialization 'std::push_heap<std::__wrap_iter<StrAlignment *>>' requested here
      std::push_heap(heap.begin(), heap.end());
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/push_heap.h:28:6: note: candidate template ignored: substitution failure [with _AlgPolicy = std::_ClassicAlgPolicy, _Compare = std::__less<StrAlignment> &, _RandomAccessIterator = std::__wrap_iter<StrAlignment *>]
void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp,
     ^
1 warning and 2 errors generated.
Target //:hirm failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 26.131s, Critical Path: 0.75s
INFO: 100 processes: 95 internal, 5 darwin-sandbox.
ERROR: Build did NOT complete successfully

Any guidance?

@ThomasColthurst
Copy link

ThomasColthurst commented Sep 3, 2024

Hmm. The MacOS version of the C++ standard library seems to not be fully C++20 compliant here: a std::vector of std::variant's really should have default spaceship operators (<=>).

You could try writing a custom spaceship operator for StrAlignment to get around this -- remove the = default from
auto operator<=>(const StrAlignment&) const = default;
in string_alignment.hh and then in string_alignment.cc add

auto StrAlignment::operator<=>(const StrAlignment& rhs) const {
if (auto cmp = cost <=> rhs.cost; cmp != 0)
return cmp;

if (auto cmp2 = s1_position <=> rhs.s1_position; cmp2 != 0)
return cmp2;

return s2_position <=> rhs.s2_position;
}

@heijligers
Copy link
Author

heijligers commented Sep 3, 2024 via email

@heijligers
Copy link
Author

heijligers commented Sep 3, 2024 via email

@ThomasColthurst
Copy link

You can try replacing the auto on the line

auto StrAlignment::operator<=>(const StrAlignment& rhs) const {

with std::partial_ordering. You might have to also add a

#include

before it.

@heijligers
Copy link
Author

heijligers commented Sep 3, 2024 via email

@ThomasColthurst
Copy link

Huh. The cyl_bessel_i function has been part of C++'s standard library since C++17: https://en.cppreference.com/w/cpp/numeric/special_functions/cyl_bessel_i

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants