Skip to content

Commit

Permalink
MINIFICPP-2116 - Support GCC13
Browse files Browse the repository at this point in the history
Signed-off-by: Gabor Gyimesi <[email protected]>

This closes #1623
  • Loading branch information
adamdebreceni authored and lordgamez committed Aug 16, 2023
1 parent 14e2586 commit 4307333
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 44 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/gcc13-compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "MiNiFi-CPP verify gcc13 compatibility"
on: [workflow_dispatch]
jobs:
ubuntu_22_04:
name: "ubuntu-22.04-gcc-13"
runs-on: ubuntu-22.04
timeout-minutes: 120
steps:
- id: checkout
uses: actions/checkout@v3
- id: install_deps
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y ccache libfl-dev libpcap-dev libboost-all-dev openjdk-8-jdk maven libusb-1.0-0-dev libpng-dev libgps-dev libsqliteodbc lua5.3 liblua5.3-dev flake8 parallel gcc-13
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts > /dev/null
- name: build
run: |
export CC=gcc-13
export CXX=g++-13
./bootstrap.sh -e -t
cd build
cmake -DUSE_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCI_BUILD=ON -DSTRICT_GSL_CHECKS=AUDIT -DFAIL_ON_WARNINGS=ON -DENABLE_ALL=ON ..
make -j$(nproc) VERBOSE=1
- name: test
id: test
run: |
# Set core file size limit to 1GiB
ulimit -c 1048576
cd build && make test ARGS="--timeout 300 -j8 --output-on-failure"
- name: check-cores
if: ${{ failure() && steps.test.conclusion == 'failure' }}
run: |
if [ "$(ls -A /var/lib/apport/coredump/)" ]; then echo "CORES_EXIST=true" >> $GITHUB_ENV; fi
- uses: actions/[email protected]
if: ${{ failure() && env.CORES_EXIST == 'true' }}
with:
name: ubuntu-coredumps
path: /var/lib/apport/coredump/
- uses: actions/[email protected]
if: ${{ failure() && env.CORES_EXIST == 'true' }}
with:
name: ubuntu-binaries
path: build/bin
4 changes: 2 additions & 2 deletions cmake/Abseil.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set(ABSL_ENABLE_INSTALL ON CACHE INTERNAL "")
set(BUILD_TESTING OFF CACHE STRING "" FORCE)
FetchContent_Declare(
absl
URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz
URL_HASH SHA256=dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4
URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20220623.1.tar.gz
URL_HASH SHA256=91ac87d30cc6d79f9ab974c51874a704de9c2647c40f6932597329a282217ba8
)
FetchContent_MakeAvailable(absl)
16 changes: 11 additions & 5 deletions cmake/BundledAzureSdkCpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
# under the License.

function(use_bundled_libazure SOURCE_DIR BINARY_DIR)
set(PATCH_FILE "${SOURCE_DIR}/thirdparty/azure-sdk-cpp/azure-sdk-cpp-remove-samples.patch")
set(PATCH_FILE1 "${SOURCE_DIR}/thirdparty/azure-sdk-cpp/remove-amqp.patch")
set(PATCH_FILE2 "${SOURCE_DIR}/thirdparty/azure-sdk-cpp/gcc13.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 -N -i \"${PATCH_FILE}\")")
set(PC ${Bash_EXECUTABLE} -c "set -x &&\
(\"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE1}\") &&\
(\"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE2}\") ")
# Define byproducts
set(INSTALL_DIR "${BINARY_DIR}/thirdparty/azure-sdk-cpp-install")
if (WIN32)
Expand Down Expand Up @@ -55,14 +59,16 @@ function(use_bundled_libazure SOURCE_DIR BINARY_DIR)

set(AZURE_SDK_CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS}
-DWARNINGS_AS_ERRORS=OFF
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR})
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}
-DDISABLE_AZURE_CORE_OPENTELEMETRY=ON
-DBUILD_TRANSPORT_CURL=ON)
append_third_party_passthrough_args(AZURE_SDK_CMAKE_ARGS "${AZURE_SDK_CMAKE_ARGS}")

