This is an automated email from the ASF dual-hosted git repository. fgerlits pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit f85ebaa75e0ec51ea9c23ca8e7bbe45e85a6a4b1 Author: Martin Zink <[email protected]> AuthorDate: Wed May 21 13:31:04 2025 +0200 MINIFICPP-2567 C++23 Support Signed-off-by: Ferenc Gerlits <[email protected]> Closes #1968 --- .clang-tidy | 57 +- .dockerignore | 2 + .github/workflows/ci.yml | 18 +- .github/workflows/compiler-support.yml | 51 ++ .github/workflows/verify-package.yml | 1 + CMakeLists.txt | 10 +- README.md | 5 +- bootstrap/system_dependency.py | 2 +- cmake/Abseil.cmake | 1 + cmake/ArgParse.cmake | 1 + cmake/Asio.cmake | 5 +- cmake/AzureSdkCpp.cmake | 4 +- cmake/BundledAwsSdkCpp.cmake | 4 +- cmake/BundledOpen62541.cmake | 3 +- cmake/BundledOpenCV.cmake | 6 + cmake/BundledRocksDB.cmake | 17 +- cmake/Bustache.cmake | 7 +- cmake/Catch2.cmake | 5 +- cmake/CivetWeb.cmake | 1 + cmake/Couchbase.cmake | 9 +- cmake/{Couchbase.cmake => Couchbase_1_0_2.cmake} | 4 +- cmake/CppVersion.cmake | 19 +- cmake/Crc32c.cmake | 1 + cmake/Date.cmake | 2 + cmake/ExpectedLite.cmake | 8 +- cmake/FetchBenchmark.cmake | 1 + cmake/FetchUvc.cmake | 1 + cmake/Fetchlibrdkafka.cmake | 1 + cmake/{ExpectedLite.cmake => GetFmt_11_0_2.cmake} | 16 +- cmake/GetSpdlog.cmake | 9 +- cmake/GoogleCloudCpp.cmake | 12 +- cmake/Grpc.cmake | 1 + cmake/GslLite.cmake | 1 + cmake/JoltTests.cmake | 1 + cmake/JsonSchemaValidator.cmake | 3 +- cmake/KubernetesClientC.cmake | 3 + cmake/LZ4.cmake | 1 + cmake/LibLZMA.cmake | 3 +- cmake/LlamaCpp.cmake | 10 +- cmake/Lua.cmake | 1 + cmake/MagicEnum.cmake | 3 +- cmake/MiMalloc.cmake | 1 + cmake/PahoMqttC.cmake | 15 +- cmake/Prometheus.cmake | 1 + cmake/RangeV3.cmake | 7 + cmake/RpMalloc.cmake | 1 + cmake/Sol2.cmake | 36 +- cmake/Spdlog.cmake | 7 +- cmake/Zstd.cmake | 1 + cmake/fmt.cmake | 5 +- cmake/{fmt.cmake => fmt_11_0_2.cmake} | 1 + core-framework/include/utils/expected.h | 29 +- core-framework/include/utils/net/AsioCoro.h | 4 +- core-framework/include/utils/net/AsioSocketUtils.h | 2 +- core-framework/src/utils/net/DNS.cpp | 7 +- docker/centos/Dockerfile | 67 --- docker/compiler-test/clang.Dockerfile | 22 + docker/compiler-test/gcc.Dockerfile | 18 + extensions/couchbase/CMakeLists.txt | 7 +- extensions/expression-language/CMakeLists.txt | 1 + extensions/gcp/CMakeLists.txt | 3 + extensions/gcp/tests/CMakeLists.txt | 8 +- extensions/sql/CMakeLists.txt | 2 + extensions/sql/processors/ExecuteSQL.cpp | 3 +- .../controllers/JsonRecordSetWriter.cpp | 10 +- .../controllers/JsonTreeReader.cpp | 2 +- .../standard-processors/modbus/ByteConverters.h | 1 + .../standard-processors/tests/unit/PutTCPTests.cpp | 2 +- .../tests/unit/RecordSetTests.cpp | 16 +- libminifi/src/core/RecordField.cpp | 6 +- .../src/core/flow/StructuredConfiguration.cpp | 6 +- libminifi/test/libtest/unit/TestRecord.h | 12 +- libminifi/test/unit/ExpectedTest.cpp | 26 +- libminifi/test/unit/NetUtilsTest.cpp | 30 +- minifi-api/include/minifi-cpp/core/RecordField.h | 26 +- minifi-api/include/minifi-cpp/utils/Literals.h | 22 +- run_clang_tidy.sh | 2 +- .../fix-deprecated-literal-operator.patch | 31 + .../include-cinttypes-for-uint8_t-gcc15-fix.patch | 24 + .../bustache/fix-deprecated-literal-operator.patch | 19 + thirdparty/couchbase/c++23_fixes.patch | 78 +++ ...rdparty.patch => remove-thirdparty-1.0.2.patch} | 0 thirdparty/couchbase/remove-thirdparty.patch | 123 +++- thirdparty/google-cloud-cpp/c++23_fixes.patch | 19 + .../GCC-15-needs-typedef-SQLRETURN-HPROC.patch | 25 + thirdparty/llamacpp/cpp-23-fixes.patch | 24 + thirdparty/opencv/c++23_fixes.patch | 23 + .../1576-Changed-bool-typedef-to-bit.patch | 96 +++ thirdparty/ranges-v3/remove-deprecated.patch | 27 + thirdparty/rocksdb/all/patches/arm7.patch | 15 - thirdparty/rocksdb/all/patches/c++23_fixes.patch | 641 +++++++++++++++++++++ thirdparty/rocksdb/all/patches/cstdint.patch | 12 - 92 files changed, 1549 insertions(+), 327 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index de57fee56..f3d287289 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -202,5 +202,60 @@ Checks: > google-readability-todo, google-runtime-int, google-runtime-operator, - google-upgrade-googletest-case + google-upgrade-googletest-case, + bugprone-capturing-this-in-member-variable, + bugprone-casting-through-void, + bugprone-compare-pointer-to-member-virtual-function, + bugprone-crtp-constructor-accessibility, + bugprone-inc-dec-in-conditions, + bugprone-incorrect-enable-if, + bugprone-incorrect-enable-shared-from-this, + bugprone-misleading-setter-of-reference, + bugprone-multi-level-implicit-pointer-conversion, + bugprone-multiple-new-in-one-expression, + bugprone-narrowing-conversions, + bugprone-non-zero-enum-to-bool-conversion, + bugprone-nondeterministic-pointer-iteration-order, + bugprone-optional-value-conversion, + bugprone-pointer-arithmetic-on-polymorphic-object, + bugprone-return-const-ref-from-parameter, + bugprone-suspicious-stringview-data-usage, + bugprone-switch-missing-default-case, + bugprone-tagged-union-member-count, + bugprone-unintended-char-ostream-output, + bugprone-unique-ptr-array-mismatch, + bugprone-unsafe-functions, + bugprone-unused-local-non-trivial-variable, + cppcoreguidelines-avoid-capturing-lambda-coroutines, + cppcoreguidelines-misleading-capture-default-by-value, + cppcoreguidelines-missing-std-forward, + cppcoreguidelines-no-suspend-with-lock, + cppcoreguidelines-use-enum-class, + hicpp-ignored-remove-result, + misc-coroutine-hostile-raii, + misc-header-include-cycle, + modernize-min-max-use-initializer-list, + modernize-type-traits, + modernize-use-constraints, + modernize-use-integer-sign-comparison, + modernize-use-scoped-lock, + modernize-use-starts-ends-with, + modernize-use-std-format, + modernize-use-std-numbers, + modernize-use-std-print, + performance-noexcept-destructor, + performance-noexcept-swap, + portability-avoid-pragma-once, + portability-template-virtual-member-function, + readability-ambiguous-smartptr-reset-call, + readability-avoid-nested-conditional-operator, + readability-avoid-return-with-void-value, + readability-avoid-unconditional-preprocessor-if, + readability-enum-initial-value, + readability-math-missing-parentheses, + readability-operators-representation, + readability-redundant-casting, + readability-redundant-inline-specifier, + readability-reference-to-constructed-temporary, + readability-use-std-min-max FormatStyle: 'file' diff --git a/.dockerignore b/.dockerignore index ab5c47d28..6a80bd238 100644 --- a/.dockerignore +++ b/.dockerignore @@ -64,3 +64,5 @@ libminifi/src/agent/agent_version.cpp **/cmake_install.cmake **/install_manifest.txt **/CTestTestfile.cmake +bootstrap/venv +bootstrap/option_state.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 188577166..c7bfa1785 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -285,10 +285,10 @@ jobs: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | sudo tee -a /etc/apt/sources.list echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | sudo tee -a /etc/apt/sources.list - echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list - echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list + echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee -a /etc/apt/sources.list + echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee -a /etc/apt/sources.list sudo apt update - sudo apt install -y ccache libfl-dev clang-16 clang-tidy-16 libc++-16-dev libc++abi-16-dev libc++1-16 libc++abi1-16 libunwind-16 libsqliteodbc parallel + sudo apt install -y ccache libfl-dev clang-20 clang-tidy-20 libc++-20-dev libc++abi-20-dev libsqliteodbc parallel echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts > /dev/null - id: free_disk_space @@ -303,8 +303,8 @@ jobs: sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: build run: | - export CC=clang-16 - export CXX=clang++-16 + export CC=clang-20 + export CXX=clang++-20 export CXXFLAGS="-stdlib=libc++" export LDFLAGS="-stdlib=libc++" python3 -m venv venv && source venv/bin/activate \ @@ -344,10 +344,10 @@ jobs: - name: clang-tidy run: | # https://stackoverflow.com/questions/58466701/clang-tidy-cant-locate-stdlib-headers - sed -i -e 's/\/usr\/lib\/ccache\/clang++-16/\/lib\/llvm-16\/bin\/clang++/g' build/compile_commands.json - sed -i -e 's/\/usr\/lib\/ccache\/clang-16/\/lib\/llvm-16\/bin\/clang/g' build/compile_commands.json - sed -i -e 's/\/usr\/lib\/ccache\/c++/\/lib\/llvm-16\/bin\/clang++/g' build/compile_commands.json - sed -i -e 's/\/usr\/lib\/ccache\/cc/\/lib\/llvm-16\/bin\/clang/g' build/compile_commands.json + sed -i -e 's/\/usr\/lib\/ccache\/clang++-20/\/lib\/llvm-20\/bin\/clang++/g' build/compile_commands.json + sed -i -e 's/\/usr\/lib\/ccache\/clang-20/\/lib\/llvm-20\/bin\/clang/g' build/compile_commands.json + sed -i -e 's/\/usr\/lib\/ccache\/c++/\/lib\/llvm-20\/bin\/clang++/g' build/compile_commands.json + sed -i -e 's/\/usr\/lib\/ccache\/cc/\/lib\/llvm-20\/bin\/clang/g' build/compile_commands.json parallel -j$(( $(nproc) + 1 )) ./run_clang_tidy.sh ::: ${{steps.list-changed-cpp-files.outputs.files}} - name: check-cores diff --git a/.github/workflows/compiler-support.yml b/.github/workflows/compiler-support.yml new file mode 100644 index 000000000..8179737df --- /dev/null +++ b/.github/workflows/compiler-support.yml @@ -0,0 +1,51 @@ +# .github/workflows/compiler-support.yml + +name: 'Check supported Compilers' + +on: [workflow_dispatch] + +jobs: + gcc-build: + name: ${{ matrix.platform.id }} + + strategy: + fail-fast: false + matrix: + platform: [ { id: gcc-12, base_image: gcc:12-bookworm }, + { id: gcc-15, base_image: gcc:15-bookworm } ] + runs-on: ubuntu-24.04 + + steps: + - name: 'Checkout repository code' + uses: actions/checkout@v4 + + - name: 'Build Project with ${{ matrix.platform.id }}' + run: | + docker build \ + --build-arg BASE_IMAGE=${{ matrix.platform.base_image }} \ + -t minifi-${{ matrix.platform.id }} \ + -f docker/compiler-test/gcc.Dockerfile \ + . + + clang-build: + name: ${{ matrix.platform.id }} + + strategy: + fail-fast: false + matrix: + platform: [ { id: clang-16, base_image: silkeh/clang:16-bookworm }, + { id: clang-20, base_image: silkeh/clang:20-bookworm } ] + + runs-on: ubuntu-24.04 + + steps: + - name: 'Checkout repository code' + uses: actions/checkout@v4 + + - name: 'Build Project with ${{ matrix.platform.id }}' + run: | + docker build \ + --build-arg BASE_IMAGE=${{ matrix.platform.base_image }} \ + -t minifi-${{ matrix.platform.id }} \ + -f docker/compiler-test/clang.Dockerfile \ + . diff --git a/.github/workflows/verify-package.yml b/.github/workflows/verify-package.yml index b4c1b76eb..20f769820 100644 --- a/.github/workflows/verify-package.yml +++ b/.github/workflows/verify-package.yml @@ -17,6 +17,7 @@ env: jobs: build-packages: + if: (github.event_name == 'schedule' && github.repository == 'apache/nifi-minifi-cpp') || (github.event_name != 'schedule') name: "Build package (${{ matrix.platform.arch }})" runs-on: ${{ matrix.platform.arch == 'x86_64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }} timeout-minutes: 180 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7748ac0e5..fae0cc88c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,10 +315,16 @@ else() list(APPEND MINIFI_CPP_COMPILE_OPTIONS -Wall -Wextra) if(MINIFI_FAIL_ON_WARNINGS) list(APPEND MINIFI_CPP_COMPILE_OPTIONS -Werror) - # -Wrestrict may cause build failure in GCC 12 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104336 - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + endif() + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.4) + # -Wrestrict may cause build failure in < GCC 12.4 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104336 list(APPEND MINIFI_CPP_COMPILE_OPTIONS -Wno-error=restrict) endif() + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15) + list(APPEND MINIFI_CPP_COMPILE_OPTIONS -Wno-maybe-uninitialized) + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118634 + endif() endif() endif() diff --git a/README.md b/README.md index 5e7102866..160d2fd61 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,10 @@ The next table outlines CMAKE flags that correspond with MiNiFi extensions. Exte #### Utilities * CMake 3.24 or greater -* gcc 11 or greater +* Compiler + * g++ 12 or greater + * clang 16 or greater + * msvc 19.33 or greater * bison 3.0.x+ (3.2 has been shown to fail builds) * flex 2.6 or greater diff --git a/bootstrap/system_dependency.py b/bootstrap/system_dependency.py index 02050b579..2a3b39386 100644 --- a/bootstrap/system_dependency.py +++ b/bootstrap/system_dependency.py @@ -23,7 +23,7 @@ import platform def _create_system_dependencies(minifi_options: MinifiOptions) -> Dict[str, Set[str]]: - system_dependencies = {'patch': {'patch'}, 'make': {'make'}, 'perl': {'perl'}} + system_dependencies = {'patch': {'patch'}, 'make': {'make'}, 'perl': {'perl'}, 'git': {'git'}} if minifi_options.is_enabled("ENABLE_EXPRESSION_LANGUAGE"): system_dependencies['bison'] = {'bison'} system_dependencies['flex'] = {'flex'} diff --git a/cmake/Abseil.cmake b/cmake/Abseil.cmake index cfa4a8b1b..9ed541e3a 100644 --- a/cmake/Abseil.cmake +++ b/cmake/Abseil.cmake @@ -32,5 +32,6 @@ FetchContent_Declare( URL_HASH SHA256=f50e5ac311a81382da7fa75b97310e4b9006474f9560ac46f54a9967f07d4ae3 PATCH_COMMAND "${PC}" OVERRIDE_FIND_PACKAGE + SYSTEM ) FetchContent_MakeAvailable(absl) diff --git a/cmake/ArgParse.cmake b/cmake/ArgParse.cmake index 29251ceb9..6af3bdbe1 100644 --- a/cmake/ArgParse.cmake +++ b/cmake/ArgParse.cmake @@ -20,5 +20,6 @@ FetchContent_Declare( argparse URL https://github.com/p-ranav/argparse/archive/refs/tags/v3.0.tar.gz URL_HASH SHA256=ba7b465759bb01069d57302855eaf4d1f7d677f21ad7b0b00b92939645c30f47 + SYSTEM ) FetchContent_MakeAvailable(argparse) diff --git a/cmake/Asio.cmake b/cmake/Asio.cmake index 6f94e6afe..4c351dc8b 100644 --- a/cmake/Asio.cmake +++ b/cmake/Asio.cmake @@ -18,8 +18,9 @@ include(FetchContent) FetchContent_Declare(asio - URL https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-28-1.tar.gz - URL_HASH SHA256=5ff6111ec8cbe73a168d997c547f562713aa7bd004c5c02326f0e9d579a5f2ce) + URL https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-34-2.tar.gz + URL_HASH SHA256=f3bac015305fbb700545bd2959fbc52d75a1ec2e05f9c7f695801273ceb78cf5 + SYSTEM) FetchContent_GetProperties(asio) if(NOT asio_POPULATED) diff --git a/cmake/AzureSdkCpp.cmake b/cmake/AzureSdkCpp.cmake index bafad992b..375785abe 100644 --- a/cmake/AzureSdkCpp.cmake +++ b/cmake/AzureSdkCpp.cmake @@ -39,11 +39,13 @@ set(DISABLE_AMQP ON CACHE INTERNAL "") set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/wil.patch") set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/fix-openssl-helper.patch") set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/fix-managed-identity.patch") +set(PATCH_FILE_4 "${CMAKE_SOURCE_DIR}/thirdparty/azure-sdk-cpp/include-cinttypes-for-uint8_t-gcc15-fix.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_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\") &&\ - (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_3}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_3}\\\")") + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_3}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_3}\\\") &&\ + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_4}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_4}\\\")") FetchContent_Declare(asdkext URL https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-identity_1.13.0.tar.gz diff --git a/cmake/BundledAwsSdkCpp.cmake b/cmake/BundledAwsSdkCpp.cmake index 672f73d7b..818c4cb19 100644 --- a/cmake/BundledAwsSdkCpp.cmake +++ b/cmake/BundledAwsSdkCpp.cmake @@ -20,11 +20,13 @@ function(use_bundled_libaws SOURCE_DIR BINARY_DIR) set(PATCH_FILE2 "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/shutdown-fix.patch") set(PATCH_FILE3 "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/bundle-openssl.patch") set(PATCH_FILE4 "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/fix-finding-s2n.patch") + set(PATCH_FILE5 "${SOURCE_DIR}/thirdparty/aws-sdk-cpp/fix-deprecated-literal-operator.patch") set(AWS_SDK_CPP_PATCH_COMMAND ${Bash_EXECUTABLE} -c "set -x &&\ (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE1}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE1}\") &&\ (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE2}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE2}\") &&\ (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE3}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE3}\") &&\ - (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE4}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE4}\") ") + (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE4}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE4}\") &&\ + (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE5}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE5}\") ") if (WIN32) set(LIBDIR "lib") diff --git a/cmake/BundledOpen62541.cmake b/cmake/BundledOpen62541.cmake index 9a48490aa..0565a7a9d 100644 --- a/cmake/BundledOpen62541.cmake +++ b/cmake/BundledOpen62541.cmake @@ -36,7 +36,8 @@ function(use_bundled_open62541 SOURCE_DIR BINARY_DIR) "-DCMAKE_INSTALL_PREFIX=${OPEN62541_BYPRODUCT_DIR}" -DOPEN62541_VERSION=v1.3.3 -DUA_ENABLE_ENCRYPTION=ON - -DUA_FORCE_WERROR=OFF) + -DUA_FORCE_WERROR=OFF + -DUA_ENABLE_DEBUG_SANITIZER=OFF) append_third_party_passthrough_args(OPEN62541_CMAKE_ARGS "${OPEN62541_CMAKE_ARGS}") diff --git a/cmake/BundledOpenCV.cmake b/cmake/BundledOpenCV.cmake index c53294e51..95384208b 100644 --- a/cmake/BundledOpenCV.cmake +++ b/cmake/BundledOpenCV.cmake @@ -102,12 +102,18 @@ function(use_bundled_opencv SOURCE_DIR BINARY_DIR) append_third_party_passthrough_args(OPENCV_CMAKE_ARGS "${OPENCV_CMAKE_ARGS}") + set(PATCH_FILE_1 "${SOURCE_DIR}/thirdparty/opencv/c++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}\")") + + # Build project ExternalProject_Add( opencv-external URL "https://github.com/opencv/opencv/archive/refs/tags/4.7.0.tar.gz" URL_HASH "SHA256=8df0079cdbe179748a18d44731af62a245a45ebf5085223dc03133954c662973" SOURCE_DIR "${BINARY_DIR}/thirdparty/opencv-src" + PATCH_COMMAND ${PC} CMAKE_ARGS ${OPENCV_CMAKE_ARGS} BUILD_BYPRODUCTS "${BYPRODUCTS}" EXCLUDE_FROM_ALL TRUE diff --git a/cmake/BundledRocksDB.cmake b/cmake/BundledRocksDB.cmake index 85a28304a..9d1f4644c 100644 --- a/cmake/BundledRocksDB.cmake +++ b/cmake/BundledRocksDB.cmake @@ -23,16 +23,15 @@ function(use_bundled_rocksdb SOURCE_DIR BINARY_DIR) include(LZ4) endif() - # Patch to fix build issue on ARM7 architecture: https://github.com/facebook/rocksdb/issues/8609#issuecomment-1009572506 - set(PATCH_FILE_1 "${SOURCE_DIR}/thirdparty/rocksdb/all/patches/arm7.patch") - set(PATCH_FILE_2 "${SOURCE_DIR}/thirdparty/rocksdb/all/patches/dboptions_equality_operator.patch") - set(PATCH_FILE_3 "${SOURCE_DIR}/thirdparty/rocksdb/all/patches/cstdint.patch") + set(PATCH_FILE_1 "${SOURCE_DIR}/thirdparty/rocksdb/all/patches/dboptions_equality_operator.patch") + set(PATCH_FILE_2 "${SOURCE_DIR}/thirdparty/rocksdb/all/patches/c++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_2}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE_2}\") &&\ - (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE_3}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE_3}\") ") + (\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE_2}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE_2}\") ") + - # Define byproducts +# Define byproducts if (WIN32) set(BYPRODUCT "lib/rocksdb.lib") else() @@ -72,8 +71,8 @@ function(use_bundled_rocksdb SOURCE_DIR BINARY_DIR) # Build project ExternalProject_Add( rocksdb-external - URL "https://github.com/facebook/rocksdb/archive/refs/tags/v8.10.2.tar.gz" - URL_HASH "SHA256=44b6ec2f4723a0d495762da245d4a59d38704e0d9d3d31c45af4014bee853256" + URL "https://github.com/facebook/rocksdb/archive/refs/tags/v10.2.1.tar.gz" + URL_HASH "SHA256=d1ddfd3551e649f7e2d180d5a6a006d90cfde56dcfe1e548c58d95b7f1c87049" SOURCE_DIR "${BINARY_DIR}/thirdparty/rocksdb-src" CMAKE_ARGS ${ROCKSDB_CMAKE_ARGS} PATCH_COMMAND ${PC} diff --git a/cmake/Bustache.cmake b/cmake/Bustache.cmake index e3d104cda..a881a90be 100644 --- a/cmake/Bustache.cmake +++ b/cmake/Bustache.cmake @@ -22,14 +22,17 @@ get_fmt() set(BUSTACHE_USE_FMT ON CACHE STRING "" FORCE) -set(PATCH_FILE "${CMAKE_SOURCE_DIR}/thirdparty/bustache/add-append.patch") +set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/bustache/add-append.patch") +set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/bustache/fix-deprecated-literal-operator.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(Bustache GIT_REPOSITORY https://github.com/jamboree/bustache.git GIT_TAG 47096caa8e1f9f7ebe34e3a022dbb822c174011d PATCH_COMMAND "${PC}" + SYSTEM ) FetchContent_MakeAvailable(Bustache) diff --git a/cmake/Catch2.cmake b/cmake/Catch2.cmake index d4c257af2..2986f0487 100644 --- a/cmake/Catch2.cmake +++ b/cmake/Catch2.cmake @@ -20,7 +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/CivetWeb.cmake b/cmake/CivetWeb.cmake index d2622de1c..308839201 100644 --- a/cmake/CivetWeb.cmake +++ b/cmake/CivetWeb.cmake @@ -35,6 +35,7 @@ FetchContent_Declare(civetweb URL https://github.com/civetweb/civetweb/archive/refs/tags/v1.16.tar.gz URL_HASH SHA256=f0e471c1bf4e7804a6cfb41ea9d13e7d623b2bcc7bc1e2a4dd54951a24d60285 PATCH_COMMAND "${PC}" + SYSTEM ) FetchContent_MakeAvailable(civetweb) diff --git a/cmake/Couchbase.cmake b/cmake/Couchbase.cmake index 74a7e1326..68bab1c6a 100644 --- a/cmake/Couchbase.cmake +++ b/cmake/Couchbase.cmake @@ -32,15 +32,18 @@ set(COUCHBASE_CXX_CLIENT_INSTALL OFF CACHE BOOL "" FORCE) set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/remove-thirdparty.patch") set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/remove-debug-symbols.patch") +set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/c++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_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\")") + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\") &&\ + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_3}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_3}\\\")") FetchContent_Declare(couchbase-cxx-client - URL https://github.com/couchbase/couchbase-cxx-client/releases/download/1.0.2/couchbase-cxx-client-1.0.2.tar.gz - URL_HASH SHA256=1954e6f5e063d94675428182bc8b1b82fd8e8532c10d1787f157aeb18bb37769 + URL https://github.com/couchbase/couchbase-cxx-client/releases/download/1.1.0/couchbase-cxx-client-1.1.0.tar.gz + URL_HASH SHA256=bd3a7f1492e242b239acd965eed4472cecb0319d40d05480f97cdec705960ba0 PATCH_COMMAND "${PC}" + SYSTEM ) FetchContent_MakeAvailable(couchbase-cxx-client) diff --git a/cmake/Couchbase.cmake b/cmake/Couchbase_1_0_2.cmake similarity index 97% copy from cmake/Couchbase.cmake copy to cmake/Couchbase_1_0_2.cmake index 74a7e1326..655abcd88 100644 --- a/cmake/Couchbase.cmake +++ b/cmake/Couchbase_1_0_2.cmake @@ -17,7 +17,7 @@ include(FetchContent) -include(fmt) +include(fmt_11_0_2) include(Spdlog) include(Asio) @@ -30,7 +30,7 @@ set(COUCHBASE_CXX_CLIENT_BUILD_TOOLS OFF CACHE BOOL "" FORCE) set(COUCHBASE_CXX_CLIENT_POST_LINKED_OPENSSL ON CACHE BOOL "" FORCE) set(COUCHBASE_CXX_CLIENT_INSTALL OFF CACHE BOOL "" FORCE) -set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/remove-thirdparty.patch") +set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/remove-thirdparty-1.0.2.patch") set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/couchbase/remove-debug-symbols.patch") set(PC ${Bash_EXECUTABLE} -c "set -x &&\ diff --git a/cmake/CppVersion.cmake b/cmake/CppVersion.cmake index c356e6b40..8b6edee60 100644 --- a/cmake/CppVersion.cmake +++ b/cmake/CppVersion.cmake @@ -23,19 +23,20 @@ function(set_cpp_version) else() message(STATUS "The Visual Studio C++ compiler ${CMAKE_CXX_COMPILER} is not supported. Please use Visual Studio 2022 or newer.") endif() - set(CMAKE_CXX_STANDARD 20 PARENT_SCOPE) + set(CMAKE_CXX_STANDARD 23 PARENT_SCOPE) else() include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG("-std=c++20" COMPILER_SUPPORTS_CXX20) - CHECK_CXX_COMPILER_FLAG("-std=c++2a" COMPILER_SUPPORTS_CXX2A) - if(COMPILER_SUPPORTS_CXX20) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20" PARENT_SCOPE) - elseif(COMPILER_SUPPORTS_CXX2A) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++2a" PARENT_SCOPE) + CHECK_CXX_COMPILER_FLAG("-std=c++23" COMPILER_SUPPORTS_CXX23) + CHECK_CXX_COMPILER_FLAG("-std=c++2b" COMPILER_SUPPORTS_CXX2B) + if(COMPILER_SUPPORTS_CXX23) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++23" PARENT_SCOPE) + set(CMAKE_CXX_STANDARD 23 PARENT_SCOPE) + elseif(COMPILER_SUPPORTS_CXX2B) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++2b" PARENT_SCOPE) + set(CMAKE_CXX_STANDARD 23 PARENT_SCOPE) else() - message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no support for -std=c++20 or -std=c++2a. Please use a more recent C++ compiler version.") + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no support for -std=c++23 or -std=c++2b. Please use a more recent C++ compiler version.") endif() - set(CMAKE_CXX_STANDARD 20 PARENT_SCOPE) endif() set(CMAKE_CXX_STANDARD_REQUIRED ON PARENT_SCOPE) diff --git a/cmake/Crc32c.cmake b/cmake/Crc32c.cmake index 8603e8960..3b4f3edb1 100644 --- a/cmake/Crc32c.cmake +++ b/cmake/Crc32c.cmake @@ -25,6 +25,7 @@ FetchContent_Declare( crc32c URL https://github.com/google/crc32c/archive/refs/tags/1.1.2.tar.gz URL_HASH SHA256=ac07840513072b7fcebda6e821068aa04889018f24e10e46181068fb214d7e56 + SYSTEM ) FetchContent_MakeAvailable(crc32c) add_library(Crc32c::crc32c ALIAS crc32c) diff --git a/cmake/Date.cmake b/cmake/Date.cmake index b5df69efc..a3d690e9c 100644 --- a/cmake/Date.cmake +++ b/cmake/Date.cmake @@ -22,6 +22,7 @@ if (WIN32) FetchContent_Declare(tzdata URL https://data.iana.org/time-zones/releases/tzdata2020e.tar.gz URL_HASH SHA256=0be1ba329eae29ae1b54057c3547b3e672f73b3ae7643aa87dac85122bec037e + SYSTEM ) FetchContent_GetProperties(tzdata) if (NOT tzdata_POPULATED) @@ -48,6 +49,7 @@ endif() FetchContent_Declare(date_src URL https://github.com/HowardHinnant/date/archive/1ead6715dec030d340a316c927c877a3c4e5a00c.tar.gz # master as of 2024-06-28 URL_HASH SHA256=8b4096b7b49e06d756f4aa0949151863ab7b812679a1646039fab6e821d3c049 + SYSTEM ) FetchContent_GetProperties(date_src) if (NOT date_src_POPULATED) diff --git a/cmake/ExpectedLite.cmake b/cmake/ExpectedLite.cmake index f74dcfa35..4ee997a97 100644 --- a/cmake/ExpectedLite.cmake +++ b/cmake/ExpectedLite.cmake @@ -18,7 +18,11 @@ 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 ) + +# Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119714 FetchContent_MakeAvailable(expected-lite) +target_compile_definitions(expected-lite INTERFACE nsel_CONFIG_SELECT_EXPECTED=nsel_EXPECTED_NONSTD) diff --git a/cmake/FetchBenchmark.cmake b/cmake/FetchBenchmark.cmake index e65839d56..7043ae201 100644 --- a/cmake/FetchBenchmark.cmake +++ b/cmake/FetchBenchmark.cmake @@ -25,5 +25,6 @@ FetchContent_Declare( URL https://github.com/google/benchmark/archive/refs/tags/v1.9.1.tar.gz URL_HASH SHA256=32131c08ee31eeff2c8968d7e874f3cb648034377dfc32a4c377fa8796d84981 OVERRIDE_FIND_PACKAGE + SYSTEM ) FetchContent_MakeAvailable(benchmark) diff --git a/cmake/FetchUvc.cmake b/cmake/FetchUvc.cmake index 7d2000ae3..507153116 100644 --- a/cmake/FetchUvc.cmake +++ b/cmake/FetchUvc.cmake @@ -21,5 +21,6 @@ FetchContent_Declare(Uvc URL https://github.com/libuvc/libuvc/archive/refs/tags/v0.0.7.tar.gz URL_HASH SHA256=7c6ba79723ad5d0ccdfbe6cadcfbd03f9f75b701d7ba96631eb1fd929a86ee72 OVERRIDE_FIND_PACKAGE + SYSTEM ) FetchContent_MakeAvailable(Uvc) diff --git a/cmake/Fetchlibrdkafka.cmake b/cmake/Fetchlibrdkafka.cmake index 0b629d447..75d713fc7 100644 --- a/cmake/Fetchlibrdkafka.cmake +++ b/cmake/Fetchlibrdkafka.cmake @@ -40,6 +40,7 @@ FetchContent_Declare(libkafka URL https://github.com/confluentinc/librdkafka/archive/refs/tags/v2.8.0.tar.gz URL_HASH SHA256=5bd1c46f63265f31c6bfcedcde78703f77d28238eadf23821c2b43fc30be3e25 PATCH_COMMAND "${PC}" + SYSTEM ) FetchContent_MakeAvailable(libkafka) diff --git a/cmake/ExpectedLite.cmake b/cmake/GetFmt_11_0_2.cmake similarity index 70% copy from cmake/ExpectedLite.cmake copy to cmake/GetFmt_11_0_2.cmake index f74dcfa35..c788dd8ae 100644 --- a/cmake/ExpectedLite.cmake +++ b/cmake/GetFmt_11_0_2.cmake @@ -15,10 +15,12 @@ # specific language governing permissions and limitations # under the License. -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 -) -FetchContent_MakeAvailable(expected-lite) +function(get_fmt_11_0_2) + if(MINIFI_FMT_SOURCE STREQUAL "CONAN") + message("Using Conan to install Fmt") + find_package(fmt REQUIRED) + elseif(MINIFI_FMT_SOURCE STREQUAL "BUILD") + message("Using CMake to build Fmt from source (version 11.0.2)") + include(fmt_11_0_2) + endif() +endfunction(get_fmt_11_0_2) diff --git a/cmake/GetSpdlog.cmake b/cmake/GetSpdlog.cmake index 747894984..9fe3b9c46 100644 --- a/cmake/GetSpdlog.cmake +++ b/cmake/GetSpdlog.cmake @@ -16,8 +16,13 @@ # under the License. function(get_spdlog) - include(GetFmt) - get_fmt() + if (WIN32) + include(GetFmt_11_0_2) + get_fmt_11_0_2() + else() + include(GetFmt) + get_fmt() + endif() if(MINIFI_SPDLOG_SOURCE STREQUAL "CONAN") message("Using Conan to install spdlog") diff --git a/cmake/GoogleCloudCpp.cmake b/cmake/GoogleCloudCpp.cmake index c02804455..071f83d5f 100644 --- a/cmake/GoogleCloudCpp.cmake +++ b/cmake/GoogleCloudCpp.cmake @@ -22,9 +22,11 @@ include(Crc32c) set(PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/remove-find_package.patch") set(PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/nlohmann_lib_as_interface.patch") +set(PATCH_FILE_3 "${CMAKE_SOURCE_DIR}/thirdparty/google-cloud-cpp/c++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_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\")") + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_2}\\\") &&\ + (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE_3}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE_3}\\\")") set(GOOGLE_CLOUD_CPP_WITH_MOCKS OFF CACHE BOOL "" FORCE) if (NOT SKIP_TESTS) @@ -34,6 +36,7 @@ if (NOT SKIP_TESTS) googletest URL https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz URL_HASH SHA256=65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c + SYSTEM ) set(BUILD_GMOCK ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) @@ -48,6 +51,9 @@ set(GOOGLE_CLOUD_CPP_ENABLE_WERROR OFF CACHE INTERNAL warnings-off) FetchContent_Declare(google-cloud-cpp URL https://github.com/googleapis/google-cloud-cpp/archive/refs/tags/v2.38.0.tar.gz URL_HASH SHA256=f1493b2dce9b379714342f2be7ccb483d70d13aac09d4a90ae3b4756693b72fc - PATCH_COMMAND "${PC}") -add_compile_definitions(_SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING CURL_STATICLIB) + PATCH_COMMAND "${PC}" + SYSTEM) +if (WIN32) + add_compile_definitions(_SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING CURL_STATICLIB) +endif() FetchContent_MakeAvailable(google-cloud-cpp) diff --git a/cmake/Grpc.cmake b/cmake/Grpc.cmake index ae578c8ee..854780586 100644 --- a/cmake/Grpc.cmake +++ b/cmake/Grpc.cmake @@ -41,6 +41,7 @@ FetchContent_Declare( GIT_TAG v1.68.0 GIT_SUBMODULES "third_party/cares/cares third_party/protobuf third_party/re2 third_party/upb" PATCH_COMMAND "${PC}" + SYSTEM ) set(FETCHCONTENT_QUIET OFF) FetchContent_MakeAvailable(grpc) diff --git a/cmake/GslLite.cmake b/cmake/GslLite.cmake index 4262f9cbe..14a114685 100644 --- a/cmake/GslLite.cmake +++ b/cmake/GslLite.cmake @@ -20,5 +20,6 @@ include(FetchContent) FetchContent_Declare(gsl-lite URL https://github.com/gsl-lite/gsl-lite/archive/refs/tags/v0.39.0.tar.gz URL_HASH SHA256=f80ec07d9f4946097a1e2554e19cee4b55b70b45d59e03a7d2b7f80d71e467e9 + SYSTEM ) FetchContent_MakeAvailable(gsl-lite) diff --git a/cmake/JoltTests.cmake b/cmake/JoltTests.cmake index 56601fab6..17c3b5c87 100644 --- a/cmake/JoltTests.cmake +++ b/cmake/JoltTests.cmake @@ -20,6 +20,7 @@ include(FetchContent) FetchContent_Declare(jolt_tests URL https://github.com/bazaarvoice/jolt/archive/refs/tags/jolt-0.1.8.tar.gz URL_HASH SHA256=7423c5b98244260f89a975f5e21150c02a6a1fa88e3af07c90d43fef0eebdcbb + SYSTEM ) FetchContent_MakeAvailable(jolt_tests) diff --git a/cmake/JsonSchemaValidator.cmake b/cmake/JsonSchemaValidator.cmake index 372798d8d..cb9886690 100644 --- a/cmake/JsonSchemaValidator.cmake +++ b/cmake/JsonSchemaValidator.cmake @@ -19,7 +19,8 @@ include(FetchContent) FetchContent_Declare(json-schema-validator URL https://github.com/pboettch/json-schema-validator/archive/2.2.0.tar.gz - URL_HASH SHA256=03897867bd757ecac1db7545babf0c6c128859655b496582a9cea4809c2260aa) + URL_HASH SHA256=03897867bd757ecac1db7545babf0c6c128859655b496582a9cea4809c2260aa + SYSTEM) FetchContent_MakeAvailable(json-schema-validator) diff --git a/cmake/KubernetesClientC.cmake b/cmake/KubernetesClientC.cmake index 84671dced..912983af9 100644 --- a/cmake/KubernetesClientC.cmake +++ b/cmake/KubernetesClientC.cmake @@ -22,6 +22,7 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) FetchContent_Declare(yaml GIT_REPOSITORY https://github.com/yaml/libyaml.git GIT_TAG 2c891fc7a770e8ba2fec34fc6b545c672beb37e6 # 0.2.5 + SYSTEM ) set(LWS_WITHOUT_TESTAPPS ON CACHE BOOL "" FORCE) @@ -44,6 +45,7 @@ FetchContent_Declare(websockets URL https://github.com/warmcat/libwebsockets/archive/refs/tags/v4.3.2.tar.gz URL_HASH SHA256=6a85a1bccf25acc7e8e5383e4934c9b32a102880d1e4c37c70b27ae2a42406e1 PATCH_COMMAND "${WEBSOCKETS_PC}" + SYSTEM ) FetchContent_MakeAvailable(yaml websockets) @@ -57,6 +59,7 @@ FetchContent_Declare(kubernetes URL_HASH SHA256=dbb6e6cd29ae2ac6c15de894aefb9b1e3d48916541d443f089aa0ffad6517ec6 PATCH_COMMAND "${K8S_PC}" SOURCE_SUBDIR kubernetes + SYSTEM ) FetchContent_MakeAvailable(kubernetes) diff --git a/cmake/LZ4.cmake b/cmake/LZ4.cmake index f008d9933..6712614c9 100644 --- a/cmake/LZ4.cmake +++ b/cmake/LZ4.cmake @@ -29,6 +29,7 @@ FetchContent_Declare(lz4 URL_HASH SHA256=0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b SOURCE_SUBDIR build/cmake OVERRIDE_FIND_PACKAGE + SYSTEM ) FetchContent_MakeAvailable(lz4) diff --git a/cmake/LibLZMA.cmake b/cmake/LibLZMA.cmake index 67ca7c9d7..f90621cf9 100644 --- a/cmake/LibLZMA.cmake +++ b/cmake/LibLZMA.cmake @@ -26,7 +26,8 @@ set(PC ${Bash_EXECUTABLE} -c "set -x &&\ FetchContent_Declare(liblzma URL https://github.com/tukaani-project/xz/releases/download/v5.6.2/xz-5.6.2.tar.gz URL_HASH SHA256=8bfd20c0e1d86f0402f2497cfa71c6ab62d4cd35fd704276e3140bfb71414519 - PATCH_COMMAND "${PC}") + PATCH_COMMAND "${PC}" + SYSTEM) FetchContent_MakeAvailable(liblzma) diff --git a/cmake/LlamaCpp.cmake b/cmake/LlamaCpp.cmake index af4e94994..f78101c6f 100644 --- a/cmake/LlamaCpp.cmake +++ b/cmake/LlamaCpp.cmake @@ -31,13 +31,17 @@ 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/b5038.tar.gz - URL_HASH SHA256=5e81c3badc181ed3b7a6ab6bda2abedc80c52527e3c079c7afff4c09f4843564 + URL https://github.com/ggml-org/llama.cpp/archive/refs/tags/b5958.tar.gz + URL_HASH SHA256=4e8a2abd83092aa446cd13556f6fe8777139da7b191bdaa0e1b79fe9740b36a6 PATCH_COMMAND "${PC}" + SYSTEM ) FetchContent_MakeAvailable(llamacpp) diff --git a/cmake/Lua.cmake b/cmake/Lua.cmake index 35a1ab162..6dc22c02b 100644 --- a/cmake/Lua.cmake +++ b/cmake/Lua.cmake @@ -20,6 +20,7 @@ include(FetchContent) FetchContent_Declare(lua URL "https://github.com/lua/lua/archive/refs/tags/v5.4.6.tar.gz" URL_HASH "SHA256=11c228cf9b9564d880b394f8069ad829d01e39756567f79c347a6b89fed44771" + SYSTEM ) FetchContent_GetProperties(lua) diff --git a/cmake/MagicEnum.cmake b/cmake/MagicEnum.cmake index 266d3b849..9bd6efad8 100644 --- a/cmake/MagicEnum.cmake +++ b/cmake/MagicEnum.cmake @@ -19,6 +19,7 @@ include(FetchContent) FetchContent_Declare(magic_enum URL https://github.com/Neargye/magic_enum/archive/refs/tags/v0.9.3.tar.gz - URL_HASH SHA256=3cadd6a05f1bffc5141e5e731c46b2b73c2dbff025e723c8abaa659e0a24f072) + URL_HASH SHA256=3cadd6a05f1bffc5141e5e731c46b2b73c2dbff025e723c8abaa659e0a24f072 + SYSTEM) FetchContent_MakeAvailable(magic_enum) diff --git a/cmake/MiMalloc.cmake b/cmake/MiMalloc.cmake index ec12daa0d..45a5a0015 100644 --- a/cmake/MiMalloc.cmake +++ b/cmake/MiMalloc.cmake @@ -21,5 +21,6 @@ FetchContent_Declare( mimalloc URL https://github.com/microsoft/mimalloc/archive/refs/tags/v2.0.6.tar.gz URL_HASH SHA256=9f05c94cc2b017ed13698834ac2a3567b6339a8bde27640df5a1581d49d05ce5 + SYSTEM ) FetchContent_MakeAvailable(mimalloc) diff --git a/cmake/PahoMqttC.cmake b/cmake/PahoMqttC.cmake index 0209edf94..322239025 100644 --- a/cmake/PahoMqttC.cmake +++ b/cmake/PahoMqttC.cmake @@ -23,15 +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}" + 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/cmake/Prometheus.cmake b/cmake/Prometheus.cmake index ef3e33231..0138d21d2 100644 --- a/cmake/Prometheus.cmake +++ b/cmake/Prometheus.cmake @@ -31,6 +31,7 @@ FetchContent_Declare( URL "https://github.com/jupp0r/prometheus-cpp/archive/refs/tags/v1.3.0.tar.gz" URL_HASH "SHA256=ac6e958405a29fbbea9db70b00fa3c420e16ad32e1baf941ab233ba031dd72ee" PATCH_COMMAND "${PC}" + SYSTEM ) FetchContent_MakeAvailable(prometheus-cpp) diff --git a/cmake/RangeV3.cmake b/cmake/RangeV3.cmake index ff26be3a1..4cfb23054 100644 --- a/cmake/RangeV3.cmake +++ b/cmake/RangeV3.cmake @@ -17,8 +17,15 @@ include(FetchContent) +set(PATCH_FILE "${CMAKE_SOURCE_DIR}/thirdparty/ranges-v3/remove-deprecated.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}\\\")") + FetchContent_Declare(range-v3_src URL https://github.com/ericniebler/range-v3/archive/refs/tags/0.12.0.tar.gz URL_HASH SHA256=015adb2300a98edfceaf0725beec3337f542af4915cec4d0b89fa0886f4ba9cb + PATCH_COMMAND "${PC}" + SYSTEM ) FetchContent_MakeAvailable(range-v3_src) +target_compile_definitions(range-v3 INTERFACE RANGES_CXX_THREAD_LOCAL=201103L) diff --git a/cmake/RpMalloc.cmake b/cmake/RpMalloc.cmake index 17ab3166e..a97a9135c 100644 --- a/cmake/RpMalloc.cmake +++ b/cmake/RpMalloc.cmake @@ -21,6 +21,7 @@ FetchContent_Declare( rpmalloc URL https://github.com/mjansson/rpmalloc/archive/refs/tags/1.4.4.tar.gz URL_HASH SHA256=3859620c03e6473f0b3f16a4e965e7c049594253f70e8370fb9caa0e4118accb + SYSTEM ) FetchContent_GetProperties(rpmalloc) diff --git a/cmake/Sol2.cmake b/cmake/Sol2.cmake index e5989a3ac..3dbe63cb1 100644 --- a/cmake/Sol2.cmake +++ b/cmake/Sol2.cmake @@ -15,33 +15,11 @@ # specific language governing permissions and limitations # under the License. -# Using file(DOWNLOAD) instead of FetchContent due to this issue in cmake versions older than 3.18 https://gitlab.kitware.com/cmake/cmake/-/issues/20526 +include(FetchContent) -set(SOL2_INCLUDE_DIR "${CMAKE_BINARY_DIR}/_deps/sol2/" CACHE STRING "" FORCE) -if(NOT EXISTS "${SOL2_INCLUDE_DIR}/sol.hpp") - file(DOWNLOAD "https://github.com/ThePhD/sol2/releases/download/v3.3.0/sol.hpp" "${SOL2_INCLUDE_DIR}/sol/sol.hpp" - EXPECTED_HASH SHA256=e095a961a5189863745e6c101124fce944af991f3d4726a1e82c5b4a885a187f) - configure_file("${SOL2_INCLUDE_DIR}/sol/sol.hpp" "${SOL2_INCLUDE_DIR}/sol/sol.hpp" NEWLINE_STYLE LF) - - file(DOWNLOAD "https://github.com/ThePhD/sol2/releases/download/v3.3.0/config.hpp" "${SOL2_INCLUDE_DIR}/sol/config.hpp" - EXPECTED_HASH SHA256=6c283673a16f0eeb3c56f8b8d72ccf7ed3f048816dbd2584ac58564c61315f02) - configure_file("${SOL2_INCLUDE_DIR}/sol/config.hpp" "${SOL2_INCLUDE_DIR}/sol/config.hpp" NEWLINE_STYLE LF) - - file(DOWNLOAD "https://github.com/ThePhD/sol2/releases/download/v3.3.0/forward.hpp" "${SOL2_INCLUDE_DIR}/sol/forward.hpp" - EXPECTED_HASH SHA256=8fc34d74e9b4b8baa381f5e6ab7b6f6b44114cd355c718505495943ff6b85740) - configure_file("${SOL2_INCLUDE_DIR}/sol/forward.hpp" "${SOL2_INCLUDE_DIR}/sol/forward.hpp" NEWLINE_STYLE LF) - - # Some platform simply define LUA_COMPAT_BITLIB or LUA_COMPAT_5_2 without setting them to explicitly 1 - set(PC "${Patch_EXECUTABLE}" -p1 -i "${CMAKE_SOURCE_DIR}/thirdparty/sol2/fix_bitlib_compatibility.patch" "${SOL2_INCLUDE_DIR}/sol/sol.hpp") - - execute_process(COMMAND ${PC} RESULT_VARIABLE patch_result_code) - if(NOT patch_result_code EQUAL "0") - message(FATAL_ERROR "Failed to patch sol.hpp") - endif() - - add_library(sol2 INTERFACE IMPORTED) - target_sources(sol2 INTERFACE ${SOL2_INCLUDE_DIR}/sol/sol.hpp) - target_sources(sol2 INTERFACE ${SOL2_INCLUDE_DIR}/sol/config.hpp) - target_sources(sol2 INTERFACE ${SOL2_INCLUDE_DIR}/sol/forward.hpp) - target_include_directories(sol2 SYSTEM INTERFACE ${SOL2_INCLUDE_DIR}) -endif() +FetchContent_Declare(sol2_src + URL https://github.com/ThePhD/sol2/archive/refs/tags/v3.5.0.tar.gz + URL_HASH SHA256=86c0f6d2836b184a250fc2907091c076bf53c9603dd291eaebade36cc342e13c + SYSTEM +) +FetchContent_MakeAvailable(sol2_src) diff --git a/cmake/Spdlog.cmake b/cmake/Spdlog.cmake index cbdaa21e5..6fa371674 100644 --- a/cmake/Spdlog.cmake +++ b/cmake/Spdlog.cmake @@ -19,9 +19,12 @@ include(FetchContent) set(SPDLOG_FMT_EXTERNAL ON CACHE STRING "" FORCE) +set(SPDLOG_SYSTEM_INCLUDES ON CACHE STRING "" FORCE) + FetchContent_Declare(Spdlog - URL https://github.com/gabime/spdlog/archive/refs/tags/v1.15.1.tar.gz - URL_HASH SHA256=25c843860f039a1600f232c6eb9e01e6627f7d030a2ae5e232bdd3c9205d26cc + URL https://github.com/gabime/spdlog/archive/refs/tags/v1.15.3.tar.gz + URL_HASH SHA256=15a04e69c222eb6c01094b5c7ff8a249b36bb22788d72519646fb85feb267e67 OVERRIDE_FIND_PACKAGE + SYSTEM ) FetchContent_MakeAvailable(Spdlog) diff --git a/cmake/Zstd.cmake b/cmake/Zstd.cmake index 15f87ad6d..1ba57c8ae 100644 --- a/cmake/Zstd.cmake +++ b/cmake/Zstd.cmake @@ -32,6 +32,7 @@ FetchContent_Declare(zstd URL_HASH SHA256=f7de13462f7a82c29ab865820149e778cbfe01087b3a55b5332707abf9db4a6e PATCH_COMMAND "${PC}" SOURCE_SUBDIR build/cmake + SYSTEM ) FetchContent_MakeAvailable(zstd) diff --git a/cmake/fmt.cmake b/cmake/fmt.cmake index 1d39f7689..0777eaa5d 100644 --- a/cmake/fmt.cmake +++ b/cmake/fmt.cmake @@ -19,8 +19,9 @@ include(FetchContent) FetchContent_Declare(Fmt - URL https://github.com/fmtlib/fmt/archive/refs/tags/11.0.2.tar.gz - URL_HASH SHA256=6cb1e6d37bdcb756dbbe59be438790db409cdb4868c66e888d5df9f13f7c027f + URL https://github.com/fmtlib/fmt/archive/refs/tags/11.2.0.tar.gz + URL_HASH SHA256=bc23066d87ab3168f27cef3e97d545fa63314f5c79df5ea444d41d56f962c6af OVERRIDE_FIND_PACKAGE + SYSTEM ) FetchContent_MakeAvailable(Fmt) diff --git a/cmake/fmt.cmake b/cmake/fmt_11_0_2.cmake similarity index 98% copy from cmake/fmt.cmake copy to cmake/fmt_11_0_2.cmake index 1d39f7689..dfe9dcea1 100644 --- a/cmake/fmt.cmake +++ b/cmake/fmt_11_0_2.cmake @@ -22,5 +22,6 @@ FetchContent_Declare(Fmt URL https://github.com/fmtlib/fmt/archive/refs/tags/11.0.2.tar.gz URL_HASH SHA256=6cb1e6d37bdcb756dbbe59be438790db409cdb4868c66e888d5df9f13f7c027f OVERRIDE_FIND_PACKAGE + SYSTEM ) FetchContent_MakeAvailable(Fmt) diff --git a/core-framework/include/utils/expected.h b/core-framework/include/utils/expected.h index aff2c0a05..fb0f3457e 100644 --- a/core-framework/include/utils/expected.h +++ b/core-framework/include/utils/expected.h @@ -239,26 +239,28 @@ auto try_expression(F&& action, Args&&... args) noexcept { } // namespace org::apache::nifi::minifi::utils -#ifndef WIN32 // on windows this conflicts because nonstd::expected === std::expected +template <typename T, typename E> +concept HasStdExpected = requires { typename std::expected<T, E>; }; + +template <typename T, typename E> +concept ExpectedTypesDoNotConflict = + (!HasStdExpected<T, E> || + !std::same_as<nonstd::expected<T, E>, std::expected<T, E>>); + // based on fmt::formatter<std::expected<T, E>, Char> template <typename T, typename E, typename Char> -struct fmt::formatter<nonstd::expected<T, E>, Char, - std::enable_if_t<(std::is_void<T>::value || - fmt::is_formattable<T, Char>::value) && - fmt::is_formattable<E, Char>::value>> { - template <typename ParseContext> - constexpr auto parse(ParseContext& ctx) -> const Char* { - return ctx.begin(); - } +requires ExpectedTypesDoNotConflict<T, E> && + (std::is_void_v<T> || fmt::is_formattable<T, Char>::value) && + fmt::is_formattable<E, Char>::value +struct fmt::formatter<nonstd::expected<T, E>, Char> { + constexpr auto parse(auto& ctx) { return ctx.begin(); } - template <typename FormatContext> - auto format(const nonstd::expected<T, E>& value, FormatContext& ctx) const - -> decltype(ctx.out()) { + auto format(const nonstd::expected<T, E>& value, auto& ctx) const { auto out = ctx.out(); if (value.has_value()) { out = fmt::detail::write<Char>(out, "nonstd::expected("); - if constexpr (!std::is_void<T>::value) + if constexpr (!std::is_void_v<T>) out = fmt::detail::write_escaped_alternative<Char>(out, *value); } else { out = fmt::detail::write<Char>(out, "nonstd::unexpected("); @@ -268,4 +270,3 @@ struct fmt::formatter<nonstd::expected<T, E>, Char, return out; } }; -#endif diff --git a/core-framework/include/utils/net/AsioCoro.h b/core-framework/include/utils/net/AsioCoro.h index 55a3a4cbc..b18087268 100644 --- a/core-framework/include/utils/net/AsioCoro.h +++ b/core-framework/include/utils/net/AsioCoro.h @@ -29,11 +29,11 @@ #include "asio/this_coro.hpp" #include "asio/use_awaitable.hpp" #include "asio/experimental/awaitable_operators.hpp" -#include "asio/experimental/as_tuple.hpp" +#include "asio/as_tuple.hpp" namespace org::apache::nifi::minifi::utils::net { -constexpr auto use_nothrow_awaitable = asio::experimental::as_tuple(asio::use_awaitable); +constexpr auto use_nothrow_awaitable = asio::as_tuple(asio::use_awaitable); #if defined(__GNUC__) && __GNUC__ < 11 // [coroutines] unexpected 'warning: statement has no effect [-Wunused-value]' diff --git a/core-framework/include/utils/net/AsioSocketUtils.h b/core-framework/include/utils/net/AsioSocketUtils.h index b052fc072..74b1c19eb 100644 --- a/core-framework/include/utils/net/AsioSocketUtils.h +++ b/core-framework/include/utils/net/AsioSocketUtils.h @@ -141,7 +141,7 @@ class AsioSocketConnection : public io::BaseStreamImpl { return; } - asio::ip::tcp::endpoint local_endpoint(asio::ip::address::from_string(address), 0); + asio::ip::tcp::endpoint local_endpoint(asio::ip::make_address(address), 0); asio::error_code err; socket.open(local_endpoint.protocol(), err); if (err) { diff --git a/core-framework/src/utils/net/DNS.cpp b/core-framework/src/utils/net/DNS.cpp index 7af353124..48d499f81 100644 --- a/core-framework/src/utils/net/DNS.cpp +++ b/core-framework/src/utils/net/DNS.cpp @@ -27,7 +27,7 @@ namespace org::apache::nifi::minifi::utils::net { nonstd::expected<asio::ip::address, std::error_code> addressFromString(const std::string_view ip_address_str) { std::error_code ip_address_from_string_error; - auto ip_address = asio::ip::address::from_string(ip_address_str.data(), ip_address_from_string_error); + auto ip_address = asio::ip::make_address(ip_address_str, ip_address_from_string_error); if (ip_address_from_string_error) return nonstd::make_unexpected(ip_address_from_string_error); return ip_address; @@ -55,7 +55,10 @@ nonstd::expected<std::string, std::error_code> reverseDnsLookup(const asio::ip:: if (resolve_error) return nonstd::make_unexpected(resolve_error); - return results->host_name(); + if (!results.empty()) { + return results.begin()->host_name(); + } + return nonstd::make_unexpected(std::make_error_code(std::errc::host_unreachable)); } std::string getMyHostName() { diff --git a/docker/centos/Dockerfile b/docker/centos/Dockerfile deleted file mode 100644 index e2eec731d..000000000 --- a/docker/centos/Dockerfile +++ /dev/null @@ -1,67 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# First stage: the build environment -ARG BASE_IMAGE="centos:7" - -FROM ${BASE_IMAGE} AS build -LABEL maintainer="Apache NiFi <[email protected]>" - -ARG MINIFI_VERSION -ARG UID=1000 -ARG GID=1000 - -# MINIFI_OPTIONS will be passed directly to cmake -# use it to define cmake options (e.g. -DENABLE_AWS=ON -DENABLE_AZURE=ON) -ARG MINIFI_OPTIONS="" -ARG CMAKE_BUILD_TYPE=Release -ARG DOCKER_SKIP_TESTS=ON -ARG DOCKER_MAKE_TARGET="all" - -# Install the system dependencies needed for a build - -ENV MINIFI_BASE_DIR /opt/minifi -ENV MINIFI_HOME $MINIFI_BASE_DIR/nifi-minifi-cpp-$MINIFI_VERSION -ENV USER minificpp - -RUN mkdir -p $MINIFI_BASE_DIR -COPY . ${MINIFI_BASE_DIR} - -# ccache is in EPEL -RUN ulimit -n 1024000 && yum -y install epel-release && yum -y install sudo git which make libarchive ccache ca-certificates perl-IPC-Cmd && \ - if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_PYTHON_SCRIPTING=ON"; then yum -y install python36-devel; fi && \ - if echo "$MINIFI_OPTIONS" | grep -q "ENABLE_SFTP=ON" && [ "${DOCKER_SKIP_TESTS}" == "OFF" ]; then yum -y install java-1.8.0-openjdk maven; fi - -RUN cd $MINIFI_BASE_DIR && \ - ./bootstrap.sh -t && \ - ln -s /usr/bin/ccache /usr/lib64/ccache/c++ - -# Setup minificpp user -RUN groupadd -g ${GID} ${USER} && useradd -g ${GID} ${USER} && \ - chown -R ${USER}:${USER} ${MINIFI_BASE_DIR} - -USER ${USER} - -# Perform the build -RUN cd $MINIFI_BASE_DIR && \ - cd build && \ - source /opt/rh/devtoolset-11/enable && \ - export PATH=/usr/lib64/ccache${PATH:+:${PATH}} && \ - export CCACHE_DIR=${MINIFI_BASE_DIR}/.ccache && \ - cmake -DSTATIC_BUILD= -DSKIP_TESTS=${DOCKER_SKIP_TESTS} ${MINIFI_OPTIONS} -DAWS_ENABLE_UNITY_BUILD=OFF -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" .. && \ - make -j "$(nproc)" ${DOCKER_MAKE_TARGET} diff --git a/docker/compiler-test/clang.Dockerfile b/docker/compiler-test/clang.Dockerfile new file mode 100644 index 000000000..784e4156f --- /dev/null +++ b/docker/compiler-test/clang.Dockerfile @@ -0,0 +1,22 @@ +ARG BASE_IMAGE + +FROM ${BASE_IMAGE} AS build +LABEL maintainer="Apache NiFi <[email protected]>" + +ENV MINIFI_BASE_DIR /opt/minifi +ENV DEBIAN_FRONTEND=noninteractive +ENV CC=clang +ENV CXX=clang++ +ENV CXXFLAGS="-stdlib=libc++" +ENV LDFLAGS="-stdlib=libc++" + +RUN mkdir -p $MINIFI_BASE_DIR +COPY . ${MINIFI_BASE_DIR} + + +RUN apt update && apt install -y sudo python3-venv + + +RUN cd $MINIFI_BASE_DIR/bootstrap && python3 -m venv venv && . venv/bin/activate \ + && pip install -r requirements.txt \ + && python main.py --noninteractive --skip-compiler-install --minifi-options="-DENABLE_ALL=ON -DMINIFI_FAIL_ON_WARNINGS=ON" diff --git a/docker/compiler-test/gcc.Dockerfile b/docker/compiler-test/gcc.Dockerfile new file mode 100644 index 000000000..643e4df99 --- /dev/null +++ b/docker/compiler-test/gcc.Dockerfile @@ -0,0 +1,18 @@ +ARG BASE_IMAGE + +FROM ${BASE_IMAGE} AS build +LABEL maintainer="Apache NiFi <[email protected]>" + +ENV MINIFI_BASE_DIR /opt/minifi +ENV DEBIAN_FRONTEND=noninteractive + +RUN mkdir -p $MINIFI_BASE_DIR +COPY . ${MINIFI_BASE_DIR} + + +RUN apt update && apt install -y sudo python3-venv + + +RUN cd $MINIFI_BASE_DIR/bootstrap && python3 -m venv venv && . venv/bin/activate \ + && pip install -r requirements.txt \ + && python main.py --noninteractive --skip-compiler-install --minifi-options="-DENABLE_ALL=ON -DMINIFI_FAIL_ON_WARNINGS=ON" diff --git a/extensions/couchbase/CMakeLists.txt b/extensions/couchbase/CMakeLists.txt index 0299ce8fd..92d4617e6 100644 --- a/extensions/couchbase/CMakeLists.txt +++ b/extensions/couchbase/CMakeLists.txt @@ -21,7 +21,12 @@ if (NOT (ENABLE_ALL OR ENABLE_COUCHBASE)) return() endif() -include(Couchbase) +if (WIN32) + include(Couchbase_1_0_2) +else() + include(Couchbase) +endif() + include(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) file(GLOB SOURCES "*.cpp" "controllerservices/*.cpp" "processors/*.cpp") diff --git a/extensions/expression-language/CMakeLists.txt b/extensions/expression-language/CMakeLists.txt index c179ab3ef..3183d97ca 100644 --- a/extensions/expression-language/CMakeLists.txt +++ b/extensions/expression-language/CMakeLists.txt @@ -32,6 +32,7 @@ if(WIN32) winflexbison URL "https://github.com/lexxmark/winflexbison/archive/refs/tags/v2.5.25.tar.gz" URL_HASH "SHA256=8e1b71e037b524ba3f576babb0cf59182061df1f19cd86112f085a882560f60b" + SYSTEM ) FetchContent_GetProperties("winflexbison") diff --git a/extensions/gcp/CMakeLists.txt b/extensions/gcp/CMakeLists.txt index 8dbe37e08..cf8dc9a47 100644 --- a/extensions/gcp/CMakeLists.txt +++ b/extensions/gcp/CMakeLists.txt @@ -27,6 +27,9 @@ file(GLOB SOURCES "*.cpp" "controllerservices/*.cpp" "processors/*.cpp") add_minifi_library(minifi-gcp SHARED ${SOURCES}) +if (NOT WIN32) + target_compile_options(minifi-gcp PRIVATE -Wno-error=deprecated-declarations) # Suppress deprecation warnings for std::rel_ops usage +endif() target_link_libraries(minifi-gcp ${LIBMINIFI} google-cloud-cpp::storage) target_include_directories(minifi-gcp SYSTEM PUBLIC ${google-cloud-cpp_INCLUDE_DIRS}) diff --git a/extensions/gcp/tests/CMakeLists.txt b/extensions/gcp/tests/CMakeLists.txt index ed119eb1d..398a66eac 100644 --- a/extensions/gcp/tests/CMakeLists.txt +++ b/extensions/gcp/tests/CMakeLists.txt @@ -20,7 +20,13 @@ file(GLOB GCS_TESTS "*.cpp") FOREACH(testfile ${GCS_TESTS}) get_filename_component(testfilename "${testfile}" NAME_WE) add_minifi_executable("${testfilename}" "${testfile}") - target_compile_definitions(${testfilename} PRIVATE _SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING) + + if (WIN32) + target_compile_definitions(${testfilename} PRIVATE _SILENCE_CXX20_REL_OPS_DEPRECATION_WARNING) + else() + target_compile_options(${testfilename} PRIVATE -Wno-error=deprecated-declarations) # Suppress deprecation warnings for std::rel_ops usage + endif() + target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/standard-processors") target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/expression-language") target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/gcp") 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/extensions/sql/processors/ExecuteSQL.cpp b/extensions/sql/processors/ExecuteSQL.cpp index f39151758..6327e33b4 100644 --- a/extensions/sql/processors/ExecuteSQL.cpp +++ b/extensions/sql/processors/ExecuteSQL.cpp @@ -52,7 +52,8 @@ void ExecuteSQL::processOnTrigger(core::ProcessContext& context, core::ProcessSe "No incoming FlowFile and the \"" + std::string{SQLSelectQuery.name} + "\" processor property is not specified"); // NOLINT(whitespace/braces) } logger_->log_debug("Using the contents of the flow file as the SQL statement"); - query = to_string(session.readBuffer(input_flow_file)); + std::string buffer_str = to_string(session.readBuffer(input_flow_file)); + query = buffer_str; } if (query->empty()) { logger_->log_error("Empty sql statement"); diff --git a/extensions/standard-processors/controllers/JsonRecordSetWriter.cpp b/extensions/standard-processors/controllers/JsonRecordSetWriter.cpp index 0f9e37de7..efc3f2326 100644 --- a/extensions/standard-processors/controllers/JsonRecordSetWriter.cpp +++ b/extensions/standard-processors/controllers/JsonRecordSetWriter.cpp @@ -61,7 +61,7 @@ template<> rapidjson::Value toJson(const core::RecordObject& field, rapidjson::Document::AllocatorType& alloc) { auto object_json = rapidjson::Value(rapidjson::kObjectType); for (const auto& [record_name, record_value] : field) { - auto json_value = (std::visit([&alloc](auto&& f)-> rapidjson::Value{ return toJson(f, alloc); }, record_value.field->value_)); + auto json_value = (std::visit([&alloc](auto&& f)-> rapidjson::Value{ return toJson(f, alloc); }, record_value.value_)); rapidjson::Value json_name(record_name.c_str(), gsl::narrow<rapidjson::SizeType>(record_name.length()), alloc); object_json.AddMember(json_name, json_value, alloc); } @@ -114,9 +114,13 @@ void JsonRecordSetWriter::writeAsArray(const core::RecordSet& record_set, const void JsonRecordSetWriter::write(const core::RecordSet& record_set, const std::shared_ptr<core::FlowFile>& flow_file, core::ProcessSession& session) { switch (output_grouping_) { case OutputGroupingType::ARRAY: - return writeAsArray(record_set, flow_file, session); + writeAsArray(record_set, flow_file, session); + break; case OutputGroupingType::ONE_LINE_PER_OBJECT: - return writePerLine(record_set, flow_file, session); + writePerLine(record_set, flow_file, session); + break; + default: + throw std::invalid_argument(fmt::format("Invalid OutputGroupingType: {}", magic_enum::enum_underlying(output_grouping_))); } } diff --git a/extensions/standard-processors/controllers/JsonTreeReader.cpp b/extensions/standard-processors/controllers/JsonTreeReader.cpp index 17b196811..1031a5a62 100644 --- a/extensions/standard-processors/controllers/JsonTreeReader.cpp +++ b/extensions/standard-processors/controllers/JsonTreeReader.cpp @@ -59,7 +59,7 @@ nonstd::expected<core::RecordField, std::error_code> parse(const rapidjson::Valu auto element_field = parse(m.value); if (!element_field) return nonstd::make_unexpected(element_field.error()); - record_object[element_key] = core::BoxedRecordField{std::make_unique<core::RecordField>(std::move(*element_field))}; + record_object.emplace(element_key, std::move(*element_field)); } return core::RecordField{std::move(record_object)}; } diff --git a/extensions/standard-processors/modbus/ByteConverters.h b/extensions/standard-processors/modbus/ByteConverters.h index cc5d38e17..19166c664 100644 --- a/extensions/standard-processors/modbus/ByteConverters.h +++ b/extensions/standard-processors/modbus/ByteConverters.h @@ -17,6 +17,7 @@ */ #pragma once +#include <algorithm> #include <array> #include <cstdint> #include <span> diff --git a/extensions/standard-processors/tests/unit/PutTCPTests.cpp b/extensions/standard-processors/tests/unit/PutTCPTests.cpp index 8f9dd7528..469a1a728 100644 --- a/extensions/standard-processors/tests/unit/PutTCPTests.cpp +++ b/extensions/standard-processors/tests/unit/PutTCPTests.cpp @@ -50,7 +50,7 @@ class CancellableTcpServer : public utils::net::TcpServer { void cancelEverything() { for (auto& timer : cancellable_timers_) - io_context_.post([=]{timer->cancel();}); + asio::post(io_context_, [=]{timer->cancel();}); } asio::awaitable<void> doReceive() override { diff --git a/extensions/standard-processors/tests/unit/RecordSetTests.cpp b/extensions/standard-processors/tests/unit/RecordSetTests.cpp index e33822b42..7d1db9994 100644 --- a/extensions/standard-processors/tests/unit/RecordSetTests.cpp +++ b/extensions/standard-processors/tests/unit/RecordSetTests.cpp @@ -74,8 +74,8 @@ TEST_CASE("Test JSON serialization of a RecordField") { } { minifi::core::RecordObject obj; - obj.emplace("key1", std::make_unique<minifi::core::RecordField>(1)); - obj.emplace("key2", std::make_unique<minifi::core::RecordField>(std::string("hello"))); + obj.emplace("key1", minifi::core::RecordField(1)); + obj.emplace("key2", core::RecordField(std::string("hello"))); minifi::core::RecordField field{std::move(obj)}; rapidjson::Document doc; auto value = field.toJson(doc.GetAllocator()); @@ -114,11 +114,11 @@ TEST_CASE("Test JSON serialization of a Record") { record.emplace("key6", minifi::core::RecordField{std::move(arr)}); minifi::core::RecordObject subobj; - subobj.emplace("subkey3", std::make_unique<minifi::core::RecordField>(1)); - subobj.emplace("subkey4", std::make_unique<minifi::core::RecordField>(std::string("subhello"))); + subobj.emplace("subkey3", core::RecordField(1)); + subobj.emplace("subkey4", core::RecordField(std::string("subhello"))); minifi::core::RecordObject obj; - obj.emplace("subkey1", std::make_unique<minifi::core::RecordField>(-2)); - obj.emplace("subkey2", std::make_unique<minifi::core::RecordField>(std::move(subobj))); + obj.emplace("subkey1", core::RecordField(-2)); + obj.emplace("subkey2", core::RecordField(std::move(subobj))); record.emplace("key7", minifi::core::RecordField{std::move(obj)}); rapidjson::Document doc = record.toJson(); @@ -160,8 +160,8 @@ TEST_CASE("Test Record deserialization from JSON") { CHECK(record.at("time_point") == minifi::core::RecordField{test_time}); minifi::core::RecordObject subobj; - subobj.emplace("number2", std::make_unique<minifi::core::RecordField>(2)); - subobj.emplace("message", std::make_unique<minifi::core::RecordField>(std::string("mymessage"))); + subobj.emplace("number2", core::RecordField(2)); + subobj.emplace("message", core::RecordField(std::string("mymessage"))); minifi::core::RecordField obj_field{std::move(subobj)}; CHECK(record.at("obj") == obj_field); diff --git a/libminifi/src/core/RecordField.cpp b/libminifi/src/core/RecordField.cpp index bbc6c2a40..8c88ff8c6 100644 --- a/libminifi/src/core/RecordField.cpp +++ b/libminifi/src/core/RecordField.cpp @@ -51,11 +51,11 @@ rapidjson::Value RecordField::toJson(rapidjson::Document::AllocatorType& allocat }, [&value, &allocator](const RecordObject& obj) { value.SetObject(); - for (const auto& [key, boxed_field] : obj) { + for (const auto& [key, field] : obj) { rapidjson::Value keyValue; keyValue.SetString(key.c_str(), allocator); - rapidjson::Value fieldValue = boxed_field.field->toJson(allocator); + rapidjson::Value fieldValue = field.toJson(allocator); value.AddMember(keyValue, fieldValue, allocator); } } @@ -88,7 +88,7 @@ RecordField RecordField::fromJson(const rapidjson::Value& value) { } else if (value.IsObject()) { RecordObject obj; for (const auto& member : value.GetObject()) { - obj.emplace(member.name.GetString(), BoxedRecordField{std::make_unique<RecordField>(RecordField::fromJson(member.value))}); + obj.emplace(member.name.GetString(), RecordField::fromJson(member.value)); } return RecordField{std::move(obj)}; } else { diff --git a/libminifi/src/core/flow/StructuredConfiguration.cpp b/libminifi/src/core/flow/StructuredConfiguration.cpp index cb5a696bb..112f92ff4 100644 --- a/libminifi/src/core/flow/StructuredConfiguration.cpp +++ b/libminifi/src/core/flow/StructuredConfiguration.cpp @@ -276,7 +276,7 @@ void StructuredConfiguration::parseParameterContextInheritance(const Node& param auto inherited_parameters_node = parameter_context_node[schema_.inherited_parameter_contexts]; for (const auto& inherited_parameter_context_name : inherited_parameters_node) { auto name = inherited_parameter_context_name.getString().value(); - if (parameter_contexts_.find(name) == parameter_contexts_.end()) { + if (!parameter_contexts_.contains(name)) { throw std::invalid_argument("Inherited parameter context '" + name + "' does not exist!"); } @@ -879,7 +879,7 @@ void StructuredConfiguration::parseSingleProperty(const std::string& property_na ParameterContext* parameter_context) { auto my_prop = component.getSupportedProperty(property_name); const bool is_sensitive = my_prop ? my_prop->isSensitive() : false; - const std::optional<std::string_view> default_value = my_prop ? my_prop->getDefaultValue() : std::nullopt; + const std::optional<std::string> default_value = my_prop ? my_prop->getDefaultValue() : std::nullopt; const auto value_to_set = getReplacedParametersValueOrDefault(property_name, is_sensitive, default_value, property_value_node, parameter_context); if (!value_to_set) { @@ -994,7 +994,7 @@ void StructuredConfiguration::parseParameterContext(const flow::Node& node, core return; } - if (parameter_contexts_.find(parameter_context_name) != parameter_contexts_.end()) { + if (parameter_contexts_.contains(parameter_context_name)) { parent.setParameterContext(parameter_contexts_.at(parameter_context_name).get()); } } diff --git a/libminifi/test/libtest/unit/TestRecord.h b/libminifi/test/libtest/unit/TestRecord.h index 9b88f347f..64dcd7de6 100644 --- a/libminifi/test/libtest/unit/TestRecord.h +++ b/libminifi/test/libtest/unit/TestRecord.h @@ -44,9 +44,9 @@ inline Record createSampleRecord2(const bool stringify = false) { qux.emplace_back('z'); RecordObject quux; - quux["Apfel"] = BoxedRecordField{std::make_unique<RecordField>(std::string{"pomme"})}; - quux["Birne"] = BoxedRecordField{std::make_unique<RecordField>(std::string{"poire"})}; - quux["Aprikose"] = BoxedRecordField{std::make_unique<RecordField>(std::string{"abricot"})}; + quux.emplace("Apfel", RecordField(std::string{"pomme"})); + quux.emplace("Birne", RecordField(std::string{"poire"})); + quux.emplace("Aprikose", RecordField(std::string{"abricot"})); RecordArray corge; corge.emplace_back(false); @@ -78,9 +78,9 @@ inline Record createSampleRecord(const bool stringify = false) { qux.emplace_back('b'); qux.emplace_back('c'); RecordObject quux; - quux["Apfel"] = BoxedRecordField{std::make_unique<RecordField>(std::string{"apple"})}; - quux["Birne"] = BoxedRecordField{std::make_unique<RecordField>(std::string{"pear"})}; - quux["Aprikose"] = BoxedRecordField{std::make_unique<RecordField>(std::string{"apricot"})}; + quux.emplace("Apfel", RecordField(std::string{"apple"})); + quux.emplace("Birne", RecordField(std::string{"pear"})); + quux.emplace("Aprikose", RecordField(std::string{"apricot"})); RecordArray corge; corge.emplace_back(true); diff --git a/libminifi/test/unit/ExpectedTest.cpp b/libminifi/test/unit/ExpectedTest.cpp index 5d123c757..f41fe658c 100644 --- a/libminifi/test/unit/ExpectedTest.cpp +++ b/libminifi/test/unit/ExpectedTest.cpp @@ -22,9 +22,12 @@ #include "unit/Catch.h" #include "utils/expected.h" #include "utils/gsl.h" +#include "unit/TestUtils.h" namespace utils = org::apache::nifi::minifi::utils; +using org::apache::nifi::minifi::test::utils::ExceptionSubStringMatcher; + // shamelessly copied from https://github.com/TartanLlama/expected/blob/master/tests/extensions.cpp (License: CC0) TEST_CASE("expected transform", "[expected][transform]") { auto mul2 = [](int a) { return a * 2; }; @@ -156,7 +159,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 +344,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 +352,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); } { @@ -473,7 +476,10 @@ TEST_CASE("expected valueOrElse", "[expected][valueOrElse]") { REQUIRE(gsl::narrow<int>("hello"sv.size()) == (ex | utils::valueOrElse([](const std::string& err) { return gsl::narrow<int>(err.size()); }))); REQUIRE_THROWS_AS(ex | utils::valueOrElse([](std::string){ throw std::exception(); }), std::exception); // NOLINT(performance-unnecessary-value-param) REQUIRE_THROWS_AS(ex | utils::valueOrElse([](const std::string&) -> int { throw std::exception(); }), std::exception); - REQUIRE_THROWS_WITH(std::move(ex) | utils::valueOrElse([](std::string&& error) -> int { throw std::runtime_error(error); }), "hello"); + REQUIRE_THROWS_MATCHES( + std::move(ex) | utils::valueOrElse([](std::string&& error) -> int { const auto err = std::move(error); throw std::runtime_error(err); }), + std::runtime_error, + ExceptionSubStringMatcher<std::runtime_error>({"hello"})); } TEST_CASE("expected transformError", "[expected][transformError]") { @@ -558,6 +564,16 @@ 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"); + + REQUIRE_THROWS_MATCHES(std::move(unexpected) | utils::orThrow("should throw"), + std::runtime_error, + ExceptionSubStringMatcher<std::runtime_error>({"should throw, but got hello"})); CHECK((expected | utils::orThrow("should be 5")) == 5); } + +TEST_CASE("This fails to compile with std::expected on GCC 15.1 due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119714") { + nonstd::expected<int, std::string> a; + nonstd::expected<int, std::string> b; + + CHECK(a == b); +} diff --git a/libminifi/test/unit/NetUtilsTest.cpp b/libminifi/test/unit/NetUtilsTest.cpp index 3d2cfd9d4..c01611fac 100644 --- a/libminifi/test/unit/NetUtilsTest.cpp +++ b/libminifi/test/unit/NetUtilsTest.cpp @@ -33,13 +33,13 @@ TEST_CASE("net::reverseDnsLookup", "[net][dns][reverseDnsLookup]") { SECTION("dns.google IPv6") { if (minifi::test::utils::isIPv6Disabled()) SKIP("IPv6 is disabled"); - auto dns_google_hostname = net::reverseDnsLookup(asio::ip::address::from_string("2001:4860:4860::8888")); + auto dns_google_hostname = net::reverseDnsLookup(asio::ip::make_address("2001:4860:4860::8888")); REQUIRE(dns_google_hostname.has_value()); CHECK(dns_google_hostname == "dns.google"); } SECTION("dns.google IPv4") { - auto dns_google_hostname = net::reverseDnsLookup(asio::ip::address::from_string("8.8.8.8")); + auto dns_google_hostname = net::reverseDnsLookup(asio::ip::make_address("8.8.8.8")); REQUIRE(dns_google_hostname.has_value()); CHECK(dns_google_hostname == "dns.google"); } @@ -47,13 +47,13 @@ TEST_CASE("net::reverseDnsLookup", "[net][dns][reverseDnsLookup]") { SECTION("Unresolvable address IPv6") { if (minifi::test::utils::isIPv6Disabled()) SKIP("IPv6 is disabled"); - auto unresolvable_hostname = net::reverseDnsLookup(asio::ip::address::from_string("2001:db8::")); + auto unresolvable_hostname = net::reverseDnsLookup(asio::ip::make_address("2001:db8::")); REQUIRE(unresolvable_hostname.has_value()); CHECK(unresolvable_hostname == "2001:db8::"); } SECTION("Unresolvable address IPv4") { - auto unresolvable_hostname = net::reverseDnsLookup(asio::ip::address::from_string("192.0.2.0")); + auto unresolvable_hostname = net::reverseDnsLookup(asio::ip::make_address("192.0.2.0")); REQUIRE(unresolvable_hostname.has_value()); CHECK(unresolvable_hostname == "192.0.2.0"); } @@ -96,8 +96,8 @@ TEST_CASE("utils::net::getSslContext") { REQUIRE_NOTHROW(plan->finalize()); auto ssl_context = utils::net::getSslContext(*ssl_context_service); asio::error_code verification_error; - ssl_context.set_verify_mode(asio::ssl::verify_peer, verification_error); - CHECK(!verification_error); + CHECK_FALSE(ssl_context.set_verify_mode(asio::ssl::verify_peer, verification_error)); + CHECK_FALSE(verification_error); } TEST_CASE("utils::net::getSslContext passphrase problems") { @@ -113,21 +113,29 @@ TEST_CASE("utils::net::getSslContext passphrase problems") { REQUIRE(ssl_context_service->setProperty(minifi::controllers::SSLContextService::ClientCertificate.name, (cert_dir / "alice_by_A.pem").string())); REQUIRE(ssl_context_service->setProperty(minifi::controllers::SSLContextService::PrivateKey.name, (cert_dir / "alice_encrypted.key").string())); + using minifi::test::utils::ExceptionSubStringMatcher; + SECTION("Missing passphrase") { REQUIRE_NOTHROW(plan->finalize()); - REQUIRE_THROWS_WITH(utils::net::getSslContext(*ssl_context_service), "use_private_key_file: bad decrypt (Provider routines)"); + REQUIRE_THROWS_MATCHES(utils::net::getSslContext(*ssl_context_service), + std::runtime_error, + ExceptionSubStringMatcher<std::runtime_error>({"use_private_key_file: bad decrypt (Provider routines)"})); } SECTION("Invalid passphrase") { REQUIRE(ssl_context_service->setProperty(minifi::controllers::SSLContextService::Passphrase.name, "not_the_correct_passphrase")); REQUIRE_NOTHROW(plan->finalize()); - REQUIRE_THROWS_WITH(utils::net::getSslContext(*ssl_context_service), "use_private_key_file: bad decrypt (Provider routines)"); + REQUIRE_THROWS_MATCHES(utils::net::getSslContext(*ssl_context_service), + std::runtime_error, + ExceptionSubStringMatcher<std::runtime_error>({"use_private_key_file: bad decrypt (Provider routines)"})); } SECTION("Invalid passphrase file") { REQUIRE(ssl_context_service->setProperty(minifi::controllers::SSLContextService::Passphrase.name, (cert_dir / "alice_by_B.pem").string())); REQUIRE_NOTHROW(plan->finalize()); - REQUIRE_THROWS_WITH(utils::net::getSslContext(*ssl_context_service), "use_private_key_file: bad decrypt (Provider routines)"); + REQUIRE_THROWS_MATCHES(utils::net::getSslContext(*ssl_context_service), + std::runtime_error, + ExceptionSubStringMatcher<std::runtime_error>({"use_private_key_file: bad decrypt (Provider routines)"})); } } @@ -146,6 +154,6 @@ TEST_CASE("utils::net::getSslContext missing CA") { REQUIRE_NOTHROW(plan->finalize()); auto ssl_context = utils::net::getSslContext(*ssl_context_service); asio::error_code verification_error; - ssl_context.set_verify_mode(asio::ssl::verify_peer, verification_error); - CHECK(!verification_error); + CHECK_FALSE(ssl_context.set_verify_mode(asio::ssl::verify_peer, verification_error)); + CHECK_FALSE(verification_error); } diff --git a/minifi-api/include/minifi-cpp/core/RecordField.h b/minifi-api/include/minifi-cpp/core/RecordField.h index ca6bf2e71..bde55b695 100644 --- a/minifi-api/include/minifi-cpp/core/RecordField.h +++ b/minifi-api/include/minifi-cpp/core/RecordField.h @@ -30,26 +30,8 @@ namespace org::apache::nifi::minifi::core { struct RecordField; -struct BoxedRecordField { - BoxedRecordField() = default; - BoxedRecordField(const BoxedRecordField&) = delete; - BoxedRecordField(BoxedRecordField&& rhs) noexcept : field(std::move(rhs.field)) {} - BoxedRecordField& operator=(const BoxedRecordField&) = delete; - BoxedRecordField& operator=(BoxedRecordField&& rhs) noexcept { - field = std::move(rhs.field); - return *this; - }; - ~BoxedRecordField() = default; - - explicit BoxedRecordField(std::unique_ptr<RecordField>&& _field) : field(std::move(_field)) {} - bool operator==(const BoxedRecordField&) const; - std::unique_ptr<RecordField> field = nullptr; -}; - - using RecordArray = std::vector<RecordField>; - -using RecordObject = std::unordered_map<std::string, BoxedRecordField>; +using RecordObject = std::unordered_map<std::string, RecordField>; template<typename T> concept Float = std::is_floating_point_v<T>; @@ -87,10 +69,4 @@ struct RecordField { std::variant<std::string, int64_t, uint64_t, double, bool, std::chrono::system_clock::time_point, RecordArray, RecordObject> value_; }; -inline bool BoxedRecordField::operator==(const BoxedRecordField& rhs) const { - if (!field || !rhs.field) - return field == rhs.field; - return *field == *rhs.field; -} - } // namespace org::apache::nifi::minifi::core diff --git a/minifi-api/include/minifi-cpp/utils/Literals.h b/minifi-api/include/minifi-cpp/utils/Literals.h index 9b47b8afe..4736f2c20 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) { // NOLINT +#include <cstdint> + +constexpr uint64_t operator""_KiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024 * n; } -constexpr unsigned long long operator "" _MiB(unsigned long long n) { // NOLINT +constexpr uint64_t operator""_MiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024_KiB * n; } -constexpr unsigned long long operator "" _GiB(unsigned long long n) { // NOLINT +constexpr uint64_t operator""_GiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024_MiB * n; } -constexpr unsigned long long operator "" _TiB(unsigned long long n) { // NOLINT +constexpr uint64_t operator""_TiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024_GiB * n; } -constexpr unsigned long long operator "" _PiB(unsigned long long n) { // NOLINT +constexpr uint64_t operator""_PiB(const unsigned long long n) { // NOLINT(runtime/int) return 1024_TiB * n; } -constexpr unsigned long long operator "" _KB(unsigned long long n) { // NOLINT +constexpr uint64_t operator""_KB(const unsigned long long n) { // NOLINT(runtime/int) return 1000 * n; } -constexpr unsigned long long operator "" _MB(unsigned long long n) { // NOLINT +constexpr uint64_t operator""_MB(const unsigned long long n) { // NOLINT(runtime/int) return 1000_KB * n; } -constexpr unsigned long long operator "" _GB(unsigned long long n) { // NOLINT +constexpr uint64_t operator""_GB(const unsigned long long n) { // NOLINT(runtime/int) return 1000_MB * n; } -constexpr unsigned long long operator "" _TB(unsigned long long n) { // NOLINT +constexpr uint64_t operator""_TB(const unsigned long long n) { // NOLINT(runtime/int) return 1000_GB * n; } -constexpr unsigned long long operator "" _PB(unsigned long long n) { // NOLINT +constexpr uint64_t operator""_PB(const unsigned long long n) { // NOLINT(runtime/int) return 1000_TB * n; } diff --git a/run_clang_tidy.sh b/run_clang_tidy.sh index f5dd0603e..83a4d75fd 100755 --- a/run_clang_tidy.sh +++ b/run_clang_tidy.sh @@ -27,4 +27,4 @@ if ! [[ -f "${FILE}" ]]; then exit 0 fi -clang-tidy-16 -warnings-as-errors=* -quiet -p build "$FILE" +clang-tidy-20 -warnings-as-errors=* -quiet -p build "$FILE" diff --git a/thirdparty/aws-sdk-cpp/fix-deprecated-literal-operator.patch b/thirdparty/aws-sdk-cpp/fix-deprecated-literal-operator.patch new file mode 100644 index 000000000..e481ad86f --- /dev/null +++ b/thirdparty/aws-sdk-cpp/fix-deprecated-literal-operator.patch @@ -0,0 +1,31 @@ +diff --git a/include/aws/crt/StringView.h b/include/aws/crt/StringView.h +index 3b6dc2f..d89c8fc 100644 +--- a/crt/aws-crt-cpp/include/aws/crt/StringView.h ++++ b/crt/aws-crt-cpp/include/aws/crt/StringView.h +@@ -820,22 +820,22 @@ namespace Aws + { + inline namespace string_view_literals + { +- inline basic_string_view<char> operator"" _sv(const char *s, size_t length) noexcept ++ inline basic_string_view<char> operator""_sv(const char *s, size_t length) noexcept + { + return basic_string_view<char>(s, length); + } + +- inline basic_string_view<wchar_t> operator"" _sv(const wchar_t * s, size_t length) noexcept ++ inline basic_string_view<wchar_t> operator""_sv(const wchar_t * s, size_t length) noexcept + { + return basic_string_view<wchar_t>(s, length); + } + +- inline basic_string_view<char16_t> operator"" _sv(const char16_t *s, size_t length) noexcept ++ inline basic_string_view<char16_t> operator""_sv(const char16_t *s, size_t length) noexcept + { + return basic_string_view<char16_t>(s, length); + } + +- inline basic_string_view<char32_t> operator"" _sv(const char32_t *s, size_t length) noexcept ++ inline basic_string_view<char32_t> operator""_sv(const char32_t *s, size_t length) noexcept + { + return basic_string_view<char32_t>(s, length); + } diff --git a/thirdparty/azure-sdk-cpp/include-cinttypes-for-uint8_t-gcc15-fix.patch b/thirdparty/azure-sdk-cpp/include-cinttypes-for-uint8_t-gcc15-fix.patch new file mode 100644 index 000000000..a8ec23c1f --- /dev/null +++ b/thirdparty/azure-sdk-cpp/include-cinttypes-for-uint8_t-gcc15-fix.patch @@ -0,0 +1,24 @@ +From e359881035c25309813a79319c14a32dc230d131 Mon Sep 17 00:00:00 2001 +From: Martin Zink <[email protected]> +Date: Tue, 19 Aug 2025 15:28:50 +0200 +Subject: [PATCH 1/1] include cinttypes for uint8_t (gcc15 fix) + +--- + .../azure-security-attestation/src/private/crypto/inc/crypto.hpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sdk/attestation/azure-security-attestation/src/private/crypto/inc/crypto.hpp b/sdk/attestation/azure-security-attestation/src/private/crypto/inc/crypto.hpp +index 9a98f204e..95260d243 100644 +--- a/sdk/attestation/azure-security-attestation/src/private/crypto/inc/crypto.hpp ++++ b/sdk/attestation/azure-security-attestation/src/private/crypto/inc/crypto.hpp +@@ -6,6 +6,7 @@ + #include <memory> + #include <string> + #include <vector> ++#include <cinttypes> + + namespace Azure { namespace Security { namespace Attestation { namespace _detail { + /** +-- +2.50.1 + diff --git a/thirdparty/bustache/fix-deprecated-literal-operator.patch b/thirdparty/bustache/fix-deprecated-literal-operator.patch new file mode 100644 index 000000000..c0d75dccf --- /dev/null +++ b/thirdparty/bustache/fix-deprecated-literal-operator.patch @@ -0,0 +1,19 @@ +diff --git a/include/bustache/format.hpp b/include/bustache/format.hpp +index 77ecac5..395ac38 100644 +--- a/include/bustache/format.hpp ++++ b/include/bustache/format.hpp +@@ -147,11 +147,11 @@ namespace bustache + + inline namespace literals + { +- inline format operator"" _fmt(char const* str, std::size_t n) ++ inline format operator""_fmt(char const* str, std::size_t n) + { + return format(std::string_view(str, n)); + } + } + } + +-#endif +\ No newline at end of file ++#endif diff --git a/thirdparty/couchbase/c++23_fixes.patch b/thirdparty/couchbase/c++23_fixes.patch new file mode 100644 index 000000000..92946f3a1 --- /dev/null +++ b/thirdparty/couchbase/c++23_fixes.patch @@ -0,0 +1,78 @@ +Subject: [PATCH] c++23 fixes (replace forward declaration with includes due to stricter behaviour with unique_ptr + incomplete types) +--- +Index: couchbase/numeric_range_facet_result.hxx +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/couchbase/numeric_range_facet_result.hxx b/couchbase/numeric_range_facet_result.hxx +--- a/couchbase/numeric_range_facet_result.hxx (revision 51f4775e56fb9ba975f92d7791d4d9feca336f05) ++++ b/couchbase/numeric_range_facet_result.hxx (date 1747839882124) +@@ -19,15 +19,13 @@ + + #include <couchbase/search_facet_result.hxx> + #include <couchbase/search_numeric_range.hxx> ++#include <core/impl/internal_numeric_range_facet_result.hxx> + + #include <string> + #include <vector> + + namespace couchbase + { +-#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN +-class internal_numeric_range_facet_result; +-#endif + + /** + * @since 1.0.0 +Index: couchbase/term_facet_result.hxx +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/couchbase/term_facet_result.hxx b/couchbase/term_facet_result.hxx +--- a/couchbase/term_facet_result.hxx (revision 51f4775e56fb9ba975f92d7791d4d9feca336f05) ++++ b/couchbase/term_facet_result.hxx (date 1747839742361) +@@ -19,15 +19,13 @@ + + #include <couchbase/search_facet_result.hxx> + #include <couchbase/search_term_range.hxx> ++#include <core/impl/internal_term_facet_result.hxx> + + #include <string> + #include <vector> + + namespace couchbase + { +-#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN +-class internal_term_facet_result; +-#endif + + /** + * @since 1.0.0 +Index: couchbase/date_range_facet_result.hxx +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/couchbase/date_range_facet_result.hxx b/couchbase/date_range_facet_result.hxx +--- a/couchbase/date_range_facet_result.hxx (revision 51f4775e56fb9ba975f92d7791d4d9feca336f05) ++++ b/couchbase/date_range_facet_result.hxx (date 1747839803545) +@@ -19,6 +19,7 @@ + + #include <couchbase/search_date_range.hxx> + #include <couchbase/search_facet_result.hxx> ++#include <core/impl/internal_date_range_facet_result.hxx> + + #include <memory> + #include <string> +@@ -26,9 +27,6 @@ + + namespace couchbase + { +-#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN +-class internal_date_range_facet_result; +-#endif + + /** + * @since 1.0.0 diff --git a/thirdparty/couchbase/remove-thirdparty.patch b/thirdparty/couchbase/remove-thirdparty-1.0.2.patch similarity index 100% copy from thirdparty/couchbase/remove-thirdparty.patch copy to thirdparty/couchbase/remove-thirdparty-1.0.2.patch diff --git a/thirdparty/couchbase/remove-thirdparty.patch b/thirdparty/couchbase/remove-thirdparty.patch index 732576f14..942e5fc27 100644 --- a/thirdparty/couchbase/remove-thirdparty.patch +++ b/thirdparty/couchbase/remove-thirdparty.patch @@ -1,10 +1,14 @@ diff --git a/cmake/ThirdPartyDependencies.cmake b/cmake/ThirdPartyDependencies.cmake -index f02af02..f83c181 100644 +index af373ce..30cf2b6 100644 --- a/cmake/ThirdPartyDependencies.cmake +++ b/cmake/ThirdPartyDependencies.cmake -@@ -3,73 +3,30 @@ +@@ -1,232 +1,141 @@ + # NOTE: This file MUST be in sync with couchbase-sdk-cxx-black-duck-manifest.yaml + include(cmake/CPM.cmake) + set(CPM_USE_LOCAL_PACKAGES OFF) + # https://cmake.org/cmake/help/v3.28/policy/CMP0063.html set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) @@ -18,36 +22,13 @@ index f02af02..f83c181 100644 $<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>) endfunction() --if(NOT TARGET fmt::fmt) -- # https://github.com/fmtlib/fmt/releases -- cpmaddpackage( -- NAME -- fmt -- GIT_TAG -- 11.0.1 -- VERSION -- 11.0.1 -- GITHUB_REPOSITORY -- "fmtlib/fmt" -- EXCLUDE_FROM_ALL ON -- OPTIONS -- "FMT_INSTALL OFF" -- # Unicode support for MSVC enabled in CompilerWarnings.cmake -- "FMT_UNICODE OFF" -- "FMT_DOC OFF" -- "BUILD_SHARED_LIBS OFF" -- "CMAKE_C_VISIBILITY_PRESET hidden" -- "CMAKE_CXX_VISIBILITY_PRESET hidden" -- "CMAKE_POSITION_INDEPENDENT_CODE ON") --endif() -- -if(NOT TARGET spdlog::spdlog) - # https://github.com/gabime/spdlog/releases - cpmaddpackage( - NAME - spdlog - VERSION -- 1.14.1 +- 1.15.0 - GITHUB_REPOSITORY - "gabime/spdlog" - EXCLUDE_FROM_ALL ON @@ -57,8 +38,11 @@ index f02af02..f83c181 100644 - "CMAKE_C_VISIBILITY_PRESET hidden" - "CMAKE_CXX_VISIBILITY_PRESET hidden" - "CMAKE_POSITION_INDEPENDENT_CODE ON" +- "NO_CMAKE_SYSTEM_PATH ON" +- "NO_CMAKE_INSTALL_PREFIX ON" +- "NO_CMAKE_SYSTEM_PACKAGE_REGISTRY ON" - "SPDLOG_BUILD_SHARED OFF" -- "SPDLOG_FMT_EXTERNAL ON") +- "SPDLOG_FMT_EXTERNAL OFF") -endif() - if(NOT TARGET Microsoft.GSL::GSL) @@ -76,7 +60,89 @@ index f02af02..f83c181 100644 "CMAKE_C_VISIBILITY_PRESET hidden" "CMAKE_CXX_VISIBILITY_PRESET hidden" "CMAKE_POSITION_INDEPENDENT_CODE ON") -@@ -159,93 +116,24 @@ if(NOT TARGET taocpp::json) + endif() + + if(NOT TARGET hdr_histogram_static) + # https://github.com/HdrHistogram/HdrHistogram_c/releases + cpmaddpackage( + NAME + hdr_histogram + GIT_TAG + 0.11.8 + VERSION + 0.11.8 + GITHUB_REPOSITORY + "HdrHistogram/HdrHistogram_c" + EXCLUDE_FROM_ALL ON + OPTIONS + "CMAKE_C_VISIBILITY_PRESET hidden" + "CMAKE_CXX_VISIBILITY_PRESET hidden" + "CMAKE_POSITION_INDEPENDENT_CODE ON" + "HDR_LOG_REQUIRED OFF" + "HDR_HISTOGRAM_BUILD_SHARED OFF" + "HDR_HISTOGRAM_BUILD_PROGRAMS OFF") + endif() + + if(NOT TARGET llhttp::llhttp) + # https://github.com/nodejs/llhttp/releases + cpmaddpackage( + NAME + llhttp + GIT_TAG + release/v9.2.1 + VERSION + 9.2.1 + GITHUB_REPOSITORY + "nodejs/llhttp" + EXCLUDE_FROM_ALL ON + OPTIONS + "CMAKE_C_VISIBILITY_PRESET hidden" + "CMAKE_CXX_VISIBILITY_PRESET hidden" + "CMAKE_POSITION_INDEPENDENT_CODE ON" + "BUILD_SHARED_LIBS OFF" + "BUILD_STATIC_LIBS ON") + endif() + + if(NOT TARGET snappy) + # https://github.com/google/snappy/releases + cpmaddpackage( + NAME + snappy + GIT_TAG + 1.2.2 + VERSION + 1.2.2 + GITHUB_REPOSITORY + "google/snappy" + EXCLUDE_FROM_ALL ON + OPTIONS + "SNAPPY_INSTALL OFF" + "CMAKE_C_VISIBILITY_PRESET hidden" + "CMAKE_CXX_VISIBILITY_PRESET hidden" + "CMAKE_POSITION_INDEPENDENT_CODE ON" + "BUILD_SHARED_LIBS OFF" + "SNAPPY_BUILD_TESTS OFF" + "SNAPPY_BUILD_BENCHMARKS OFF") + endif() + if(NOT MSVC) + # https://github.com/google/snappy/pull/156 + target_compile_options(snappy PRIVATE -Wno-sign-compare) + endif() + + if(NOT TARGET taocpp::json) + # https://github.com/taocpp/json/releases + cpmaddpackage( + NAME + json + GIT_TAG + 1.0.0-beta.14 + VERSION + 1.0.0-beta.14 + GITHUB_REPOSITORY + "taocpp/json" + OPTIONS + "CMAKE_C_VISIBILITY_PRESET hidden" + "CMAKE_CXX_VISIBILITY_PRESET hidden" "CMAKE_POSITION_INDEPENDENT_CODE ON" "BUILD_SHARED_LIBS OFF" "PEGTL_INSTALL ${COUCHBASE_CXX_CLIENT_INSTALL}" @@ -167,6 +233,5 @@ index f02af02..f83c181 100644 declare_system_library(hdr_histogram_static) declare_system_library(Microsoft.GSL::GSL) -declare_system_library(spdlog::spdlog) --declare_system_library(fmt::fmt) -declare_system_library(asio) declare_system_library(taocpp::json) diff --git a/thirdparty/google-cloud-cpp/c++23_fixes.patch b/thirdparty/google-cloud-cpp/c++23_fixes.patch new file mode 100644 index 000000000..317d6aa71 --- /dev/null +++ b/thirdparty/google-cloud-cpp/c++23_fixes.patch @@ -0,0 +1,19 @@ +Subject: [PATCH] c++23 fixes +--- +Index: google/cloud/internal/rest_parse_json_error.cc +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/google/cloud/internal/rest_parse_json_error.cc b/google/cloud/internal/rest_parse_json_error.cc +--- a/google/cloud/internal/rest_parse_json_error.cc (revision 0c5fa4fc7f5377b420a0ec5725f334e597d841a5) ++++ b/google/cloud/internal/rest_parse_json_error.cc (date 1747841684609) +@@ -62,7 +62,7 @@ + if (m != v.end() && m->is_object()) { + for (auto const& i : m->items()) { + if (!i.value().is_string()) continue; +- metadata[i.key()] = i.value(); ++ metadata[i.key()] = i.value().get<std::string>(); + } + } + metadata["http_status_code"] = std::to_string(http_status_code); 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/opencv/c++23_fixes.patch b/thirdparty/opencv/c++23_fixes.patch new file mode 100644 index 000000000..93052b20f --- /dev/null +++ b/thirdparty/opencv/c++23_fixes.patch @@ -0,0 +1,23 @@ +Subject: [PATCH] c++23 fixes +--- +Index: modules/gapi/src/compiler/gislandmodel.hpp +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/gapi/src/compiler/gislandmodel.hpp b/modules/gapi/src/compiler/gislandmodel.hpp +--- a/modules/gapi/src/compiler/gislandmodel.hpp (revision 725e440d278aca07d35a5e8963ef990572b07316) ++++ b/modules/gapi/src/compiler/gislandmodel.hpp (date 1747828665540) +@@ -8,8 +8,11 @@ + #ifndef OPENCV_GAPI_GISLANDMODEL_HPP + #define OPENCV_GAPI_GISLANDMODEL_HPP + +-#include <unordered_set> ++#include <unordered_set> // unordered_map + #include <memory> // shared_ptr ++#include <exception> // exception_ptr ++#include <string> // string ++#include <cstddef> // size_t + + #include <ade/graph.hpp> + #include <ade/typed_graph.hpp> 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) + diff --git a/thirdparty/ranges-v3/remove-deprecated.patch b/thirdparty/ranges-v3/remove-deprecated.patch new file mode 100644 index 000000000..f34182a63 --- /dev/null +++ b/thirdparty/ranges-v3/remove-deprecated.patch @@ -0,0 +1,27 @@ +diff --git a/include/meta/meta.hpp b/include/meta/meta.hpp +index 1372703e7..66ee2928b 100644 +--- a/include/meta/meta.hpp ++++ b/include/meta/meta.hpp +@@ -3776,7 +3776,7 @@ namespace meta + /// \ingroup integral + template <char... Chs> + constexpr fold<list<char_<Chs>...>, meta::size_t<0>, quote<detail::atoi_>> +- operator"" _z() ++ operator""_z() + { + return {}; + } +diff --git a/include/range/v3/utility/compressed_pair.hpp b/include/range/v3/utility/compressed_pair.hpp +index 438d12f0d..a9590b4bd 100644 +--- a/include/range/v3/utility/compressed_pair.hpp ++++ b/include/range/v3/utility/compressed_pair.hpp +@@ -92,8 +92,7 @@ namespace ranges + }; + + template<typename... Ts> +- using compressed_tuple RANGES_DEPRECATED( +- "ranges::compressed_tuple is deprecated.") = ++ using compressed_tuple = + compressed_tuple_<meta::list<Ts...>, + meta::make_index_sequence<sizeof...(Ts)>>; + } // namespace compressed_tuple_detail diff --git a/thirdparty/rocksdb/all/patches/arm7.patch b/thirdparty/rocksdb/all/patches/arm7.patch deleted file mode 100644 index 1eb64ed5c..000000000 --- a/thirdparty/rocksdb/all/patches/arm7.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h -index 225e3fa72..cd5f935f1 100644 ---- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h -+++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h -@@ -131,6 +131,10 @@ static inline tokutime_t toku_time_now(void) { - uint64_t result; - __asm __volatile__("mrs %[rt], cntvct_el0" : [ rt ] "=r"(result)); - return result; -+#elif defined(__arm__) -+ uint32_t lo, hi; -+ __asm __volatile__("mrrc p15, 1, %[lo], %[hi], c14" : [ lo ] "=r" (lo), [hi] "=r" (hi)); -+ return (uint64_t)hi << 32 | lo; - #elif defined(__powerpc__) - return __ppc_get_timebase(); - #elif defined(__s390x__) diff --git a/thirdparty/rocksdb/all/patches/c++23_fixes.patch b/thirdparty/rocksdb/all/patches/c++23_fixes.patch new file mode 100644 index 000000000..a3349c8fc --- /dev/null +++ b/thirdparty/rocksdb/all/patches/c++23_fixes.patch @@ -0,0 +1,641 @@ +Subject: [PATCH] C++23 fixes +--- +Index: table/block_based/block_based_table_builder.cc +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/table/block_based/block_based_table_builder.cc b/table/block_based/block_based_table_builder.cc +--- a/table/block_based/block_based_table_builder.cc (revision 4b2122578e475cb88aef4dcf152cccd5dbf51060) ++++ b/table/block_based/block_based_table_builder.cc (date 1747822597282) +@@ -268,6 +268,315 @@ + bool decoupled_partitioned_filters_; + }; + ++struct BlockBasedTableBuilder::ParallelCompressionRep { ++ // TODO: consider replacing with autovector or similar ++ // Keys is a wrapper of vector of strings avoiding ++ // releasing string memories during vector clear() ++ // in order to save memory allocation overhead ++ class Keys { ++ public: ++ Keys() : keys_(kKeysInitSize), size_(0) {} ++ void PushBack(const Slice& key) { ++ if (size_ == keys_.size()) { ++ keys_.emplace_back(key.data(), key.size()); ++ } else { ++ keys_[size_].assign(key.data(), key.size()); ++ } ++ size_++; ++ } ++ void SwapAssign(std::vector<std::string>& keys) { ++ size_ = keys.size(); ++ std::swap(keys_, keys); ++ } ++ void Clear() { size_ = 0; } ++ size_t Size() { return size_; } ++ std::string& Back() { return keys_[size_ - 1]; } ++ std::string& operator[](size_t idx) { ++ assert(idx < size_); ++ return keys_[idx]; ++ } ++ ++ private: ++ const size_t kKeysInitSize = 32; ++ std::vector<std::string> keys_; ++ size_t size_; ++ }; ++ std::unique_ptr<Keys> curr_block_keys; ++ ++ class BlockRepSlot; ++ ++ // BlockRep instances are fetched from and recycled to ++ // block_rep_pool during parallel compression. ++ struct BlockRep { ++ Slice contents; ++ Slice compressed_contents; ++ std::unique_ptr<std::string> data; ++ std::unique_ptr<std::string> compressed_data; ++ CompressionType compression_type; ++ std::unique_ptr<std::string> first_key_in_next_block; ++ std::unique_ptr<Keys> keys; ++ std::unique_ptr<BlockRepSlot> slot; ++ Status status; ++ }; ++ // Use a vector of BlockRep as a buffer for a determined number ++ // of BlockRep structures. All data referenced by pointers in ++ // BlockRep will be freed when this vector is destructed. ++ using BlockRepBuffer = std::vector<BlockRep>; ++ BlockRepBuffer block_rep_buf; ++ // Use a thread-safe queue for concurrent access from block ++ // building thread and writer thread. ++ using BlockRepPool = WorkQueue<BlockRep*>; ++ BlockRepPool block_rep_pool; ++ ++ // Use BlockRepSlot to keep block order in write thread. ++ // slot_ will pass references to BlockRep ++ class BlockRepSlot { ++ public: ++ BlockRepSlot() : slot_(1) {} ++ template <typename T> ++ void Fill(T&& rep) { ++ slot_.push(std::forward<T>(rep)); ++ } ++ void Take(BlockRep*& rep) { slot_.pop(rep); } ++ ++ private: ++ // slot_ will pass references to BlockRep in block_rep_buf, ++ // and those references are always valid before the destruction of ++ // block_rep_buf. ++ WorkQueue<BlockRep*> slot_; ++ }; ++ ++ // Compression queue will pass references to BlockRep in block_rep_buf, ++ // and those references are always valid before the destruction of ++ // block_rep_buf. ++ using CompressQueue = WorkQueue<BlockRep*>; ++ CompressQueue compress_queue; ++ std::vector<port::Thread> compress_thread_pool; ++ ++ // Write queue will pass references to BlockRep::slot in block_rep_buf, ++ // and those references are always valid before the corresponding ++ // BlockRep::slot is destructed, which is before the destruction of ++ // block_rep_buf. ++ using WriteQueue = WorkQueue<BlockRepSlot*>; ++ WriteQueue write_queue; ++ std::unique_ptr<port::Thread> write_thread; ++ ++ // Estimate output file size when parallel compression is enabled. This is ++ // necessary because compression & flush are no longer synchronized, ++ // and BlockBasedTableBuilder::FileSize() is no longer accurate. ++ // memory_order_relaxed suffices because accurate statistics is not required. ++ class FileSizeEstimator { ++ public: ++ explicit FileSizeEstimator() ++ : uncomp_bytes_compressed(0), ++ uncomp_bytes_curr_block(0), ++ uncomp_bytes_curr_block_set(false), ++ uncomp_bytes_inflight(0), ++ blocks_inflight(0), ++ curr_compression_ratio(0), ++ estimated_file_size(0) {} ++ ++ // Estimate file size when a block is about to be emitted to ++ // compression thread ++ void EmitBlock(uint64_t uncomp_block_size, uint64_t curr_file_size) { ++ uint64_t new_uncomp_bytes_inflight = ++ uncomp_bytes_inflight.fetch_add(uncomp_block_size, ++ std::memory_order_relaxed) + ++ uncomp_block_size; ++ ++ uint64_t new_blocks_inflight = ++ blocks_inflight.fetch_add(1, std::memory_order_relaxed) + 1; ++ ++ estimated_file_size.store( ++ curr_file_size + ++ static_cast<uint64_t>( ++ static_cast<double>(new_uncomp_bytes_inflight) * ++ curr_compression_ratio.load(std::memory_order_relaxed)) + ++ new_blocks_inflight * kBlockTrailerSize, ++ std::memory_order_relaxed); ++ } ++ ++ // Estimate file size when a block is already reaped from ++ // compression thread ++ void ReapBlock(uint64_t compressed_block_size, uint64_t curr_file_size) { ++ assert(uncomp_bytes_curr_block_set); ++ ++ uint64_t new_uncomp_bytes_compressed = ++ uncomp_bytes_compressed + uncomp_bytes_curr_block; ++ assert(new_uncomp_bytes_compressed > 0); ++ ++ curr_compression_ratio.store( ++ (curr_compression_ratio.load(std::memory_order_relaxed) * ++ uncomp_bytes_compressed + ++ compressed_block_size) / ++ static_cast<double>(new_uncomp_bytes_compressed), ++ std::memory_order_relaxed); ++ uncomp_bytes_compressed = new_uncomp_bytes_compressed; ++ ++ uint64_t new_uncomp_bytes_inflight = ++ uncomp_bytes_inflight.fetch_sub(uncomp_bytes_curr_block, ++ std::memory_order_relaxed) - ++ uncomp_bytes_curr_block; ++ ++ uint64_t new_blocks_inflight = ++ blocks_inflight.fetch_sub(1, std::memory_order_relaxed) - 1; ++ ++ estimated_file_size.store( ++ curr_file_size + ++ static_cast<uint64_t>( ++ static_cast<double>(new_uncomp_bytes_inflight) * ++ curr_compression_ratio.load(std::memory_order_relaxed)) + ++ new_blocks_inflight * kBlockTrailerSize, ++ std::memory_order_relaxed); ++ ++ uncomp_bytes_curr_block_set = false; ++ } ++ ++ void SetEstimatedFileSize(uint64_t size) { ++ estimated_file_size.store(size, std::memory_order_relaxed); ++ } ++ ++ uint64_t GetEstimatedFileSize() { ++ return estimated_file_size.load(std::memory_order_relaxed); ++ } ++ ++ void SetCurrBlockUncompSize(uint64_t size) { ++ uncomp_bytes_curr_block = size; ++ uncomp_bytes_curr_block_set = true; ++ } ++ ++ private: ++ // Input bytes compressed so far. ++ uint64_t uncomp_bytes_compressed; ++ // Size of current block being appended. ++ uint64_t uncomp_bytes_curr_block; ++ // Whether uncomp_bytes_curr_block has been set for next ++ // ReapBlock call. ++ bool uncomp_bytes_curr_block_set; ++ // Input bytes under compression and not appended yet. ++ std::atomic<uint64_t> uncomp_bytes_inflight; ++ // Number of blocks under compression and not appended yet. ++ std::atomic<uint64_t> blocks_inflight; ++ // Current compression ratio, maintained by BGWorkWriteMaybeCompressedBlock. ++ std::atomic<double> curr_compression_ratio; ++ // Estimated SST file size. ++ std::atomic<uint64_t> estimated_file_size; ++ }; ++ FileSizeEstimator file_size_estimator; ++ ++ // Facilities used for waiting first block completion. Need to Wait for ++ // the completion of first block compression and flush to get a non-zero ++ // compression ratio. ++ std::atomic<bool> first_block_processed; ++ std::condition_variable first_block_cond; ++ std::mutex first_block_mutex; ++ ++ explicit ParallelCompressionRep(uint32_t parallel_threads) ++ : curr_block_keys(new Keys()), ++ block_rep_buf(parallel_threads), ++ block_rep_pool(parallel_threads), ++ compress_queue(parallel_threads), ++ write_queue(parallel_threads), ++ first_block_processed(false) { ++ for (uint32_t i = 0; i < parallel_threads; i++) { ++ block_rep_buf[i].contents = Slice(); ++ block_rep_buf[i].compressed_contents = Slice(); ++ block_rep_buf[i].data.reset(new std::string()); ++ block_rep_buf[i].compressed_data.reset(new std::string()); ++ block_rep_buf[i].compression_type = CompressionType(); ++ block_rep_buf[i].first_key_in_next_block.reset(new std::string()); ++ block_rep_buf[i].keys.reset(new Keys()); ++ block_rep_buf[i].slot.reset(new BlockRepSlot()); ++ block_rep_buf[i].status = Status::OK(); ++ block_rep_pool.push(&block_rep_buf[i]); ++ } ++ } ++ ++ ~ParallelCompressionRep() { block_rep_pool.finish(); } ++ ++ // Make a block prepared to be emitted to compression thread ++ // Used in non-buffered mode ++ BlockRep* PrepareBlock(CompressionType compression_type, ++ const Slice* first_key_in_next_block, ++ BlockBuilder* data_block) { ++ BlockRep* block_rep = ++ PrepareBlockInternal(compression_type, first_key_in_next_block); ++ assert(block_rep != nullptr); ++ data_block->SwapAndReset(*(block_rep->data)); ++ block_rep->contents = *(block_rep->data); ++ std::swap(block_rep->keys, curr_block_keys); ++ curr_block_keys->Clear(); ++ return block_rep; ++ } ++ ++ // Used in EnterUnbuffered ++ BlockRep* PrepareBlock(CompressionType compression_type, ++ const Slice* first_key_in_next_block, ++ std::string* data_block, ++ std::vector<std::string>* keys) { ++ BlockRep* block_rep = ++ PrepareBlockInternal(compression_type, first_key_in_next_block); ++ assert(block_rep != nullptr); ++ std::swap(*(block_rep->data), *data_block); ++ block_rep->contents = *(block_rep->data); ++ block_rep->keys->SwapAssign(*keys); ++ return block_rep; ++ } ++ ++ // Emit a block to compression thread ++ void EmitBlock(BlockRep* block_rep) { ++ assert(block_rep != nullptr); ++ assert(block_rep->status.ok()); ++ if (!write_queue.push(block_rep->slot.get())) { ++ return; ++ } ++ if (!compress_queue.push(block_rep)) { ++ return; ++ } ++ ++ if (!first_block_processed.load(std::memory_order_relaxed)) { ++ std::unique_lock<std::mutex> lock(first_block_mutex); ++ first_block_cond.wait(lock, [this] { ++ return first_block_processed.load(std::memory_order_relaxed); ++ }); ++ } ++ } ++ ++ // Reap a block from compression thread ++ void ReapBlock(BlockRep* block_rep) { ++ assert(block_rep != nullptr); ++ block_rep->compressed_data->clear(); ++ block_rep_pool.push(block_rep); ++ ++ if (!first_block_processed.load(std::memory_order_relaxed)) { ++ std::lock_guard<std::mutex> lock(first_block_mutex); ++ first_block_processed.store(true, std::memory_order_relaxed); ++ first_block_cond.notify_one(); ++ } ++ } ++ ++ private: ++ BlockRep* PrepareBlockInternal(CompressionType compression_type, ++ const Slice* first_key_in_next_block) { ++ BlockRep* block_rep = nullptr; ++ block_rep_pool.pop(block_rep); ++ assert(block_rep != nullptr); ++ ++ assert(block_rep->data); ++ ++ block_rep->compression_type = compression_type; ++ ++ if (first_key_in_next_block == nullptr) { ++ block_rep->first_key_in_next_block.reset(nullptr); ++ } else { ++ block_rep->first_key_in_next_block->assign( ++ first_key_in_next_block->data(), first_key_in_next_block->size()); ++ } ++ ++ return block_rep; ++ } ++}; ++ + struct BlockBasedTableBuilder::Rep { + const ImmutableOptions ioptions; + // BEGIN from MutableCFOptions +@@ -667,314 +976,6 @@ + IOStatus io_status; + }; + +-struct BlockBasedTableBuilder::ParallelCompressionRep { +- // TODO: consider replacing with autovector or similar +- // Keys is a wrapper of vector of strings avoiding +- // releasing string memories during vector clear() +- // in order to save memory allocation overhead +- class Keys { +- public: +- Keys() : keys_(kKeysInitSize), size_(0) {} +- void PushBack(const Slice& key) { +- if (size_ == keys_.size()) { +- keys_.emplace_back(key.data(), key.size()); +- } else { +- keys_[size_].assign(key.data(), key.size()); +- } +- size_++; +- } +- void SwapAssign(std::vector<std::string>& keys) { +- size_ = keys.size(); +- std::swap(keys_, keys); +- } +- void Clear() { size_ = 0; } +- size_t Size() { return size_; } +- std::string& Back() { return keys_[size_ - 1]; } +- std::string& operator[](size_t idx) { +- assert(idx < size_); +- return keys_[idx]; +- } +- +- private: +- const size_t kKeysInitSize = 32; +- std::vector<std::string> keys_; +- size_t size_; +- }; +- std::unique_ptr<Keys> curr_block_keys; +- +- class BlockRepSlot; +- +- // BlockRep instances are fetched from and recycled to +- // block_rep_pool during parallel compression. +- struct BlockRep { +- Slice contents; +- Slice compressed_contents; +- std::unique_ptr<std::string> data; +- std::unique_ptr<std::string> compressed_data; +- CompressionType compression_type; +- std::unique_ptr<std::string> first_key_in_next_block; +- std::unique_ptr<Keys> keys; +- std::unique_ptr<BlockRepSlot> slot; +- Status status; +- }; +- // Use a vector of BlockRep as a buffer for a determined number +- // of BlockRep structures. All data referenced by pointers in +- // BlockRep will be freed when this vector is destructed. +- using BlockRepBuffer = std::vector<BlockRep>; +- BlockRepBuffer block_rep_buf; +- // Use a thread-safe queue for concurrent access from block +- // building thread and writer thread. +- using BlockRepPool = WorkQueue<BlockRep*>; +- BlockRepPool block_rep_pool; +- +- // Use BlockRepSlot to keep block order in write thread. +- // slot_ will pass references to BlockRep +- class BlockRepSlot { +- public: +- BlockRepSlot() : slot_(1) {} +- template <typename T> +- void Fill(T&& rep) { +- slot_.push(std::forward<T>(rep)); +- } +- void Take(BlockRep*& rep) { slot_.pop(rep); } +- +- private: +- // slot_ will pass references to BlockRep in block_rep_buf, +- // and those references are always valid before the destruction of +- // block_rep_buf. +- WorkQueue<BlockRep*> slot_; +- }; +- +- // Compression queue will pass references to BlockRep in block_rep_buf, +- // and those references are always valid before the destruction of +- // block_rep_buf. +- using CompressQueue = WorkQueue<BlockRep*>; +- CompressQueue compress_queue; +- std::vector<port::Thread> compress_thread_pool; +- +- // Write queue will pass references to BlockRep::slot in block_rep_buf, +- // and those references are always valid before the corresponding +- // BlockRep::slot is destructed, which is before the destruction of +- // block_rep_buf. +- using WriteQueue = WorkQueue<BlockRepSlot*>; +- WriteQueue write_queue; +- std::unique_ptr<port::Thread> write_thread; +- +- // Estimate output file size when parallel compression is enabled. This is +- // necessary because compression & flush are no longer synchronized, +- // and BlockBasedTableBuilder::FileSize() is no longer accurate. +- // memory_order_relaxed suffices because accurate statistics is not required. +- class FileSizeEstimator { +- public: +- explicit FileSizeEstimator() +- : uncomp_bytes_compressed(0), +- uncomp_bytes_curr_block(0), +- uncomp_bytes_curr_block_set(false), +- uncomp_bytes_inflight(0), +- blocks_inflight(0), +- curr_compression_ratio(0), +- estimated_file_size(0) {} +- +- // Estimate file size when a block is about to be emitted to +- // compression thread +- void EmitBlock(uint64_t uncomp_block_size, uint64_t curr_file_size) { +- uint64_t new_uncomp_bytes_inflight = +- uncomp_bytes_inflight.fetch_add(uncomp_block_size, +- std::memory_order_relaxed) + +- uncomp_block_size; +- +- uint64_t new_blocks_inflight = +- blocks_inflight.fetch_add(1, std::memory_order_relaxed) + 1; +- +- estimated_file_size.store( +- curr_file_size + +- static_cast<uint64_t>( +- static_cast<double>(new_uncomp_bytes_inflight) * +- curr_compression_ratio.load(std::memory_order_relaxed)) + +- new_blocks_inflight * kBlockTrailerSize, +- std::memory_order_relaxed); +- } +- +- // Estimate file size when a block is already reaped from +- // compression thread +- void ReapBlock(uint64_t compressed_block_size, uint64_t curr_file_size) { +- assert(uncomp_bytes_curr_block_set); +- +- uint64_t new_uncomp_bytes_compressed = +- uncomp_bytes_compressed + uncomp_bytes_curr_block; +- assert(new_uncomp_bytes_compressed > 0); +- +- curr_compression_ratio.store( +- (curr_compression_ratio.load(std::memory_order_relaxed) * +- uncomp_bytes_compressed + +- compressed_block_size) / +- static_cast<double>(new_uncomp_bytes_compressed), +- std::memory_order_relaxed); +- uncomp_bytes_compressed = new_uncomp_bytes_compressed; +- +- uint64_t new_uncomp_bytes_inflight = +- uncomp_bytes_inflight.fetch_sub(uncomp_bytes_curr_block, +- std::memory_order_relaxed) - +- uncomp_bytes_curr_block; +- +- uint64_t new_blocks_inflight = +- blocks_inflight.fetch_sub(1, std::memory_order_relaxed) - 1; +- +- estimated_file_size.store( +- curr_file_size + +- static_cast<uint64_t>( +- static_cast<double>(new_uncomp_bytes_inflight) * +- curr_compression_ratio.load(std::memory_order_relaxed)) + +- new_blocks_inflight * kBlockTrailerSize, +- std::memory_order_relaxed); +- +- uncomp_bytes_curr_block_set = false; +- } +- +- void SetEstimatedFileSize(uint64_t size) { +- estimated_file_size.store(size, std::memory_order_relaxed); +- } +- +- uint64_t GetEstimatedFileSize() { +- return estimated_file_size.load(std::memory_order_relaxed); +- } +- +- void SetCurrBlockUncompSize(uint64_t size) { +- uncomp_bytes_curr_block = size; +- uncomp_bytes_curr_block_set = true; +- } +- +- private: +- // Input bytes compressed so far. +- uint64_t uncomp_bytes_compressed; +- // Size of current block being appended. +- uint64_t uncomp_bytes_curr_block; +- // Whether uncomp_bytes_curr_block has been set for next +- // ReapBlock call. +- bool uncomp_bytes_curr_block_set; +- // Input bytes under compression and not appended yet. +- std::atomic<uint64_t> uncomp_bytes_inflight; +- // Number of blocks under compression and not appended yet. +- std::atomic<uint64_t> blocks_inflight; +- // Current compression ratio, maintained by BGWorkWriteMaybeCompressedBlock. +- std::atomic<double> curr_compression_ratio; +- // Estimated SST file size. +- std::atomic<uint64_t> estimated_file_size; +- }; +- FileSizeEstimator file_size_estimator; +- +- // Facilities used for waiting first block completion. Need to Wait for +- // the completion of first block compression and flush to get a non-zero +- // compression ratio. +- std::atomic<bool> first_block_processed; +- std::condition_variable first_block_cond; +- std::mutex first_block_mutex; +- +- explicit ParallelCompressionRep(uint32_t parallel_threads) +- : curr_block_keys(new Keys()), +- block_rep_buf(parallel_threads), +- block_rep_pool(parallel_threads), +- compress_queue(parallel_threads), +- write_queue(parallel_threads), +- first_block_processed(false) { +- for (uint32_t i = 0; i < parallel_threads; i++) { +- block_rep_buf[i].contents = Slice(); +- block_rep_buf[i].compressed_contents = Slice(); +- block_rep_buf[i].data.reset(new std::string()); +- block_rep_buf[i].compressed_data.reset(new std::string()); +- block_rep_buf[i].compression_type = CompressionType(); +- block_rep_buf[i].first_key_in_next_block.reset(new std::string()); +- block_rep_buf[i].keys.reset(new Keys()); +- block_rep_buf[i].slot.reset(new BlockRepSlot()); +- block_rep_buf[i].status = Status::OK(); +- block_rep_pool.push(&block_rep_buf[i]); +- } +- } +- +- ~ParallelCompressionRep() { block_rep_pool.finish(); } +- +- // Make a block prepared to be emitted to compression thread +- // Used in non-buffered mode +- BlockRep* PrepareBlock(CompressionType compression_type, +- const Slice* first_key_in_next_block, +- BlockBuilder* data_block) { +- BlockRep* block_rep = +- PrepareBlockInternal(compression_type, first_key_in_next_block); +- assert(block_rep != nullptr); +- data_block->SwapAndReset(*(block_rep->data)); +- block_rep->contents = *(block_rep->data); +- std::swap(block_rep->keys, curr_block_keys); +- curr_block_keys->Clear(); +- return block_rep; +- } +- +- // Used in EnterUnbuffered +- BlockRep* PrepareBlock(CompressionType compression_type, +- const Slice* first_key_in_next_block, +- std::string* data_block, +- std::vector<std::string>* keys) { +- BlockRep* block_rep = +- PrepareBlockInternal(compression_type, first_key_in_next_block); +- assert(block_rep != nullptr); +- std::swap(*(block_rep->data), *data_block); +- block_rep->contents = *(block_rep->data); +- block_rep->keys->SwapAssign(*keys); +- return block_rep; +- } +- +- // Emit a block to compression thread +- void EmitBlock(BlockRep* block_rep) { +- assert(block_rep != nullptr); +- assert(block_rep->status.ok()); +- if (!write_queue.push(block_rep->slot.get())) { +- return; +- } +- if (!compress_queue.push(block_rep)) { +- return; +- } +- +- if (!first_block_processed.load(std::memory_order_relaxed)) { +- std::unique_lock<std::mutex> lock(first_block_mutex); +- first_block_cond.wait(lock, [this] { +- return first_block_processed.load(std::memory_order_relaxed); +- }); +- } +- } +- +- // Reap a block from compression thread +- void ReapBlock(BlockRep* block_rep) { +- assert(block_rep != nullptr); +- block_rep->compressed_data->clear(); +- block_rep_pool.push(block_rep); +- +- if (!first_block_processed.load(std::memory_order_relaxed)) { +- std::lock_guard<std::mutex> lock(first_block_mutex); +- first_block_processed.store(true, std::memory_order_relaxed); +- first_block_cond.notify_one(); +- } +- } +- +- private: +- BlockRep* PrepareBlockInternal(CompressionType compression_type, +- const Slice* first_key_in_next_block) { +- BlockRep* block_rep = nullptr; +- block_rep_pool.pop(block_rep); +- assert(block_rep != nullptr); +- +- assert(block_rep->data); +- +- block_rep->compression_type = compression_type; +- +- if (first_key_in_next_block == nullptr) { +- block_rep->first_key_in_next_block.reset(nullptr); +- } else { +- block_rep->first_key_in_next_block->assign( +- first_key_in_next_block->data(), first_key_in_next_block->size()); +- } +- +- return block_rep; +- } +-}; + + BlockBasedTableBuilder::BlockBasedTableBuilder( + const BlockBasedTableOptions& table_options, const TableBuilderOptions& tbo, diff --git a/thirdparty/rocksdb/all/patches/cstdint.patch b/thirdparty/rocksdb/all/patches/cstdint.patch deleted file mode 100644 index 2435905c9..000000000 --- a/thirdparty/rocksdb/all/patches/cstdint.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/options/offpeak_time_info.h b/options/offpeak_time_info.h -index 75d61abb4..f42ef6dc2 100644 ---- a/options/offpeak_time_info.h -+++ b/options/offpeak_time_info.h -@@ -5,6 +5,7 @@ - - #pragma once - -+#include <cstdint> - #include <string> - - #include "rocksdb/rocksdb_namespace.h"
