contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.32k stars 101 forks source link

Compilation failure with LLVM 17: explicitly defaulted three-way comparison operator is implicitly deleted #1443

Closed herrhotzenplotz closed 5 months ago

herrhotzenplotz commented 5 months ago

I cannot build contour at commit b610c52:

[ 49%] Building CXX object src/vtbackend/CMakeFiles/vtbackend.dir/RenderBufferBuilder.cpp.o
In file included from /usr/home/nico/src/contour/src/vtbackend/ColorPalette.cpp:3:
In file included from /usr/home/nico/src/contour/src/vtbackend/ColorPalette.h:5:
In file included from /usr/home/nico/src/contour/src/vtbackend/Image.h:5:
/usr/home/nico/src/contour/src/vtbackend/primitives.h:132:20: warning: explicitly defaulted three-way comparison operator is implicitly deleted [-Wdefaulted-function-deleted]
  132 |     constexpr auto operator<=>(CellLocation const&) const noexcept = default;
      |                    ^
/usr/home/nico/src/contour/src/vtbackend/primitives.h:111:16: note: defaulted 'operator<=>' is implicitly deleted because there is no viable three-way comparison function for member 'line'
  111 |     LineOffset line {};
      |                ^
/usr/home/nico/src/contour/src/vtbackend/primitives.h:132:70: note: replace 'default' with 'delete'
  132 |     constexpr auto operator<=>(CellLocation const&) const noexcept = default;
      |                                                                      ^~~~~~~
      |                                                                      delete
In file included from /usr/home/nico/src/contour/src/vtbackend/ColorPalette.cpp:3:
In file included from /usr/home/nico/src/contour/src/vtbackend/ColorPalette.h:5:
/usr/home/nico/src/contour/src/vtbackend/Image.h:221:30: error: object of type 'CellLocation' cannot be compared because its 'operator<=>' is implicitly deleted
  221 |                && a.offset() < b.offset());
      |                              ^
/usr/home/nico/src/contour/src/vtbackend/primitives.h:132:20: note: explicitly defaulted function was implicitly deleted here
  132 |     constexpr auto operator<=>(CellLocation const&) const noexcept = default;
      |                    ^
/usr/home/nico/src/contour/src/vtbackend/primitives.h:111:16: note: defaulted 'operator<=>' is implicitly deleted because there is no viable three-way comparison function for member 'line'
  111 |     LineOffset line {};
      |                ^
1 warning and 1 error generated.
--- src/vtbackend/CMakeFiles/vtbackend.dir/ColorPalette.cpp.o ---
*** [src/vtbackend/CMakeFiles/vtbackend.dir/ColorPalette.cpp.o] Error code 1

This issue applies to a few more files.

Operating system/pkg information:

$ uname -a
FreeBSD triton 14.0-RELEASE-p4 FreeBSD 14.0-RELEASE-p4 #4 fix/sennheiser-bt-headphones-n265405-ecf35d6c9761: Fri Dec 22 14:50:24 CET 2023     root@triton:/usr/obj/usr/src/amd64.amd64/sys/TRITON140 amd64
$
$ pkg info llvm17
llvm17-17.0.6_3
Name           : llvm17
Version        : 17.0.6_3
Installed on   : Fri Jan 19 15:46:11 2024 CET
Origin         : devel/llvm17
Architecture   : FreeBSD:14:amd64
Prefix         : /usr/local
Categories     : lang devel
Licenses       : REGEX and PD and MIT and LLVM2 and LLVM and BSD3CLAUSE
Maintainer     : brooks@FreeBSD.org
WWW            : https://llvm.org/
Comment        : LLVM and Clang
Options        :
    BE_AMDGPU      : on
    BE_FREEBSD     : off
    BE_NATIVE      : off
    BE_STANDARD    : on
    BE_WASM        : on
    CLANG          : on
    COMPILER_RT    : on
    DOCS           : on
    EXTRAS         : on
    FLANG          : off
    GOLD           : on
    LIT            : on
    LLD            : on
    LLDB           : on
    MLIR           : on
    OPENMP         : on
    POLLY          : on
    PYCLANG        : on
    STATIC_LIBS    : on
Shared Libs required:
    libzstd.so.1
    libpython3.9.so.1.0
    liblua-5.3.so
    libedit.so.0
Shared Libs provided:
    libomptarget.so.17
    libomp.so
    libmlir_runner_utils.so.17
    libmlir_float16_utils.so.17
    libmlir_c_runner_utils.so.17
    libmlir_async_runtime.so.17
    liblldb.so.17
    libclang_rt.ubsan_standalone.so
    libclang_rt.ubsan_minimal.so
    libclang_rt.tsan.so
    libclang_rt.dyndd.so
    libclang_rt.asan.so
    libclang.so.17
    libclang-cpp.so.17
    libarcher.so
    libRemarks.so.17
    libMLIR.so.17
    libLTO.so.17
    libLLVM-17.so
Annotations    :
    FreeBSD_version: 1400097
    build_timestamp: 2024-01-14T01:16:07+0000
    built_by       : poudriere-git-3.4.0
    cpe            : cpe:2.3:a:llvm:llvm:17.0.6:::::freebsd14:x64:3
    flavor         : default
    port_checkout_unclean: no
    port_git_hash  : c91d810f6
    ports_top_checkout_unclean: no
    ports_top_git_hash: b57ae9b9d
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 1.57GiB
Description    :
The LLVM Project is a collection of modular and reusable compiler and
toolchain technologies.

This port includes Clang (a C/C++/Objective-C compiler), LLD (a linker),
LLDB (a debugger), an OpenMP runtime library, and the LLVM infrastructure
these are built on.
$ 

I've tried this with both the FreeBSD clang (which is llvm 16) and the version from ports. Both failed.

This bug should have been caught by CI. Maybe it's broken again?

christianparpart commented 5 months ago

Thanks @herrhotzenplotz. I noticed this already. I'll be fixing this. Thank you :)

christianparpart commented 5 months ago

Wait a second. You should not have it on boxed<> types. Did you recently run ./scripts/install-deps.sh? Because that'll update boxed-cpp that comes with operator<=> support.

What I was referring to is in the tests. That can be worked around by simply not building tests (for now). I'll fix that asap. :)

herrhotzenplotz commented 5 months ago

Aha, thank you. Cleaning the entire tree and re-running the install-deps.sh script fixed the issue.

Sorry for the noise.

christianparpart commented 5 months ago

But there is some truth in it, still. We must version-check libs like boxed-cpp to avoid such confusion.

christianparpart commented 5 months ago

p.s.: we've now added checks to our CMake files to ensure that libunicode as well as boxed-cpp is on its minimum version required for Contour. :)