On Thu, November 2, 2023 17:35, Stuart Henderson wrote:
> cataclysm-dda's src/third-party/flatbuffers_int/base.h has this, which
> looks for a string_view implementation:

Hi!
cataclysm-tiles works fine for me on amd64.
OK kirby@

>
>     215 #ifndef FLATBUFFERS_HAS_STRING_VIEW
>     216   // Only provide flatbuffers::string_view if __has_include can be
> used
>     217   // to detect a header that provides an implementation
>     218   #if defined(__has_include)
>     219     // Check for std::string_view (in c++17)
>     220     #if __has_include(<string_view>) && (__cplusplus >= 201606 ||
> (defined(_HAS_CXX17) && _HAS_CXX17))
>     221       #include <string_view>
>     222       namespace flatbuffers {
>     223         typedef std::string_view string_view;
>     224       }
>     225       #define FLATBUFFERS_HAS_STRING_VIEW 1
>     226     // Check for std::experimental::string_view (in c++14,
> compiler-dependent)
>     227     #elif __has_include(<experimental/string_view>) && (__cplusplus >=
> 201411)
>     228       #include <experimental/string_view>
>     229       namespace flatbuffers {
>     230         typedef std::experimental::string_view string_view;
>     231       }
>     232       #define FLATBUFFERS_HAS_STRING_VIEW 1
>     233     // Check for absl::string_view
>     234     #elif __has_include("absl/strings/string_view.h")
>     235       #include "absl/strings/string_view.h"
>     236       namespace flatbuffers {
>     237         typedef absl::string_view string_view;
>     238       }
>     239       #define FLATBUFFERS_HAS_STRING_VIEW 1
>     240     #endif
>     241   #endif // __has_include
>     242 #endif // !FLATBUFFERS_HAS_STRING_VIEW
>
> I ran into a case where it looks like it may have picked up abseil which
> was then junked during build:
>
> FAILED: src/CMakeFiles/cataclysm-common.dir/overmap_connection.cpp.o
> /pobj/cataclysm-dda-0.G-no_x11/bin/c++ -DCMAKE -DDATA_DIR_PREFIX -DLOCALIZE
> -DPREFIX=/usr/local -DRELEASE -DUSE_HOME_DIR
> -I/pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src -isystem
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/third-party -O2 -pipe
> -I/usr/local/include -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op
> -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast
> -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros
> -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wredundant-decls
> -fsigned-char -DNDEBUG -std=c++14 -pthread -MD -MT
> src/CMakeFiles/cataclysm-common.dir/overmap_connection.cpp.o -MF
> src/CMakeFiles/cataclysm-common.dir/overmap_connection.cpp.o.d -o
> src/CMakeFiles/cataclysm-common.dir/overmap_connection.cpp.o -c
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/overmap_connection.cpp
> In file included from
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/overmap_connection.cpp:1:
> In file included from
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/overmap_connection.h:11:
> In file included from
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/omdata.h:16:
> In file included from
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/assign.h:17:
> In file included from
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/json.h:1600:
> In file included from
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/flexbuffer_json.h:8:
> In file included from
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/third-party/flatbuffers_int/flexbuffers.h:22:
> In file included from
> /pobj/cataclysm-dda-0.G-no_x11/Cataclysm-DDA-0.G/src/third-party/flatbuffers_int/base.h:235:
> /usr/local/include/absl/strings/string_view.h:39:10: fatal error:
> 'absl/base/attributes.h' file not found
> #include "absl/base/attributes.h"
>          ^~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
> ninja: build stopped: subcommand failed.
>
> I suppose junking must have happened right while the headers were being
> handled by the compiler (after it handled the __has_include and before
> getting as far as absl/base/attributes.h).
>
> I wonder if the simplest fix might actually be to switch to c++17
> so the standard library implementation can be used instead.
> Upstream already made that change:
>
> https://github.com/CleverRaven/Cataclysm-DDA/commit/0fa8e7e7447b5aee2296028c5245580842a6a6df
> https://github.com/CleverRaven/Cataclysm-DDA/commit/0b5dfd4e6ba47957fb2fe8aeb802c42c1d862d37
>
> Diff for that below. Build tested only.
>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/games/cataclysm-dda/Makefile,v
> retrieving revision 1.28
> diff -u -p -r1.28 Makefile
> --- Makefile  23 Aug 2023 20:27:27 -0000      1.28
> +++ Makefile  2 Nov 2023 13:51:57 -0000
> @@ -6,7 +6,7 @@ GH_PROJECT=           Cataclysm-DDA
>  GH_TAGNAME=          0.G
>  DISTNAME=            cataclysm-dda-${GH_TAGNAME}
>  EPOCH=                       0
> -REVISION=            0
> +REVISION=            1
>
>  HOMEPAGE=            https://cataclysmdda.org
>  MAINTAINER=          Kirill Bychkov <ki...@openbsd.org>
> Index: patches/patch-CMakeLists_txt
> ===================================================================
> RCS file: /cvs/ports/games/cataclysm-dda/patches/patch-CMakeLists_txt,v
> retrieving revision 1.1
> diff -u -p -r1.1 patch-CMakeLists_txt
> --- patches/patch-CMakeLists_txt      8 Mar 2023 20:00:59 -0000       1.1
> +++ patches/patch-CMakeLists_txt      2 Nov 2023 13:51:57 -0000
> @@ -1,3 +1,9 @@
> +hunk #2:
> +From 0b5dfd4e6ba47957fb2fe8aeb802c42c1d862d37 Mon Sep 17 00:00:00 2001
> +From: John Bytheway <52664+jbythe...@users.noreply.github.com>
> +Date: Sat, 11 Mar 2023 06:34:29 -0500
> +Subject: [PATCH] Switch build configs to C++17
> +
>  Index: CMakeLists.txt
>  --- CMakeLists.txt.orig
>  +++ CMakeLists.txt
> @@ -10,3 +16,12 @@ Index: CMakeLists.txt
>       if (NOT DATA_PREFIX)
>           set(DATA_PREFIX ${CMAKE_INSTALL_PREFIX}/share/cataclysm-dda)
>       endif ()
> +@@ -262,7 +262,7 @@ if (NOT MSVC)
> +     set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
> + endif ()
> +
> +-set(CMAKE_CXX_STANDARD 14)
> ++set(CMAKE_CXX_STANDARD 17)
> + set(CMAKE_CXX_STANDARD_REQUIRED ON)
> + set(CMAKE_CXX_EXTENSIONS OFF)
> +
> Index: patches/patch-src_cata_small_literal_vector_h
> ===================================================================
> RCS file: patches/patch-src_cata_small_literal_vector_h
> diff -N patches/patch-src_cata_small_literal_vector_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_cata_small_literal_vector_h     2 Nov 2023 13:51:57 
> -0000
> @@ -0,0 +1,28 @@
> +From 0fa8e7e7447b5aee2296028c5245580842a6a6df Mon Sep 17 00:00:00 2001
> +From: John Bytheway <52664+jbythe...@users.noreply.github.com>
> +Date: Sat, 11 Mar 2023 07:02:46 -0500
> +Subject: [PATCH] C++17 fixes
> +
> +Index: src/cata_small_literal_vector.h
> +--- src/cata_small_literal_vector.h.orig
> ++++ src/cata_small_literal_vector.h
> +@@ -3,6 +3,7 @@
> + #define CATA_SRC_CATA_SMALL_LITERAL_VECTOR_H
> +
> + #include <cstdlib>
> ++#include <limits>
> + #include <memory>
> + #include <stdexcept>
> + #include <type_traits>
> +@@ -20,7 +21,10 @@ template<typename T, size_t kInlineCount = 4, typename
> + struct alignas( T * ) small_literal_vector {
> +     // To avoid having to invoke constructors and destructors when copying
> Elements
> +     // around or inserting new ones, we enforce it is a literal type.
> +-    static_assert( std::is_literal_type<T>::value, "T must be literal." );
> ++    static_assert( std::is_trivially_destructible_v<T>, "T must be trivially
> destructible." );
> ++    static_assert( std::is_trivially_copyable_v<T>, "T must be trivially
> copyable." );
> ++    static_assert( std::is_trivially_default_constructible_v<T>,
> ++                   "T must be trivially default constuctible." );
> +
> +     small_literal_vector() : heap_( nullptr ), capacity_( kInlineCount ),
> len_( 0 ) {}
> +     small_literal_vector( const small_literal_vector &other ) : capacity_(
> kInlineCount ), len_( 0 ) {
> Index: patches/patch-src_filesystem_cpp
> ===================================================================
> RCS file: patches/patch-src_filesystem_cpp
> diff -N patches/patch-src_filesystem_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_filesystem_cpp  2 Nov 2023 13:51:57 -0000
> @@ -0,0 +1,17 @@
> +From 0fa8e7e7447b5aee2296028c5245580842a6a6df Mon Sep 17 00:00:00 2001
> +From: John Bytheway <52664+jbythe...@users.noreply.github.com>
> +Date: Sat, 11 Mar 2023 07:02:46 -0500
> +Subject: [PATCH] C++17 fixes
> +
> +Index: src/filesystem.cpp
> +--- src/filesystem.cpp.orig
> ++++ src/filesystem.cpp
> +@@ -153,7 +153,7 @@ void for_each_dir_entry( const fs::path &path, Functio
> +                                       e_str << "\".";
> +         return;
> +     }
> +-    for( const ghc::filesystem::directory_entry &dir_entry : dir_iter ) {
> ++    for( const fs::directory_entry &dir_entry : dir_iter ) {
> +         function( dir_entry );
> +     }
> + }
> Index: patches/patch-src_json_cpp
> ===================================================================
> RCS file: patches/patch-src_json_cpp
> diff -N patches/patch-src_json_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_json_cpp        2 Nov 2023 13:51:57 -0000
> @@ -0,0 +1,17 @@
> +From 0fa8e7e7447b5aee2296028c5245580842a6a6df Mon Sep 17 00:00:00 2001
> +From: John Bytheway <52664+jbythe...@users.noreply.github.com>
> +Date: Sat, 11 Mar 2023 07:02:46 -0500
> +Subject: [PATCH] C++17 fixes
> +
> +Index: src/json.cpp
> +--- src/json.cpp.orig
> ++++ src/json.cpp
> +@@ -141,7 +141,7 @@ void TextJsonObject::report_unvisited() const
> + {
> + #ifndef CATA_IN_TOOL
> +     if( report_unvisited_members && !reported_unvisited_members &&
> +-        !std::uncaught_exception() ) {
> ++        !std::uncaught_exceptions() ) {
> +         reported_unvisited_members = true;
> +         for( const std::pair<const std::string, int> &p : positions ) {
> +             const std::string &name = p.first;
> Index: patches/patch-src_tgz_archiver_h
> ===================================================================
> RCS file: patches/patch-src_tgz_archiver_h
> diff -N patches/patch-src_tgz_archiver_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_tgz_archiver_h  2 Nov 2023 13:51:57 -0000
> @@ -0,0 +1,26 @@
> +From 0fa8e7e7447b5aee2296028c5245580842a6a6df Mon Sep 17 00:00:00 2001
> +From: John Bytheway <52664+jbythe...@users.noreply.github.com>
> +Date: Sat, 11 Mar 2023 07:02:46 -0500
> +Subject: [PATCH] C++17 fixes
> +
> +Index: src/tgz_archiver.h
> +--- src/tgz_archiver.h.orig
> ++++ src/tgz_archiver.h
> +@@ -2,6 +2,7 @@
> + #define CATA_SRC_MAP_TGZ_ARCHIVER_H
> + #include <array>
> + #include <chrono>
> ++#include <filesystem>
> + #include <string>
> + #include <utility>
> +
> +@@ -18,7 +19,8 @@ class tgz_archiver
> +
> +         gzFile fd = nullptr;
> +         std::string const output;
> +-        std::chrono::system_clock::time_point const _fsnow, _sysnow;
> ++        fs::file_time_type const _fsnow;
> ++        std::chrono::system_clock::time_point const _sysnow;
> +
> +     public:
> +         explicit tgz_archiver( std::string ofile )
>


Reply via email to