probcomp / hierarchical-irm

Probabilistic structure discovery for rich relational systems
Apache License 2.0
4 stars 2 forks source link

Failure to Compile on apple m1 Macos #183

Open heijligers opened 2 months ago

heijligers commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

I'll have a got at it. Thanks for the quick response

On Tue, 3 Sept 2024 at 16:05, Thomas Colthurst @.***> wrote:

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; }

— Reply to this email directly, view it on GitHub https://github.com/probcomp/hierarchical-irm/issues/183#issuecomment-2326616105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX7BVZWJ7WAAJLMMZUNJ63ZUW6ZJAVCNFSM6AAAAABNSAM52OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRWGYYTMMJQGU . You are receiving this because you authored the thread.Message ID: @.***>

-- Bjorn Heijligers +31620106733

heijligers commented 2 months ago

I added the operator to the top of the .cc file, I hope that was the correct place.

It's failing with this: 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 emissions/string_alignment.cc:10:1: error: 'auto' in return type deduced as 'std::strong_ordering' here but deduced as 'std::partial_ordering' in earlier return statement return cmp2;

On Tue, 3 Sept 2024 at 16:26, Bjorn Heijligers @.***> wrote:

I'll have a got at it. Thanks for the quick response

On Tue, 3 Sept 2024 at 16:05, Thomas Colthurst @.***> wrote:

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; }

— Reply to this email directly, view it on GitHub https://github.com/probcomp/hierarchical-irm/issues/183#issuecomment-2326616105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX7BVZWJ7WAAJLMMZUNJ63ZUW6ZJAVCNFSM6AAAAABNSAM52OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRWGYYTMMJQGU . You are receiving this because you authored the thread.Message ID: @.***>

-- Bjorn Heijligers +31620106733

-- Bjorn Heijligers +31620106733

ThomasColthurst commented 2 months ago

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 commented 2 months ago

Well that at least seemed to work. I used brew install bazel to install the compiler, yet it looks like there are more differences

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/random/uniform_int_distribution.h:157:5: error: static assertion failed due to requirement 'libcpp_random_is_valid_inttype::value': IntType must be a supported integer type static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type"); ^ ~~~~~~~~~~~~~ ./emissions/simple_string.hh:132:41: note: in instantiation of template class 'std::uniform_int_distribution' requested here std::uniform_int_distribution uid(lowest_char, highest_char + 1); ^ 1 error generated.

I also had to manually add

include // For std::numbers::pi (C++20 feature)

include <boost/math/special_functions/bessel.hpp> // Use Boost's

Bessel function

to skellam.c to get around

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging distributions/skellam.cc:10:58: error: no member named 'numbers' in namespace 'std'

Modifying char to unsigned char I get stuck on importing boost correctly. I haven't touched C in 30 years, let alone cpp I've added to BUILD

cc_library( name = "skellam", srcs = ["skellam.cc"], hdrs = ["skellam.hh"], deps = [ @.***//:boost", ], includes = ["/opt/homebrew/Cellar/boost/1.86.0/include"], )

and WORKSPACE

new_local_repository( name = "boost", path = "/opt/homebrew/Cellar/boost/1.86.0", build_file_content = """ cc_library( name = "boost", hdrs = glob(["include/boost/*/.hpp"]), includes = ["include"], visibility = ["//visibility:public"], ) """, )

My infinite monkeys have been unsuccessful sofar: (.venv) @.*** cxx % bazel build //distributions:skellam --sandbox_debug --verbose_failures INFO: Analyzed target //distributions:skellam (100 packages loaded, 495 targets configured). ERROR: /Users/datascience/PycharmProjects/github/hierarchical-irm/cxx/distributions/BUILD:103:11: Compiling distributions/skellam.cc failed: (Exit 1): sandbox-exec failed: error executing CppCompile command (cd /private/var/tmp/_bazel_datascience/1fc90758b68677eb62c922214733cf0a/sandbox/darwin-sandbox/298/execroot/_main && \ exec env - \

@.***/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/datascience/.cargo/bin:/opt/homebrew/bin \ PWD=/proc/self/cwd \ TMPDIR=/var/folders/q1/rml5lvtj7fq0k12w9857t3cw0000gn/T/ \ /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_datascience/1fc90758b68677eb62c922214733cf0a/sandbox/darwin-sandbox/298/ sandbox.sb /var/tmp/_bazel_datascience/install/bf62fa6eb60eb3c9ac747cab67f18c21/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_datascience/1fc90758b68677eb62c922214733cf0a/sandbox/darwin-sandbox/298/stats.out' 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 -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++14' -MD -MF bazel-out/darwin_arm64-fastbuild/bin/distributions/_objs/skellam/skellam.d '-frandom-seed=bazel-out/darwin_arm64-fastbuild/bin/distributions/_objs/skellam/skellam.o' -iquote . -iquote bazel-out/darwin_arm64-fastbuild/bin '-mmacosx-version-min=14.5' '-std=c++20' -no-canonical-prefixes -Wno-builtin-macro-redefined '-DDATE="redacted"' '-DTIMESTAMP="redacted"' '-DTIME="redacted"' -c distributions/skellam.cc -o bazel-out/darwin_arm64-fastbuild/bin/distributions/_objs/skellam/skellam.o) distributions/skellam.cc:6:10: fatal error: 'boost/math/special_functions/bessel.hpp' file not found

include <boost/math/special_functions/bessel.hpp> // Ensure this path is

correct ^~~~~~~~~ 1 error generated. Target //distributions:skellam failed to build INFO: Elapsed time: 0.712s, Critical Path: 0.42s INFO: 7 processes: 7 internal. ERROR: Build did NOT complete successfully (.venv) @. cxx % On Tue, 3 Sept 2024 at 18:00, Thomas Colthurst @.> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/probcomp/hierarchical-irm/issues/183#issuecomment-2326889787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX7BV5UUMFGOBGKQX4THV3ZUXMLLAVCNFSM6AAAAABNSAM52OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRWHA4DSNZYG4 . You are receiving this because you authored the thread.Message ID: @.***>

-- Bjorn Heijligers +31620106733

ThomasColthurst commented 2 months ago

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