# Build project
ExternalProject_Add(
asdkext # short for azure-sdk-cpp-external due to windows MAX_PATH limitations
URL https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-storage-files-datalake_12.2.0.tar.gz
URL_HASH "SHA256=d4e80ea5e786dc689ddd04825d97ab91f5e1ef2787fa88a3d5ee00f0b820433f"
URL https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-storage-files-datalake_12.7.0.tar.gz
URL_HASH "SHA256=42b9c1df0c15d9e0a3f547eeba8c45708aa86819986da66234e267f4ad728112"
SOURCE_DIR "${BINARY_DIR}/thirdparty/azure-sdk-cpp-src"
INSTALL_DIR "${BINARY_DIR}/thirdparty/azure-sdk-cpp-install"
BUILD_BYPRODUCTS "${AZURESDK_LIBRARIES_LIST}"
Expand Down
2 changes: 2 additions & 0 deletions cmake/GoogleCloudCpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@ if (WIN32)
target_compile_options(google_cloud_cpp_storage PUBLIC /wd4996)
else()
target_compile_options(google_cloud_cpp_storage PUBLIC -Wno-error=deprecated-declarations)
target_compile_options(google_cloud_cpp_rest_internal PUBLIC -Wno-error)
endif()

3 changes: 2 additions & 1 deletion cmake/KubernetesClientC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ set(LWS_WITH_SHARED OFF CACHE BOOL "" FORCE)
set(LWS_OPENSSL_INCLUDE_DIRS "${OPENSSL_INCLUDE_DIR}" CACHE STRING "" FORCE)
set(LWS_OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES}" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "-fpic" CACHE STRING "" FORCE)
set(DISABLE_WERROR ON CACHE STRING "" FORCE)

set(WEBSOCKETS_PATCH_FILE_1 "${CMAKE_SOURCE_DIR}/thirdparty/libwebsockets/fix-include-dirs.patch")
set(WEBSOCKETS_PATCH_FILE_2 "${CMAKE_SOURCE_DIR}/thirdparty/libwebsockets/openssl3.patch")
set(WEBSOCKETS_PC ${Bash_EXECUTABLE} -c "set -x &&\
(${Patch_EXECUTABLE} -R -p1 -s -f --dry-run -i ${WEBSOCKETS_PATCH_FILE_1} || ${Patch_EXECUTABLE} -p1 -i ${WEBSOCKETS_PATCH_FILE_1}) &&\
(${Patch_EXECUTABLE} -R -p1 -s -f --dry-run -i ${WEBSOCKETS_PATCH_FILE_2} || ${Patch_EXECUTABLE} -p1 -i ${WEBSOCKETS_PATCH_FILE_2}) ")
(${Patch_EXECUTABLE} -R -p1 -s -f --dry-run -i ${WEBSOCKETS_PATCH_FILE_2} || ${Patch_EXECUTABLE} -p1 -i ${WEBSOCKETS_PATCH_FILE_2})")
FetchContent_Declare(websockets
URL https://github.com/warmcat/libwebsockets/archive/refs/tags/v4.3.2.tar.gz
URL_HASH SHA256=6a85a1bccf25acc7e8e5383e4934c9b32a102880d1e4c37c70b27ae2a42406e1
Expand Down
1 change: 1 addition & 0 deletions cmake/curl/dummy/FindCURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ if(NOT TARGET CURL::libcurl)
add_library(CURL::libcurl STATIC IMPORTED)
set_target_properties(CURL::libcurl PROPERTIES IMPORTED_LOCATION "${CURL_LIBRARIES}")
set_property(TARGET CURL::libcurl APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
target_compile_definitions(CURL::libcurl INTERFACE CURL_STATICLIB)
endif()
2 changes: 1 addition & 1 deletion extensions/azure/storage/BlobStorageClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <vector>
#include <memory>

#include "azure/storage/blobs/protocol/blob_rest_client.hpp"
#include "azure/storage/blobs/blob_responses.hpp"
#include "AzureStorageCredentials.h"
#include "utils/gsl.h"
#include "utils/Enum.h"
Expand Down
2 changes: 1 addition & 1 deletion extensions/azure/storage/DataLakeStorageClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "utils/gsl.h"
#include "io/InputStream.h"
#include "azure/storage/files/datalake/protocol/datalake_rest_client.hpp"
#include "azure/storage/files/datalake/datalake_responses.hpp"
#include "utils/Enum.h"
#include "utils/RegexUtils.h"

Expand Down
2 changes: 1 addition & 1 deletion extensions/http-curl/tests/HTTPHandlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class FlowFileResponder : public ServerAwareHandler {
}
flow->attributes[name] = value;
}
uint64_t length;
uint64_t length{};
{
const auto read = stream.read(length);
if (!isServerRunning()) return false;
Expand Down
5 changes: 1 addition & 4 deletions extensions/sftp/client/SFTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,10 @@ bool SFTPClient::connect() {
/* Getting socket from curl */
#ifdef WIN32
curl_socket_t sockfd;
/* Only CURLINFO_ACTIVESOCKET works on Win64 */
curl_res = curl_easy_getinfo(easy_, CURLINFO_ACTIVESOCKET, &sockfd);
#else
long sockfd; // NOLINT(runtime/int) long due to libcurl API
/* Some older cURL versions only support CURLINFO_LASTSOCKET */
curl_res = curl_easy_getinfo(easy_, CURLINFO_LASTSOCKET, &sockfd);
#endif
curl_res = curl_easy_getinfo(easy_, CURLINFO_ACTIVESOCKET, &sockfd);
if (curl_res != CURLE_OK) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/sftp/processors/ListSFTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,9 @@ void ListSFTP::listByTrackingTimestamps(
/* Determine the minimum reliable timestamp based on precision */
auto minimum_reliable_timestamp = now - listing_lag;
if (remote_system_timestamp_precision == TARGET_SYSTEM_TIMESTAMP_PRECISION_SECONDS) {
std::chrono::floor<std::chrono::seconds>(minimum_reliable_timestamp);
minimum_reliable_timestamp = std::chrono::floor<std::chrono::seconds>(minimum_reliable_timestamp);
} else {
std::chrono::floor<std::chrono::minutes>(minimum_reliable_timestamp);
minimum_reliable_timestamp = std::chrono::floor<std::chrono::minutes>(minimum_reliable_timestamp);
}
/* If the latest timestamp is not old enough, we wait another cycle */
if (latest_listed_entry_timestamp_this_cycle && minimum_reliable_timestamp < latest_listed_entry_timestamp_this_cycle) {
Expand Down
4 changes: 3 additions & 1 deletion libminifi/include/core/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ class StaticClassType {
getClassLoader().unregisterClass(construction_name);
}
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdangling-reference"
static const StaticClassType& get(const std::string& name, const std::vector<std::string>& construction_names) {
static const StaticClassType instance(name, construction_names);
return instance;
}
#pragma GCC diagnostic pop

private:
std::string name_;
Expand Down
2 changes: 1 addition & 1 deletion libminifi/src/utils/TimeUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void setClock(std::shared_ptr<SteadyClock> clock) {

std::optional<std::chrono::system_clock::time_point> parseRfc3339(const std::string& str) {
std::istringstream stream(str);
date::year_month_day date_part;
date::year_month_day date_part{};
date::from_stream(stream, "%F", date_part);

if (stream.fail())
Expand Down
3 changes: 1 addition & 2 deletions libminifi/test/TestBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ std::shared_ptr<LogTestController> LogTestController::getInstance(const std::sha
} else {
// in practice I'd use a derivation here or another paradigm entirely but for the purposes of this test code
// having extra overhead is negligible. this is the most readable and least impactful way
auto instance = std::shared_ptr<LogTestController>(new LogTestController(logger_properties));
map.insert(std::make_pair(logger_properties, instance));
map.insert(std::make_pair(logger_properties, std::shared_ptr<LogTestController>(new LogTestController(logger_properties))));
return map.find(logger_properties)->second;
}
}
Expand Down
23 changes: 0 additions & 23 deletions thirdparty/azure-sdk-cpp/azure-sdk-cpp-remove-samples.patch

This file was deleted.

44 changes: 44 additions & 0 deletions thirdparty/azure-sdk-cpp/gcc13.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff '--color=auto' -rupN azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0/sdk/core/azure-core/inc/azure/core/base64.hpp azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0-patched/sdk/core/azure-core/inc/azure/core/base64.hpp
--- azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0/sdk/core/azure-core/inc/azure/core/base64.hpp 2023-07-11 04:18:12.000000000 +0200
+++ azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0-patched/sdk/core/azure-core/inc/azure/core/base64.hpp 2023-07-31 10:24:28.267049474 +0200
@@ -13,6 +13,7 @@
#include <stdexcept>
#include <string>
#include <vector>
+#include <cstdint>

namespace Azure { namespace Core {

diff '--color=auto' -rupN azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0/sdk/core/azure-core/inc/azure/core/uuid.hpp azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0-patched/sdk/core/azure-core/inc/azure/core/uuid.hpp
--- azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0/sdk/core/azure-core/inc/azure/core/uuid.hpp 2023-07-11 04:18:12.000000000 +0200
+++ azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0-patched/sdk/core/azure-core/inc/azure/core/uuid.hpp 2023-07-31 10:29:58.670195225 +0200
@@ -13,6 +13,7 @@
#include <array>
#include <cstring>
#include <string>
+#include <cstdint>

namespace Azure { namespace Core {
/**
diff '--color=auto' -rupN azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0/sdk/keyvault/azure-security-keyvault-keys/src/private/key_sign_parameters.hpp azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0-patched/sdk/keyvault/azure-security-keyvault-keys/src/private/key_sign_parameters.hpp
--- azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0/sdk/keyvault/azure-security-keyvault-keys/src/private/key_sign_parameters.hpp 2023-07-11 04:18:12.000000000 +0200
+++ azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0-patched/sdk/keyvault/azure-security-keyvault-keys/src/private/key_sign_parameters.hpp 2023-07-31 10:42:25.125314240 +0200
@@ -11,6 +11,7 @@

#include <string>
#include <vector>
+#include <cstdint>

namespace Azure {
namespace Security {
diff '--color=auto' -rupN azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0/sdk/keyvault/azure-security-keyvault-keys/src/private/key_verify_parameters.hpp azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0-patched/sdk/keyvault/azure-security-keyvault-keys/src/private/key_verify_parameters.hpp
--- azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0/sdk/keyvault/azure-security-keyvault-keys/src/private/key_verify_parameters.hpp 2023-07-11 04:18:12.000000000 +0200
+++ azure-sdk-for-cpp-azure-storage-files-datalake_12.7.0-patched/sdk/keyvault/azure-security-keyvault-keys/src/private/key_verify_parameters.hpp 2023-07-31 11:02:08.775192072 +0200
@@ -11,6 +11,7 @@

#include <string>
#include <vector>
+#include <cstdint>

namespace Azure {
namespace Security {
15 changes: 15 additions & 0 deletions thirdparty/azure-sdk-cpp/remove-amqp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff -rupN a/sdk/core/CMakeLists.txt b/sdk/core/CMakeLists.txt
--- a/sdk/core/CMakeLists.txt 2023-07-11 04:18:12.000000000 +0200
+++ b/sdk/core/CMakeLists.txt 2023-07-25 16:58:17.919348377 +0200
@@ -10,11 +10,6 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

add_subdirectory(azure-core)

-if (NOT BUILD_WINDOWS_UWP)
- message(STATUS "Including AMQP library")
- add_subdirectory(azure-core-amqp)
-endif()
-
if (NOT DISABLE_AZURE_CORE_OPENTELEMETRY)
add_subdirectory(azure-core-tracing-opentelemetry)
endif()

0 comments on commit 4307333

Please sign in to comment.