asap icon indicating copy to clipboard operation
asap copied to clipboard

Build failure on Mac OS 11 beta (Clang 12)

Open yesudeep opened this issue 4 years ago • 2 comments

❯ bazel test ...
...
ERROR: /Users/yesudeep/code/bwuck/third_party/cc/test/BUILD.bazel:93:10: C++ compilation of rule '//third_party/cc/test:asap_example' failed (Exit 1): wrapped_clang failed: error executing command 
...
Use --sandbox_debug to see verbose messages from the sandbox wrapped_clang failed: error executing command 
  (cd /private/var/tmp/_bazel_yesudeep/148f9f6ebca6e47e7d6d5ed427a82e62/sandbox/darwin-sandbox/61/execroot/__main__ && \
  exec env - \
    APPLE_SDK_PLATFORM=MacOSX \
    APPLE_SDK_VERSION_OVERRIDE=11.0 \
    XCODE_VERSION_OVERRIDE=12.0.0.12A8189h \
  external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG '-std=c++11' -iquote . -iquote bazel-out/darwin-fastbuild/bin -iquote external/fmt -iquote bazel-out/darwin-fastbuild/bin/external/fmt -iquote external/mobius3_asap -iquote bazel-out/darwin-fastbuild/bin/external/mobius3_asap -iquote external/bazel_tools -iquote bazel-out/darwin-fastbuild/bin/external/bazel_tools -isystem external/fmt/include -isystem bazel-out/darwin-fastbuild/bin/external/fmt/include -isystem external/mobius3_asap/include -isystem bazel-out/darwin-fastbuild/bin/external/mobius3_asap/include -MD -MF bazel-out/darwin-fastbuild/bin/third_party/cc/test/_objs/asap_example/asap_example.d '-frandom-seed=bazel-out/darwin-fastbuild/bin/third_party/cc/test/_objs/asap_example/asap_example.o' -isysroot __BAZEL_XCODE_SDKROOT__ -F__BAZEL_XCODE_SDKROOT__/System/Library/Frameworks -F__BAZEL_XCODE_DEVELOPER_DIR__/Platforms/MacOSX.platform/Developer/Library/Frameworks '-mmacosx-version-min=11.0' -DHAVE_BAZEL_BUILD '-std=c++2a' -Wall -Wreturn-type -Wuninitialized -Wunused-result '-Werror=narrowing' '-Werror=reorder' -Wunused-local-typedefs '-Werror=conversion-null' '-Werror=overlength-strings' '-Werror=pointer-arith' '-Werror=varargs' '-Werror=vla' '-Werror=write-strings' -Wmissing-declarations '-fdiagnostics-color=always' -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c third_party/cc/test/asap_example.cc -o bazel-out/darwin-fastbuild/bin/third_party/cc/test/_objs/asap_example/asap_example.o)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
third_party/cc/test/asap_example.cc:11:15: error: use of overloaded operator '!=' is ambiguous (with operand types 'asap::detail::accessor<3600>::iterator' and 'asap::detail::accessor<3600>::iterator')
  for (auto d : period.every(asap::hour(2))) {
              ^
external/mobius3_asap/include/asap/period.tcc:49:16: note: candidate function
          bool operator!=(const iterator & other);
               ^
external/mobius3_asap/include/asap/period.tcc:48:16: note: candidate function
          bool operator==(const iterator & other);
               ^
external/mobius3_asap/include/asap/period.tcc:48:16: note: candidate function (with reversed parameter order)
third_party/cc/test/asap_example.cc:11:17: note: in implicit call to 'operator!=' for iterator of type 'asap::detail::accessor<3600>'
  for (auto d : period.every(asap::hour(2))) {
                ^~~~~~
external/mobius3_asap/include/asap/period.tcc:52:28: note: selected 'begin' function with iterator type 'accessor<3600>::iterator'
        accessor::iterator begin() const;
                           ^
1 error generated.
INFO: Elapsed time: 2.658s, Critical Path: 2.15s
INFO: 15 processes: 15 darwin-sandbox.
FAILED: Build did NOT complete successfully

Example code:

#include "asap/asap.h"
#include "fmt/core.h"
#include "fmt/format.h"

int
main() {
  auto now    = asap::now();
  auto period = now.until(asap::tomorrow());
  for (auto d : period.every(asap::hour(2))) {
    fmt::print("* {}\n", d.str());
  }
  return 0;
}

yesudeep avatar Aug 24 '20 07:08 yesudeep

I noticed in your build command you're passing -std=c++2a. ASAP compiles fine with -std=c++11, -std=c++14 and -std=c++17. I'll definitely look into this but for the moment unless you absolutely need something from c++2a I'd change that switch to -std=c++17.

mobius3 avatar Aug 24 '20 17:08 mobius3

On a side note, this might just seems like a bug in the C++20 spec, boost is having a similar issue: https://github.com/boostorg/date_time/issues/132

mobius3 avatar Aug 24 '20 17:08 mobius3