Open heijligers opened 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; }
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
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
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
before it.
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~~~~~~~~~~~~~
./emissions/simple_string.hh:132:41: note: in instantiation of template
class 'std::uniform_int_distribution
I also had to manually add
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'
distributions/skellam.cc:16:23: error: no member named 'cyl_bessel_i'
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
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
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
I'm trying to follow the instructions on apple m1 macos and am encountering the following compile error
Any guidance?