This is an automated email from the ASF dual-hosted git repository. martinzink pushed a commit to branch test_on_apache_mzink in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 898868fc598df55c830b45c914a55cc8efb1229d Author: Martin Zink <[email protected]> AuthorDate: Tue Jul 22 10:19:03 2025 +0200 add gcc15 support --- cmake/Catch2.cmake | 4 +- cmake/ExpectedLite.cmake | 6 +- cmake/LlamaCpp.cmake | 9 +- cmake/PahoMqttC.cmake | 16 ++-- extensions/sql/CMakeLists.txt | 2 + libminifi/test/unit/ExpectedTest.cpp | 15 +++- minifi-api/include/minifi-cpp/utils/Literals.h | 22 ++--- .../GCC-15-needs-typedef-SQLRETURN-HPROC.patch | 25 ++++++ thirdparty/llamacpp/cpp-23-fixes.patch | 24 ++++++ .../1576-Changed-bool-typedef-to-bit.patch | 96 ++++++++++++++++++++++ 10 files changed, 192 insertions(+), 27 deletions(-) diff --git a/cmake/Catch2.cmake b/cmake/Catch2.cmake index bc24b484f..2986f0487 100644 --- a/cmake/Catch2.cmake +++ b/cmake/Catch2.cmake @@ -20,8 +20,8 @@ include(FetchContent) FetchContent_Declare( Catch2 - URL https://github.com/catchorg/Catch2/archive/refs/tags/v3.4.0.tar.gz - URL_HASH SHA256=122928b814b75717316c71af69bd2b43387643ba076a6ec16e7882bfb2dfacbb + URL https://github.com/catchorg/Catch2/archive/refs/tags/v3.8.1.tar.gz + URL_HASH SHA256=18b3f70ac80fccc340d8c6ff0f339b2ae64944782f8d2fca2bd705cf47cadb79 SYSTEM ) FetchContent_MakeAvailable(Catch2) diff --git a/cmake/ExpectedLite.cmake b/cmake/ExpectedLite.cmake index 178e9d4c1..36cf54c02 100644 --- a/cmake/ExpectedLite.cmake +++ b/cmake/ExpectedLite.cmake @@ -18,8 +18,10 @@ include(FetchContent) FetchContent_Declare(expected-lite - URL https://github.com/martinmoene/expected-lite/archive/refs/tags/v0.8.0.tar.gz - URL_HASH SHA256=27649f30bd9d4fe7b193ab3eb6f78c64d0f585c24c085f340b4722b3d0b5e701 + URL https://github.com/martinmoene/expected-lite/archive/refs/tags/v0.9.0.tar.gz + URL_HASH SHA256=e1b3ac812295ef8512c015d8271204105a71957323f8ab4e75f6856d71b8868d SYSTEM ) + +add_compile_definitions(nsel_CONFIG_SELECT_EXPECTED=1) # Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119714 FetchContent_MakeAvailable(expected-lite) diff --git a/cmake/LlamaCpp.cmake b/cmake/LlamaCpp.cmake index 44f4594b5..f78101c6f 100644 --- a/cmake/LlamaCpp.cmake +++ b/cmake/LlamaCpp.cmake @@ -31,12 +31,15 @@ else() endif() set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/llamacpp/lu8_macro_fix.patch") # https://github.com/ggml-org/llama.cpp/issues/12740 +set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/llamacpp/cpp-23-fixes.patch") + set(PC ${Bash_EXECUTABLE} -c "set -x &&\ - (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_1}\\\")") + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_1}\\\") &&\ + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\")") FetchContent_Declare(llamacpp - URL https://github.com/ggerganov/llama.cpp/archive/refs/tags/b5502.tar.gz - URL_HASH SHA256=9436852125dfe1b33ed47c5fb78bde614d9a8393072c5fa9689d0eaf2727dd1a + URL https://github.com/ggml-org/llama.cpp/archive/refs/tags/b5958.tar.gz + URL_HASH SHA256=4e8a2abd83092aa446cd13556f6fe8777139da7b191bdaa0e1b79fe9740b36a6 PATCH_COMMAND "${PC}" SYSTEM ) diff --git a/cmake/PahoMqttC.cmake b/cmake/PahoMqttC.cmake index 2b42cf0dd..322239025 100644 --- a/cmake/PahoMqttC.cmake +++ b/cmake/PahoMqttC.cmake @@ -23,16 +23,18 @@ set(PAHO_BUILD_SHARED OFF CACHE BOOL "" FORCE) set(PAHO_ENABLE_TESTING OFF CACHE BOOL "" FORCE) set(PAHO_WITH_SSL ON CACHE BOOL "" FORCE) -set(PATCH_FILE "${CMAKE_SOURCE_DIR}/thirdparty/paho-mqtt/cmake-openssl.patch") +set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/paho-mqtt/cmake-openssl.patch") +set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/paho-mqtt/1576-Changed-bool-typedef-to-bit.patch") set(PC ${Bash_EXECUTABLE} -c "set -x &&\ - (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE}\\\")") + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_1}\\\") &&\ + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\")") FetchContent_Declare( - paho.mqtt.c-external - URL "https://github.com/eclipse/paho.mqtt.c/archive/refs/tags/v1.3.14.tar.gz" - URL_HASH "SHA256=7af7d906e60a696a80f1b7c2bd7d6eb164aaad908ff4c40c3332ac2006d07346" - PATCH_COMMAND "${PC}" - SYSTEM + paho.mqtt.c-external + URL "https://github.com/eclipse/paho.mqtt.c/archive/refs/tags/v1.3.14.tar.gz" + URL_HASH "SHA256=7af7d906e60a696a80f1b7c2bd7d6eb164aaad908ff4c40c3332ac2006d07346" + PATCH_COMMAND "${PC}" + SYSTEM ) FetchContent_MakeAvailable(paho.mqtt.c-external) diff --git a/extensions/sql/CMakeLists.txt b/extensions/sql/CMakeLists.txt index 9b7c025a0..39f9ce82b 100644 --- a/extensions/sql/CMakeLists.txt +++ b/extensions/sql/CMakeLists.txt @@ -40,6 +40,7 @@ else() set(IODBC_BYPRODUCT_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/iodbc-install/") + set(IODBC_PC "${Patch_EXECUTABLE}" -p1 -i "${CMAKE_SOURCE_DIR}/thirdparty/iODBC/GCC-15-needs-typedef-SQLRETURN-HPROC.patch") # Build project ExternalProject_Add( iodbc-external @@ -47,6 +48,7 @@ else() URL_HASH "SHA256=896d7e16b283cf9a6f5b5f46e8e9549aef21a11935726b0170987cd4c59d16db" BUILD_IN_SOURCE true SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/iodbc-src" + PATCH_COMMAND "${IODBC_PC}" BUILD_COMMAND make CMAKE_COMMAND "" UPDATE_COMMAND "" diff --git a/libminifi/test/unit/ExpectedTest.cpp b/libminifi/test/unit/ExpectedTest.cpp index 5d123c757..44d475e4f 100644 --- a/libminifi/test/unit/ExpectedTest.cpp +++ b/libminifi/test/unit/ExpectedTest.cpp @@ -156,7 +156,7 @@ TEST_CASE("expected transform", "[expected][transform]") { nonstd::expected<int, int> e(42); auto ret = e | utils::transform([](int& i) -> int& { return i; }); REQUIRE(ret); - REQUIRE(ret == 42); + REQUIRE(*ret == 42); } } @@ -341,7 +341,7 @@ TEST_CASE("expected orElse", "[expected][orElse]") { nonstd::expected<int, int> e = 21; auto ret = std::move(e) | utils::orElse(fail); REQUIRE(ret); - REQUIRE(ret == 21); + REQUIRE(*ret == 21); } @@ -349,7 +349,7 @@ TEST_CASE("expected orElse", "[expected][orElse]") { nonstd::expected<int, eptr> e = 21; auto ret = std::move(e) | utils::orElse(efail); REQUIRE(ret); - REQUIRE(ret == 21); + REQUIRE(*ret == 21); } { @@ -558,6 +558,15 @@ TEST_CASE("expected orThrow") { nonstd::expected<int, std::string> unexpected{nonstd::unexpect, "hello"}; nonstd::expected<int, std::string> expected{5}; + REQUIRE_THROWS_WITH(std::move(unexpected) | utils::orThrow("should throw"), "should throw, but got hello"); CHECK((expected | utils::orThrow("should be 5")) == 5); } + +// This fails to compile with std::expected on GCC 15.1 due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119714 +TEST_CASE("") { + nonstd::expected<int, std::string> a; + nonstd::expected<int, std::string> b; + + CHECK(a == b); +} diff --git a/minifi-api/include/minifi-cpp/utils/Literals.h b/minifi-api/include/minifi-cpp/utils/Literals.h index 8a48bc3ea..20e645185 100644 --- a/minifi-api/include/minifi-cpp/utils/Literals.h +++ b/minifi-api/include/minifi-cpp/utils/Literals.h @@ -18,42 +18,44 @@ #pragma once -constexpr unsigned long long operator""_KiB(unsigned long long n) { +#include <cstdint> + +constexpr uint64_t operator""_KiB(const unsigned long long n) { return 1024 * n; } -constexpr unsigned long long operator""_MiB(unsigned long long n) { +constexpr uint64_t operator""_MiB(const unsigned long long n) { return 1024_KiB * n; } -constexpr unsigned long long operator""_GiB(unsigned long long n) { +constexpr uint64_t operator""_GiB(const unsigned long long n) { return 1024_MiB * n; } -constexpr unsigned long long operator""_TiB(unsigned long long n) { +constexpr uint64_t operator""_TiB(const unsigned long long n) { return 1024_GiB * n; } -constexpr unsigned long long operator""_PiB(unsigned long long n) { +constexpr uint64_t operator""_PiB(const unsigned long long n) { return 1024_TiB * n; } -constexpr unsigned long long operator""_KB(unsigned long long n) { +constexpr uint64_t operator""_KB(const unsigned long long n) { return 1000 * n; } -constexpr unsigned long long operator""_MB(unsigned long long n) { +constexpr uint64_t operator""_MB(const unsigned long long n) { return 1000_KB * n; } -constexpr unsigned long long operator""_GB(unsigned long long n) { +constexpr uint64_t operator""_GB(const unsigned long long n) { return 1000_MB * n; } -constexpr unsigned long long operator""_TB(unsigned long long n) { +constexpr uint64_t operator""_TB(const unsigned long long n) { return 1000_GB * n; } -constexpr unsigned long long operator""_PB(unsigned long long n) { +constexpr uint64_t operator""_PB(const unsigned long long n) { return 1000_TB * n; } diff --git a/thirdparty/iODBC/GCC-15-needs-typedef-SQLRETURN-HPROC.patch b/thirdparty/iODBC/GCC-15-needs-typedef-SQLRETURN-HPROC.patch new file mode 100644 index 000000000..fe025bdfc --- /dev/null +++ b/thirdparty/iODBC/GCC-15-needs-typedef-SQLRETURN-HPROC.patch @@ -0,0 +1,25 @@ +From 2d9ed2ef9d1cc320df388235356574890d7046d6 Mon Sep 17 00:00:00 2001 +From: Martin Zink <[email protected]> +Date: Tue, 22 Jul 2025 13:28:10 +0200 +Subject: [PATCH] GCC 15 needs typedef SQLRETURN (* HPROC) (...); + +--- + iodbc/dlproc.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/iodbc/dlproc.h b/iodbc/dlproc.h +index be2062b..ed15754 100644 +--- a/iodbc/dlproc.h ++++ b/iodbc/dlproc.h +@@ -80,7 +80,7 @@ + + #include <dlf.h> + +-#if defined(_MAC) || defined (__cplusplus) ++#if defined(_MAC) || defined (__cplusplus) || (defined(__GNUC__) && __GNUC__ >= 15) + typedef SQLRETURN (* HPROC) (...); + #else + typedef SQLRETURN (* HPROC) (); +-- +2.50.1 + diff --git a/thirdparty/llamacpp/cpp-23-fixes.patch b/thirdparty/llamacpp/cpp-23-fixes.patch new file mode 100644 index 000000000..0e84e4395 --- /dev/null +++ b/thirdparty/llamacpp/cpp-23-fixes.patch @@ -0,0 +1,24 @@ +From 072bd8ce7e10a0fffb1e2bc755c2964e472909ed Mon Sep 17 00:00:00 2001 +From: Martin Zink <[email protected]> +Date: Tue, 22 Jul 2025 12:49:42 +0200 +Subject: [PATCH] c++23 fixes + +--- + src/llama-hparams.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/llama-hparams.cpp b/src/llama-hparams.cpp +index c6c67d26..db36de4d 100644 +--- a/src/llama-hparams.cpp ++++ b/src/llama-hparams.cpp +@@ -1,5 +1,7 @@ + #include "llama-hparams.h" + ++#include <algorithm> ++ + #include "ggml.h" + + void llama_hparams::set_swa_pattern(uint32_t n_pattern) { +-- +2.39.5 (Apple Git-154) + diff --git a/thirdparty/paho-mqtt/1576-Changed-bool-typedef-to-bit.patch b/thirdparty/paho-mqtt/1576-Changed-bool-typedef-to-bit.patch new file mode 100644 index 000000000..d3cfa8068 --- /dev/null +++ b/thirdparty/paho-mqtt/1576-Changed-bool-typedef-to-bit.patch @@ -0,0 +1,96 @@ +From e4021c717f7f1623b02788216cc2a07e9556b4d0 Mon Sep 17 00:00:00 2001 +From: fpagliughi <[email protected]> +Date: Wed, 14 May 2025 17:56:02 -0400 +Subject: [PATCH] #1576 Changed 'bool' typedef to 'bit' + +--- + src/MQTTPacket.h | 34 +++++++++++++++++----------------- + 1 file changed, 17 insertions(+), 17 deletions(-) + +diff --git a/src/MQTTPacket.h b/src/MQTTPacket.h +index fd384ae..04c217e 100644 +--- a/src/MQTTPacket.h ++++ b/src/MQTTPacket.h +@@ -28,7 +28,7 @@ + #include "LinkedList.h" + #include "Clients.h" + +-typedef unsigned int bool; ++typedef unsigned int bit; + typedef void* (*pf)(int, unsigned char, char*, size_t); + + #include "MQTTProperties.h" +@@ -67,16 +67,16 @@ typedef union + struct + { + unsigned int type : 4; /**< message type nibble */ +- bool dup : 1; /**< DUP flag bit */ ++ bit dup : 1; /**< DUP flag bit */ + unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */ +- bool retain : 1; /**< retained flag bit */ ++ bit retain : 1; /**< retained flag bit */ + } bits; + #else + struct + { +- bool retain : 1; /**< retained flag bit */ ++ bit retain : 1; /**< retained flag bit */ + unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */ +- bool dup : 1; /**< DUP flag bit */ ++ bit dup : 1; /**< DUP flag bit */ + unsigned int type : 4; /**< message type nibble */ + } bits; + #endif +@@ -95,24 +95,24 @@ typedef struct + #if defined(REVERSED) + struct + { +- bool username : 1; /**< 3.1 user name */ +- bool password : 1; /**< 3.1 password */ +- bool willRetain : 1; /**< will retain setting */ ++ bit username : 1; /**< 3.1 user name */ ++ bit password : 1; /**< 3.1 password */ ++ bit willRetain : 1; /**< will retain setting */ + unsigned int willQoS : 2; /**< will QoS value */ +- bool will : 1; /**< will flag */ +- bool cleanstart : 1; /**< cleansession flag */ ++ bit will : 1; /**< will flag */ ++ bit cleanstart : 1; /**< cleansession flag */ + int : 1; /**< unused */ + } bits; + #else + struct + { + int : 1; /**< unused */ +- bool cleanstart : 1; /**< cleansession flag */ +- bool will : 1; /**< will flag */ ++ bit cleanstart : 1; /**< cleansession flag */ ++ bit will : 1; /**< will flag */ + unsigned int willQoS : 2; /**< will QoS value */ +- bool willRetain : 1; /**< will retain setting */ +- bool password : 1; /**< 3.1 password */ +- bool username : 1; /**< 3.1 user name */ ++ bit willRetain : 1; /**< will retain setting */ ++ bit password : 1; /**< 3.1 password */ ++ bit username : 1; /**< 3.1 user name */ + } bits; + #endif + } flags; /**< connect flags byte */ +@@ -140,12 +140,12 @@ typedef struct + struct + { + unsigned int reserved : 7; /**< message type nibble */ +- bool sessionPresent : 1; /**< was a session found on the server? */ ++ bit sessionPresent : 1; /**< was a session found on the server? */ + } bits; + #else + struct + { +- bool sessionPresent : 1; /**< was a session found on the server? */ ++ bit sessionPresent : 1; /**< was a session found on the server? */ + unsigned int reserved : 7; /**< message type nibble */ + } bits; + #endif +-- +2.39.5 (Apple Git-154) +
