From fcd624b2decb67559aa17640a736678984376ac7 Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Sat, 11 Apr 2026 15:51:57 -0300 Subject: [PATCH 01/10] chore: upgrade corrade to cci.20260327 to fix macOS build Pin corrade to commit 22e7ffc6 (2026-03-27) via a local conan recipe, replacing the old 2020.06 release which fails to compile on modern macOS. Update PluginManager API usage across all plugin headers to match the new corrade API (StringView constructor params, Array search paths, StringView pluginInterface). Update CoreRegistry.cpp to handle StringView/StringIterable return types from pluginList() and provides(). Remove the -include vector macOS workaround from CI and add a conan export step for the local recipe to all build workflows. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build-develop.yml | 20 +- .github/workflows/build-release.yml | 5 +- .github/workflows/build_cross.yml | 3 + .github/workflows/build_debug.yml | 5 +- conan/corrade/cmake/conan-corrade-vars.cmake | 60 ++++++ conan/corrade/conandata.yml | 4 + conan/corrade/conanfile.py | 193 ++++++++++++++++++ conanfile.py | 4 +- src/AbstractPlugin.h | 8 +- src/CoreRegistry.cpp | 21 +- src/HandlerModulePlugin.h | 10 +- src/InputModulePlugin.h | 10 +- src/handlers/bgp/BgpHandlerModulePlugin.h | 2 +- src/handlers/dhcp/DhcpHandlerModulePlugin.h | 2 +- src/handlers/dns/v1/DnsHandlerModulePlugin.h | 2 +- src/handlers/dns/v2/DnsHandlerModulePlugin.h | 2 +- src/handlers/flow/FlowHandlerModulePlugin.h | 2 +- .../InputResourcesHandlerModulePlugin.h | 2 +- src/handlers/mock/MockHandlerModulePlugin.h | 2 +- src/handlers/net/v1/NetHandlerModulePlugin.h | 2 +- src/handlers/net/v2/NetHandlerModulePlugin.h | 2 +- .../netprobe/NetProbeHandlerModulePlugin.h | 2 +- src/handlers/pcap/PcapHandlerModulePlugin.h | 2 +- src/inputs/dnstap/DnstapInputModulePlugin.h | 2 +- src/inputs/flow/FlowInputModulePlugin.h | 2 +- src/inputs/mock/MockInputModulePlugin.h | 2 +- .../netprobe/NetProbeInputModulePlugin.h | 2 +- src/inputs/pcap/PcapInputModulePlugin.h | 2 +- 28 files changed, 329 insertions(+), 46 deletions(-) create mode 100644 conan/corrade/cmake/conan-corrade-vars.cmake create mode 100644 conan/corrade/conandata.yml create mode 100644 conan/corrade/conanfile.py diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index 58aaaec1e..f8f7df705 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -43,16 +43,19 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} restore-keys: conan-${{ runner.os }}- - + - name: Detect Conan Profile run: conan profile detect -f + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/build - run: PKG_CONFIG_PATH=${{github.workspace}}/local/lib/pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake -DCONAN_INSTALL_ARGS="--build=missing;-c=corrade/*:tools.build:cxxflags=['-include','vector']" + run: PKG_CONFIG_PATH=${{github.workspace}}/local/lib/pkgconfig cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake -DCONAN_INSTALL_ARGS="--build=missing" - name: Build working-directory: ${{github.workspace}}/build @@ -83,9 +86,12 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} restore-keys: conan-${{ runner.os }}-amd64- + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/build @@ -131,9 +137,13 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} restore-keys: conan-${{ runner.os }}- + - name: Export local Corrade recipe + shell: bash + run: conan export $GITHUB_WORKSPACE/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}\build diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 19c036c5e..34c38f106 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -36,9 +36,12 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} restore-keys: conan-${{ runner.os }}- + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/build diff --git a/.github/workflows/build_cross.yml b/.github/workflows/build_cross.yml index 1dda4a7a4..fc8c65ea5 100644 --- a/.github/workflows/build_cross.yml +++ b/.github/workflows/build_cross.yml @@ -122,6 +122,9 @@ jobs: key: conan-${{ runner.os }}-${{matrix.arch}}-${{ hashFiles('**/conanfile.py') }} restore-keys: conan-${{ runner.os }}-${{matrix.arch}}- + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/src/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Install dependencies working-directory: ${{github.workspace}}/src run: | diff --git a/.github/workflows/build_debug.yml b/.github/workflows/build_debug.yml index f9941dbe5..a7207bf92 100644 --- a/.github/workflows/build_debug.yml +++ b/.github/workflows/build_debug.yml @@ -28,7 +28,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} restore-keys: conan-${{ runner.os }}-amd64- - name: linux package install @@ -36,6 +36,9 @@ jobs: sudo apt-get update sudo apt-get install --yes --no-install-recommends jq lcov + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}/build diff --git a/conan/corrade/cmake/conan-corrade-vars.cmake b/conan/corrade/cmake/conan-corrade-vars.cmake new file mode 100644 index 000000000..cc7a73f98 --- /dev/null +++ b/conan/corrade/cmake/conan-corrade-vars.cmake @@ -0,0 +1,60 @@ +# Here we are reproducing the variables and call performed by the FindCorrade.cmake provided by the library + +# Read flags from configuration +file(READ "${CMAKE_CURRENT_LIST_DIR}/../../include/Corrade/configure.h" _corradeConfigure) +string(REGEX REPLACE ";" "\\\\;" _corradeConfigure "${_corradeConfigure}") +string(REGEX REPLACE "\n" ";" _corradeConfigure "${_corradeConfigure}") +set(_corradeFlags + MSVC2015_COMPATIBILITY + MSVC2017_COMPATIBILITY + MSVC2019_COMPATIBILITY + BUILD_DEPRECATED + BUILD_STATIC + BUILD_STATIC_UNIQUE_GLOBALS + BUILD_MULTITHREADED + TARGET_UNIX + TARGET_APPLE + TARGET_IOS + TARGET_IOS_SIMULATOR + TARGET_WINDOWS + TARGET_WINDOWS_RT + TARGET_EMSCRIPTEN + TARGET_ANDROID + # TARGET_X86 etc and TARGET_LIBCXX are not exposed to CMake as the meaning + # is unclear on platforms with multi-arch binaries or when mixing different + # STL implementations. TARGET_GCC etc are figured out via UseCorrade.cmake, + # as the compiler can be different when compiling the lib & when using it. + PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT + TESTSUITE_TARGET_XCTEST + UTILITY_USE_ANSI_COLORS) +foreach(_corradeFlag ${_corradeFlags}) + list(FIND _corradeConfigure "#define CORRADE_${_corradeFlag}" _corrade_${_corradeFlag}) + if(NOT _corrade_${_corradeFlag} EQUAL -1) + set(CORRADE_${_corradeFlag} 1) + endif() +endforeach() + + +# Corrade::rc, a target with just an executable +if(NOT TARGET Corrade::rc) + if(CMAKE_CROSSCOMPILING) + find_program(CORRADE_RC_PROGRAM + NAMES corrade-rc + PATHS ENV + PATH NO_DEFAULT_PATH) + else() + find_program(CORRADE_RC_PROGRAM + NAMES corrade-rc + PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/" + NO_DEFAULT_PATH) + endif() + + get_filename_component(CORRADE_RC_PROGRAM "${CORRADE_RC_PROGRAM}" ABSOLUTE) + + add_executable(Corrade::rc IMPORTED) + set_property(TARGET Corrade::rc PROPERTY IMPORTED_LOCATION ${CORRADE_RC_PROGRAM}) +endif() + +# Include and declare other build modules +include("${CMAKE_CURRENT_LIST_DIR}/UseCorrade.cmake") +set(CORRADE_LIB_SUFFIX_MODULE "${CMAKE_CURRENT_LIST_DIR}/CorradeLibSuffix.cmake") diff --git a/conan/corrade/conandata.yml b/conan/corrade/conandata.yml new file mode 100644 index 000000000..04a27772f --- /dev/null +++ b/conan/corrade/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20260327": + sha256: d8f30e9a857172003b6b02304783f40e8038c36e4127a0cfec7fe14f41c13fd4 + url: https://github.com/mosra/corrade/archive/22e7ffc6fcdeaa0df96e0d8b3d482ad6abe7dc36.tar.gz diff --git a/conan/corrade/conanfile.py b/conan/corrade/conanfile.py new file mode 100644 index 000000000..52999ed78 --- /dev/null +++ b/conan/corrade/conanfile.py @@ -0,0 +1,193 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc, check_min_vs + +required_conan_version = ">=1.52.0" + + +class CorradeConan(ConanFile): + name = "corrade" + description = "Corrade is a multiplatform utility library written in C++11/C++14." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://magnum.graphics/corrade" + topics = ("magnum", "filesystem", "console", "environment", "os") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_deprecated": [True, False], + "with_interconnect": [True, False], + "with_main": [True, False], + "with_pluginmanager": [True, False], + "with_testsuite": [True, False], + "with_utility": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_deprecated": True, + "with_interconnect": True, + "with_main": True, + "with_pluginmanager": True, + "with_testsuite": True, + "with_utility": True, + } + + def export_sources(self): + copy(self, "cmake/*", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_vs(self, 190) + if not self.options.with_utility and ( + self.options.with_testsuite or self.options.with_interconnect or self.options.with_pluginmanager + ): + raise ConanInvalidConfiguration( + "Component 'utility' is required for 'test_suite', 'interconnect' and 'plugin_manager'" + ) + + def build_requirements(self): + if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): + self.tool_requires(f"corrade/{self.version}") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False) + + tc.variables["BUILD_DEPRECATED"] = self.options.build_deprecated + tc.variables["WITH_INTERCONNECT"] = self.options.with_interconnect + tc.variables["WITH_MAIN"] = self.options.with_main + tc.variables["WITH_PLUGINMANAGER"] = self.options.with_pluginmanager + tc.variables["WITH_TESTSUITE"] = self.options.with_testsuite + tc.variables["WITH_UTILITY"] = self.options.with_utility + tc.variables["WITH_RC"] = self.options.with_utility + + # Corrade uses suffix on the resulting "lib"-folder when running cmake.install() + # Set it explicitly to empty, else Corrade might set it implicitly (eg. to "64") + tc.variables["LIB_SUFFIX"] = "" + + if is_msvc(self): + if check_min_vs(self, 193, raise_invalid=False): + tc.variables["MSVC2019_COMPATIBILITY"] = True + elif check_min_vs(self, 192, raise_invalid=False): + tc.variables["MSVC2017_COMPATIBILITY"] = True + elif check_min_vs(self, 191, raise_invalid=False): + tc.variables["MSVC2015_COMPATIBILITY"] = True + + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + share_cmake = os.path.join(self.package_folder, "share", "cmake", "Corrade") + copy(self, "UseCorrade.cmake", + src=share_cmake, + dst=os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "CorradeLibSuffix.cmake", + src=share_cmake, + dst=os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "*.cmake", + src=os.path.join(self.export_sources_folder, "cmake"), + dst=os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "Corrade") + self.cpp_info.set_property("cmake_target_name", "Corrade::Corrade") + + suffix = "-d" if self.settings.build_type == "Debug" else "" + + cmake_modules = [ + # Reproduces the variables and calls performed by the FindCorrade.cmake provided by the library + os.path.join("lib", "cmake", "conan-corrade-vars.cmake"), + # Autodetects LIB_SUFFIX (either "64" or "") + os.path.join("lib", "cmake", "CorradeLibSuffix.cmake"), + # Exports build flags and macros + os.path.join("lib", "cmake", "UseCorrade.cmake"), + ] + self.cpp_info.set_property("cmake_build_modules", cmake_modules) + self.cpp_info.components["_corrade"].build_modules["cmake_find_package"] = cmake_modules + self.cpp_info.components["_corrade"].build_modules["cmake_find_package_multi"] = cmake_modules + + if self.options.with_main: + self.cpp_info.components["main"].set_property("cmake_target_name", "Corrade::Main") + self.cpp_info.components["main"].names["cmake_find_package"] = "Main" + self.cpp_info.components["main"].names["cmake_find_package_multi"] = "Main" + if self.settings.os == "Windows": + self.cpp_info.components["main"].libs = ["CorradeMain" + suffix] + self.cpp_info.components["main"].requires = ["_corrade"] + + if self.options.with_utility: + self.cpp_info.components["utility"].set_property("cmake_target_name", "Corrade::Utility") + self.cpp_info.components["utility"].names["cmake_find_package"] = "Utility" + self.cpp_info.components["utility"].names["cmake_find_package_multi"] = "Utility" + self.cpp_info.components["utility"].libs = ["CorradeUtility" + suffix] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["utility"].system_libs = ["m", "dl"] + self.cpp_info.components["utility"].requires = ["_corrade"] + + if self.options.with_interconnect: + self.cpp_info.components["interconnect"].set_property("cmake_target_name", "Corrade::Interconnect") + self.cpp_info.components["interconnect"].names["cmake_find_package"] = "Interconnect" + self.cpp_info.components["interconnect"].names["cmake_find_package_multi"] = "Interconnect" + self.cpp_info.components["interconnect"].libs = ["CorradeInterconnect" + suffix] + self.cpp_info.components["interconnect"].requires = ["utility"] + + if self.options.with_pluginmanager: + self.cpp_info.components["plugin_manager"].set_property("cmake_target_name", "Corrade::PluginManager") + self.cpp_info.components["plugin_manager"].names["cmake_find_package"] = "PluginManager" + self.cpp_info.components["plugin_manager"].names["cmake_find_package_multi"] = "PluginManager" + self.cpp_info.components["plugin_manager"].libs = ["CorradePluginManager" + suffix] + self.cpp_info.components["plugin_manager"].requires = ["utility"] + + if self.options.with_testsuite: + self.cpp_info.components["test_suite"].set_property("cmake_target_name", "Corrade::TestSuite") + self.cpp_info.components["test_suite"].names["cmake_find_package"] = "TestSuite" + self.cpp_info.components["test_suite"].names["cmake_find_package_multi"] = "TestSuite" + self.cpp_info.components["test_suite"].libs = ["CorradeTestSuite" + suffix] + self.cpp_info.components["test_suite"].requires = ["utility"] + + if self.options.with_utility: + bindir = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH environment variable: {bindir}") + self.env_info.PATH.append(bindir) + + # pkg_config: Add more explicit naming to generated files (avoid filesystem collision). + for key, component in self.cpp_info.components.items(): + component.set_property("pkg_config_name", f"{self.name}_{key}") + + self.cpp_info.names["cmake_find_package"] = "Corrade" + self.cpp_info.names["cmake_find_package_multi"] = "Corrade" diff --git a/conanfile.py b/conanfile.py index ec77c2cbc..4c9b5aee3 100644 --- a/conanfile.py +++ b/conanfile.py @@ -8,7 +8,7 @@ class Pktvisor(ConanFile): def requirements(self): self.requires("catch2/3.14.0") - self.requires("corrade/2020.06") + self.requires("corrade/cci.20260327") self.requires("cpp-httplib/0.18.3") self.requires("docopt.cpp/0.6.3") self.requires("fast-cpp-csv-parser/cci.20240102") @@ -37,7 +37,7 @@ def requirements(self): self.requires("sentry-crashpad/0.6.5") def build_requirements(self): - self.tool_requires("corrade/2020.06") + self.tool_requires("corrade/cci.20260327") self.tool_requires("protobuf/6.33.5") def layout(self): diff --git a/src/AbstractPlugin.h b/src/AbstractPlugin.h index 6377b6ac4..d42581676 100644 --- a/src/AbstractPlugin.h +++ b/src/AbstractPlugin.h @@ -4,6 +4,8 @@ #pragma once +#include +#include #include #include #include @@ -69,12 +71,12 @@ class AbstractPlugin : public Corrade::PluginManager::AbstractPlugin } public: - static std::vector pluginSearchPaths() + static Corrade::Containers::Array pluginSearchPaths() { - return {""}; + return {Corrade::Containers::InPlaceInit, {""}}; } - explicit AbstractPlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit AbstractPlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : Corrade::PluginManager::AbstractPlugin{manager, plugin} { } diff --git a/src/CoreRegistry.cpp b/src/CoreRegistry.cpp index 408f8c1dd..97eeddb4f 100644 --- a/src/CoreRegistry.cpp +++ b/src/CoreRegistry.cpp @@ -8,6 +8,7 @@ #include "InputStreamManager.h" #include "Policies.h" #include "Taps.h" +#include #include #include #include @@ -47,12 +48,12 @@ void CoreRegistry::start(HttpServer *svr) for (auto &s : plugin_list) { auto meta = _input_registry.metadata(s); if (!meta) { - _logger->error("failed to load plugin metadata: {}", s); + _logger->error("failed to load plugin metadata: {}", std::string(s)); continue; } if (meta->data().hasValue("type") && meta->data().value("type") == "input") { if (!meta->data().hasValue("version")) { - _logger->error("version field is mandatory and was not provided by '{}'", s); + _logger->error("version field is mandatory and was not provided by '{}'", std::string(s)); } auto version = meta->data().value("version"); if (_input_registry.loadState(s) == Corrade::PluginManager::LoadState::NotLoaded) { @@ -60,11 +61,11 @@ void CoreRegistry::start(HttpServer *svr) } for (const auto &alias : meta->provides()) { InputPluginPtr mod = _input_registry.instantiate(alias); - _logger->info("Load input stream plugin: {} version {} interface {}", alias, version, mod->pluginInterface()); + _logger->info("Load input stream plugin: {} version {} interface {}", std::string(alias), version, std::string(mod->pluginInterface())); mod->init_plugin(this, svr, &geo::GeoIP(), &geo::GeoASN()); - auto result = _input_plugins.insert({std::make_pair(alias, version), std::move(mod)}); + auto result = _input_plugins.insert({std::make_pair(std::string(alias), version), std::move(mod)}); if (!result.second) { - throw std::runtime_error(fmt::format("Input alias '{}' with version '{}' was already loaded.", alias, version)); + throw std::runtime_error(fmt::format("Input alias '{}' with version '{}' was already loaded.", std::string(alias), version)); } } } @@ -77,7 +78,7 @@ void CoreRegistry::start(HttpServer *svr) for (auto &s : plugin_list) { auto meta = _handler_registry.metadata(s); if (!meta) { - _logger->error("failed to load plugin metadata: {}", s); + _logger->error("failed to load plugin metadata: {}", std::string(s)); continue; } if (meta->data().hasValue("type") && meta->data().value("type") == "handler") { @@ -85,16 +86,16 @@ void CoreRegistry::start(HttpServer *svr) _handler_registry.load(s); } if (!meta->data().hasValue("version")) { - _logger->error("version field is mandatory and was not provided by '{}'", s); + _logger->error("version field is mandatory and was not provided by '{}'", std::string(s)); } auto version = meta->data().value("version"); for (const auto &alias : meta->provides()) { HandlerPluginPtr mod = _handler_registry.instantiate(s); - _logger->info("Load stream handler plugin: {} version {} interface {}", alias, version, mod->pluginInterface()); + _logger->info("Load stream handler plugin: {} version {} interface {}", std::string(alias), version, std::string(mod->pluginInterface())); mod->init_plugin(this, svr, &geo::GeoIP(), &geo::GeoASN()); - auto result = _handler_plugins.insert({std::make_pair(alias, version), std::move(mod)}); + auto result = _handler_plugins.insert({std::make_pair(std::string(alias), version), std::move(mod)}); if (!result.second) { - throw std::runtime_error(fmt::format("Handler alias '{}' with version '{}' was already loaded.", alias, version)); + throw std::runtime_error(fmt::format("Handler alias '{}' with version '{}' was already loaded.", std::string(alias), version)); } } } diff --git a/src/HandlerModulePlugin.h b/src/HandlerModulePlugin.h index 7e1d19f71..9cc8835bf 100644 --- a/src/HandlerModulePlugin.h +++ b/src/HandlerModulePlugin.h @@ -5,6 +5,8 @@ #pragma once #include "AbstractPlugin.h" +#include +#include #include #include #include @@ -21,17 +23,17 @@ class HandlerModulePlugin : public AbstractPlugin static geo::MaxmindDB *asn; static geo::MaxmindDB *city; - static std::string pluginInterface() + static Corrade::Containers::StringView pluginInterface() { return "visor.module.handler/1.0"; } - static std::vector pluginSearchPaths() + static Corrade::Containers::Array pluginSearchPaths() { - return {""}; + return {Corrade::Containers::InPlaceInit, {""}}; } - explicit HandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit HandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : AbstractPlugin{manager, plugin} { } diff --git a/src/InputModulePlugin.h b/src/InputModulePlugin.h index d11ddbbcf..058676927 100644 --- a/src/InputModulePlugin.h +++ b/src/InputModulePlugin.h @@ -5,6 +5,8 @@ #pragma once #include "AbstractPlugin.h" +#include +#include #include #include #include @@ -18,17 +20,17 @@ class InputModulePlugin : public AbstractPlugin { public: - static std::string pluginInterface() + static Corrade::Containers::StringView pluginInterface() { return "visor.module.input/1.0"; } - static std::vector pluginSearchPaths() + static Corrade::Containers::Array pluginSearchPaths() { - return {""}; + return {Corrade::Containers::InPlaceInit, {""}}; } - explicit InputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit InputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : AbstractPlugin{manager, plugin} { } diff --git a/src/handlers/bgp/BgpHandlerModulePlugin.h b/src/handlers/bgp/BgpHandlerModulePlugin.h index 85206fd22..b90ce0e61 100644 --- a/src/handlers/bgp/BgpHandlerModulePlugin.h +++ b/src/handlers/bgp/BgpHandlerModulePlugin.h @@ -15,7 +15,7 @@ class BgpHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit BgpHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit BgpHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/dhcp/DhcpHandlerModulePlugin.h b/src/handlers/dhcp/DhcpHandlerModulePlugin.h index 0f48f3298..5a8705b76 100644 --- a/src/handlers/dhcp/DhcpHandlerModulePlugin.h +++ b/src/handlers/dhcp/DhcpHandlerModulePlugin.h @@ -15,7 +15,7 @@ class DhcpHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit DhcpHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit DhcpHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/dns/v1/DnsHandlerModulePlugin.h b/src/handlers/dns/v1/DnsHandlerModulePlugin.h index f6001f0dd..c2ff8579f 100644 --- a/src/handlers/dns/v1/DnsHandlerModulePlugin.h +++ b/src/handlers/dns/v1/DnsHandlerModulePlugin.h @@ -15,7 +15,7 @@ class DnsHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit DnsHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit DnsHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/dns/v2/DnsHandlerModulePlugin.h b/src/handlers/dns/v2/DnsHandlerModulePlugin.h index 6cbebc92d..7182b5824 100644 --- a/src/handlers/dns/v2/DnsHandlerModulePlugin.h +++ b/src/handlers/dns/v2/DnsHandlerModulePlugin.h @@ -15,7 +15,7 @@ class DnsHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit DnsHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit DnsHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/flow/FlowHandlerModulePlugin.h b/src/handlers/flow/FlowHandlerModulePlugin.h index ca1b6d742..80c1064fa 100644 --- a/src/handlers/flow/FlowHandlerModulePlugin.h +++ b/src/handlers/flow/FlowHandlerModulePlugin.h @@ -15,7 +15,7 @@ class FlowHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit FlowHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit FlowHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/input_resources/InputResourcesHandlerModulePlugin.h b/src/handlers/input_resources/InputResourcesHandlerModulePlugin.h index f9958b27f..de3b9b81b 100644 --- a/src/handlers/input_resources/InputResourcesHandlerModulePlugin.h +++ b/src/handlers/input_resources/InputResourcesHandlerModulePlugin.h @@ -15,7 +15,7 @@ class InputResourcesHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit InputResourcesHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit InputResourcesHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/mock/MockHandlerModulePlugin.h b/src/handlers/mock/MockHandlerModulePlugin.h index d75a83ab3..93aa9783f 100644 --- a/src/handlers/mock/MockHandlerModulePlugin.h +++ b/src/handlers/mock/MockHandlerModulePlugin.h @@ -15,7 +15,7 @@ class MockHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit MockHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit MockHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/net/v1/NetHandlerModulePlugin.h b/src/handlers/net/v1/NetHandlerModulePlugin.h index b8cd02ca9..bd1667c10 100644 --- a/src/handlers/net/v1/NetHandlerModulePlugin.h +++ b/src/handlers/net/v1/NetHandlerModulePlugin.h @@ -15,7 +15,7 @@ class NetHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit NetHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit NetHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/net/v2/NetHandlerModulePlugin.h b/src/handlers/net/v2/NetHandlerModulePlugin.h index 6ef260326..5b3d1fab8 100644 --- a/src/handlers/net/v2/NetHandlerModulePlugin.h +++ b/src/handlers/net/v2/NetHandlerModulePlugin.h @@ -15,7 +15,7 @@ class NetHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit NetHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit NetHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/netprobe/NetProbeHandlerModulePlugin.h b/src/handlers/netprobe/NetProbeHandlerModulePlugin.h index ca510bb1e..a77bcb38d 100644 --- a/src/handlers/netprobe/NetProbeHandlerModulePlugin.h +++ b/src/handlers/netprobe/NetProbeHandlerModulePlugin.h @@ -15,7 +15,7 @@ class NetProbeHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit NetProbeHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit NetProbeHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/handlers/pcap/PcapHandlerModulePlugin.h b/src/handlers/pcap/PcapHandlerModulePlugin.h index 71b286bb1..44a44c591 100644 --- a/src/handlers/pcap/PcapHandlerModulePlugin.h +++ b/src/handlers/pcap/PcapHandlerModulePlugin.h @@ -15,7 +15,7 @@ class PcapHandlerModulePlugin : public HandlerModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit PcapHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit PcapHandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::HandlerModulePlugin{manager, plugin} { } diff --git a/src/inputs/dnstap/DnstapInputModulePlugin.h b/src/inputs/dnstap/DnstapInputModulePlugin.h index ae5050502..e4183664b 100644 --- a/src/inputs/dnstap/DnstapInputModulePlugin.h +++ b/src/inputs/dnstap/DnstapInputModulePlugin.h @@ -15,7 +15,7 @@ class DnstapInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit DnstapInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit DnstapInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } diff --git a/src/inputs/flow/FlowInputModulePlugin.h b/src/inputs/flow/FlowInputModulePlugin.h index ee3d76028..9a8507ed7 100644 --- a/src/inputs/flow/FlowInputModulePlugin.h +++ b/src/inputs/flow/FlowInputModulePlugin.h @@ -16,7 +16,7 @@ class FlowInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit FlowInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit FlowInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } diff --git a/src/inputs/mock/MockInputModulePlugin.h b/src/inputs/mock/MockInputModulePlugin.h index 610a66ab0..d1cb0e8f8 100644 --- a/src/inputs/mock/MockInputModulePlugin.h +++ b/src/inputs/mock/MockInputModulePlugin.h @@ -16,7 +16,7 @@ class MockInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit MockInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit MockInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } diff --git a/src/inputs/netprobe/NetProbeInputModulePlugin.h b/src/inputs/netprobe/NetProbeInputModulePlugin.h index c5af5bec7..324e59404 100644 --- a/src/inputs/netprobe/NetProbeInputModulePlugin.h +++ b/src/inputs/netprobe/NetProbeInputModulePlugin.h @@ -16,7 +16,7 @@ class NetProbeInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit NetProbeInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit NetProbeInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } diff --git a/src/inputs/pcap/PcapInputModulePlugin.h b/src/inputs/pcap/PcapInputModulePlugin.h index 451c9b11d..4b48ce3be 100644 --- a/src/inputs/pcap/PcapInputModulePlugin.h +++ b/src/inputs/pcap/PcapInputModulePlugin.h @@ -17,7 +17,7 @@ class PcapInputModulePlugin : public visor::InputModulePlugin void setup_routes(HttpServer *svr) override; public: - explicit PcapInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin) + explicit PcapInputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) : visor::InputModulePlugin{manager, plugin} { } From dd2d994d695ae72a2cdb7c66959089491a0f674a Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Sat, 11 Apr 2026 16:08:22 -0300 Subject: [PATCH 02/10] fix: resolve corrade API compatibility issues found during local build verification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use Corrade::InPlaceInit (not Containers::InPlaceInit, which is deprecated) - Wrap StringView returns with std::string() for spdlog/fmt logging and map keys - Add PointerStl.h for Pointer → unique_ptr implicit conversion - Add Macros.h + AbstractManager.h to static_plugins.h for CORRADE_AUTOMATIC_INITIALIZER - Add StringStl.h + std::string() wraps in main.cpp for pluginList() logging - Use _s literal suffix in pluginInterface() to set Global StringViewFlag (required by new corrade at runtime) Co-Authored-By: Claude Sonnet 4.6 --- cmd/pktvisord/main.cpp | 5 +++-- src/AbstractPlugin.cpp | 6 +++--- src/AbstractPlugin.h | 2 +- src/CoreRegistry.cpp | 1 + src/HandlerModulePlugin.h | 5 +++-- src/InputModulePlugin.h | 5 +++-- src/Policies.cpp | 2 +- src/handlers/static_plugins.h | 3 +++ src/inputs/static_plugins.h | 3 +++ 9 files changed, 21 insertions(+), 11 deletions(-) diff --git a/cmd/pktvisord/main.cpp b/cmd/pktvisord/main.cpp index 60c3bbed9..2044f5d55 100644 --- a/cmd/pktvisord/main.cpp +++ b/cmd/pktvisord/main.cpp @@ -17,6 +17,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wattributes" #endif +#include #include #ifdef __GNUC__ #pragma GCC diagnostic pop @@ -652,13 +653,13 @@ int main(int argc, char *argv[]) for (auto &p : registry.input_plugin_registry()->pluginList()) { auto meta = registry.input_plugin_registry()->metadata(p); if (meta && meta->data().hasValue("type") && meta->data().value("type") == "input") { - logger->info("input: {}", p); + logger->info("input: {}", std::string(p)); } } for (auto &p : registry.handler_plugin_registry()->pluginList()) { auto meta = registry.handler_plugin_registry()->metadata(p); if (meta && meta->data().hasValue("type") && meta->data().value("type") == "handler") { - logger->info("handler: {}", p); + logger->info("handler: {}", std::string(p)); } } exit(EXIT_SUCCESS); diff --git a/src/AbstractPlugin.cpp b/src/AbstractPlugin.cpp index d0edb22e0..10e22ff99 100644 --- a/src/AbstractPlugin.cpp +++ b/src/AbstractPlugin.cpp @@ -12,15 +12,15 @@ void AbstractPlugin::check_schema(json obj, SchemaMap &required, SchemaMap &opti { for (const auto &[key, value] : required) { if (!obj.contains(key)) { - throw SchemaException(fmt::format("{}: required field is missing: {}", plugin(), key)); + throw SchemaException(fmt::format("{}: required field is missing: {}", std::string(plugin()), key)); } if (!std::regex_match(obj[key].get(), std::regex(value))) { - throw SchemaException(fmt::format("{}: required field fails input validation: {} requires {}", plugin(), key, value)); + throw SchemaException(fmt::format("{}: required field fails input validation: {} requires {}", std::string(plugin()), key, value)); } } for (const auto &[key, value] : optional) { if (obj.contains(key) && !std::regex_match(obj[key].get(), std::regex(value))) { - throw SchemaException(fmt::format("{}: optional field fails input validation: {} requires {}", plugin(), key, value)); + throw SchemaException(fmt::format("{}: optional field fails input validation: {} requires {}", std::string(plugin()), key, value)); } } } diff --git a/src/AbstractPlugin.h b/src/AbstractPlugin.h index d42581676..3461ac5b9 100644 --- a/src/AbstractPlugin.h +++ b/src/AbstractPlugin.h @@ -73,7 +73,7 @@ class AbstractPlugin : public Corrade::PluginManager::AbstractPlugin public: static Corrade::Containers::Array pluginSearchPaths() { - return {Corrade::Containers::InPlaceInit, {""}}; + return {Corrade::InPlaceInit, {""}}; } explicit AbstractPlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) diff --git a/src/CoreRegistry.cpp b/src/CoreRegistry.cpp index 97eeddb4f..6690eb29a 100644 --- a/src/CoreRegistry.cpp +++ b/src/CoreRegistry.cpp @@ -8,6 +8,7 @@ #include "InputStreamManager.h" #include "Policies.h" #include "Taps.h" +#include #include #include #include diff --git a/src/HandlerModulePlugin.h b/src/HandlerModulePlugin.h index 9cc8835bf..19339a690 100644 --- a/src/HandlerModulePlugin.h +++ b/src/HandlerModulePlugin.h @@ -25,12 +25,13 @@ class HandlerModulePlugin : public AbstractPlugin static Corrade::Containers::StringView pluginInterface() { - return "visor.module.handler/1.0"; + using namespace Corrade::Containers::Literals; + return "visor.module.handler/1.0"_s; } static Corrade::Containers::Array pluginSearchPaths() { - return {Corrade::Containers::InPlaceInit, {""}}; + return {Corrade::InPlaceInit, {""}}; } explicit HandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) diff --git a/src/InputModulePlugin.h b/src/InputModulePlugin.h index 058676927..d71e214c9 100644 --- a/src/InputModulePlugin.h +++ b/src/InputModulePlugin.h @@ -22,12 +22,13 @@ class InputModulePlugin : public AbstractPlugin public: static Corrade::Containers::StringView pluginInterface() { - return "visor.module.input/1.0"; + using namespace Corrade::Containers::Literals; + return "visor.module.input/1.0"_s; } static Corrade::Containers::Array pluginSearchPaths() { - return {Corrade::Containers::InPlaceInit, {""}}; + return {Corrade::InPlaceInit, {""}}; } explicit InputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const Corrade::Containers::StringView plugin) diff --git a/src/Policies.cpp b/src/Policies.cpp index b292be7f2..4fcb868ad 100644 --- a/src/Policies.cpp +++ b/src/Policies.cpp @@ -89,7 +89,7 @@ std::vector PolicyManager::load(const YAML::Node &policy_yaml, bool si policy_ptr->add_tap(tap); // ensure tap input type matches policy input tap if (input_node["input_type"].as() != tap->input_plugin()->plugin()) { - throw PolicyException(fmt::format("input_type for policy specified tap '{}' doesn't match tap's defined input type: {}/{}", tap_name, input_node["input_type"].as(), tap->input_plugin()->plugin())); + throw PolicyException(fmt::format("input_type for policy specified tap '{}' doesn't match tap's defined input type: {}/{}", tap_name, input_node["input_type"].as(), std::string(tap->input_plugin()->plugin()))); } // handler internal config window_config.config_set("_internal_tap_name", tap_name); diff --git a/src/handlers/static_plugins.h b/src/handlers/static_plugins.h index 2a968cca2..063a36c33 100644 --- a/src/handlers/static_plugins.h +++ b/src/handlers/static_plugins.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + static int import_handler_plugins() { CORRADE_PLUGIN_IMPORT(VisorHandlerNet); diff --git a/src/inputs/static_plugins.h b/src/inputs/static_plugins.h index 9d0e68d39..3ea5574c6 100644 --- a/src/inputs/static_plugins.h +++ b/src/inputs/static_plugins.h @@ -1,5 +1,8 @@ #pragma once +#include +#include + static int import_input_plugins() { CORRADE_PLUGIN_IMPORT(VisorInputMock); From 18b8bc53b6c3e9f0c7bead75000291aa3d6c3ce6 Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Sat, 11 Apr 2026 16:29:18 -0300 Subject: [PATCH 03/10] fix: address PR review comments and fix remaining CI failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix build_cross.yml: conan export path was wrong (src/conan/ → conan/) - Fix unit-tests-mac: add tools.apple:sdk_path to conan profile so CMakeToolchain uses the full SDK path instead of bare 'macosx', resolving 'initializer_list' not found compile error - Add missing conan export step to build-win64, build-app-image-x64 jobs - Fix entrypoint.sh: copy conan/ directory and run conan export before cmake, fixing Docker-based arm64/debug builds - Expand all conan cache keys to include conan/corrade/** so changes to conandata.yml or cmake helpers invalidate cache correctly - Set required_conan_version = ">=2.0" in local Conan recipe (recipe uses Conan 2 imports; >=1.52.0 would silently accept Conan 1) - Fix find_program in conan-corrade-vars.cmake: PATHS ENV PATH syntax (was split across lines causing ambiguity) and add NOTFOUND guard Co-Authored-By: Claude Sonnet 4.6 --- .github/actions/build-cpp/entrypoint.sh | 2 ++ .github/workflows/build-develop.yml | 20 +++++++++++++------- .github/workflows/build-release.yml | 12 ++++++++---- .github/workflows/build_cross.yml | 4 ++-- .github/workflows/build_debug.yml | 4 ++-- conan/corrade/cmake/conan-corrade-vars.cmake | 8 ++++++-- conan/corrade/conanfile.py | 2 +- 7 files changed, 34 insertions(+), 18 deletions(-) diff --git a/.github/actions/build-cpp/entrypoint.sh b/.github/actions/build-cpp/entrypoint.sh index 897aa2be8..ef5dee54b 100644 --- a/.github/actions/build-cpp/entrypoint.sh +++ b/.github/actions/build-cpp/entrypoint.sh @@ -20,8 +20,10 @@ function build() { cp -rf /github/workspace/CMakeLists.txt /pktvisor-src/ cp -rf /github/workspace/conanfile.py /pktvisor-src/ cp -rf /github/workspace/.conanrc /pktvisor-src/ + cp -rf /github/workspace/conan/ /pktvisor-src/conan/ cd /pktvisor-src/ conan profile detect -f + conan export /pktvisor-src/conan/corrade/ --name=corrade --version=cci.20260327 cd /pktvisor-src/build/ if [ "$INPUT_ARCH" == "amd64" ]; then PKG_CONFIG_PATH=/local/lib/pkgconfig cmake .. -DCMAKE_BUILD_TYPE=$INPUT_BUILD_TYPE \ diff --git a/.github/workflows/build-develop.yml b/.github/workflows/build-develop.yml index f8f7df705..f7bb72e25 100644 --- a/.github/workflows/build-develop.yml +++ b/.github/workflows/build-develop.yml @@ -43,11 +43,14 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- - name: Detect Conan Profile - run: conan profile detect -f + run: | + conan profile detect -f + echo "[conf]" >> "$(conan profile path default)" + echo "tools.apple:sdk_path=$(xcrun --sdk macosx --show-sdk-path)" >> "$(conan profile path default)" - name: Export local Corrade recipe run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 @@ -86,7 +89,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- - name: Export local Corrade recipe @@ -137,7 +140,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- - name: Export local Corrade recipe @@ -248,7 +251,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- - name: Build pktvisord + push symbol to backtrace.io @@ -347,9 +350,12 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake to generate VERSION shell: bash working-directory: ${{github.workspace}}/build @@ -435,7 +441,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-arm64- - name: Build pktvisord + push symbol to backtrace.io diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 34c38f106..bfd7af334 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -36,7 +36,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- - name: Export local Corrade recipe @@ -181,9 +181,13 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- + - name: Export local Corrade recipe + shell: bash + run: conan export $GITHUB_WORKSPACE/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake shell: bash working-directory: ${{github.workspace}}\build @@ -291,7 +295,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-arm64- - name: Build pktvisord + push symbol to backtrace.io @@ -410,7 +414,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}- - name: Build pktvisord + push symbol to backtrace.io diff --git a/.github/workflows/build_cross.yml b/.github/workflows/build_cross.yml index fc8c65ea5..d6096762a 100644 --- a/.github/workflows/build_cross.yml +++ b/.github/workflows/build_cross.yml @@ -119,11 +119,11 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/src/build/p/ - key: conan-${{ runner.os }}-${{matrix.arch}}-${{ hashFiles('**/conanfile.py') }} + key: conan-${{ runner.os }}-${{matrix.arch}}-${{ hashFiles('**/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-${{matrix.arch}}- - name: Export local Corrade recipe - run: conan export ${{github.workspace}}/src/conan/corrade/ --name=corrade --version=cci.20260327 + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 - name: Install dependencies working-directory: ${{github.workspace}}/src diff --git a/.github/workflows/build_debug.yml b/.github/workflows/build_debug.yml index a7207bf92..b6187a87d 100644 --- a/.github/workflows/build_debug.yml +++ b/.github/workflows/build_debug.yml @@ -28,7 +28,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- - name: linux package install @@ -82,7 +82,7 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/build/p/ - key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py') }} + key: conan-${{ runner.os }}-amd64-${{ hashFiles('conanfile.py', '*/conanfile.py', 'conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-amd64- - name: Build pktvisord + push symbol to backtrace.io diff --git a/conan/corrade/cmake/conan-corrade-vars.cmake b/conan/corrade/cmake/conan-corrade-vars.cmake index cc7a73f98..dafa5c7df 100644 --- a/conan/corrade/cmake/conan-corrade-vars.cmake +++ b/conan/corrade/cmake/conan-corrade-vars.cmake @@ -40,8 +40,8 @@ if(NOT TARGET Corrade::rc) if(CMAKE_CROSSCOMPILING) find_program(CORRADE_RC_PROGRAM NAMES corrade-rc - PATHS ENV - PATH NO_DEFAULT_PATH) + PATHS ENV PATH + NO_DEFAULT_PATH) else() find_program(CORRADE_RC_PROGRAM NAMES corrade-rc @@ -49,6 +49,10 @@ if(NOT TARGET Corrade::rc) NO_DEFAULT_PATH) endif() + if(CORRADE_RC_PROGRAM STREQUAL "CORRADE_RC_PROGRAM-NOTFOUND") + message(FATAL_ERROR "Corrade: corrade-rc not found. Pass -DCORRADE_RC_PROGRAM=/path/to/corrade-rc.") + endif() + get_filename_component(CORRADE_RC_PROGRAM "${CORRADE_RC_PROGRAM}" ABSOLUTE) add_executable(Corrade::rc IMPORTED) diff --git a/conan/corrade/conanfile.py b/conan/corrade/conanfile.py index 52999ed78..822ac6407 100644 --- a/conan/corrade/conanfile.py +++ b/conan/corrade/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc, check_min_vs -required_conan_version = ">=1.52.0" +required_conan_version = ">=2.0" class CorradeConan(ConanFile): From 0bf6279439fcbc0778146ce91d087e49dbbf6e30 Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Sat, 11 Apr 2026 17:23:00 -0300 Subject: [PATCH 04/10] fix: correct conan export path in build_cross.yml The repo is checked out into \$GITHUB_WORKSPACE/src (actions/checkout with path: src), so the conan/corrade recipe is at src/conan/corrade/, not conan/corrade/. Update both the export path and the cache key hashFiles pattern accordingly. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build_cross.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_cross.yml b/.github/workflows/build_cross.yml index d6096762a..4cd273049 100644 --- a/.github/workflows/build_cross.yml +++ b/.github/workflows/build_cross.yml @@ -119,11 +119,11 @@ jobs: uses: actions/cache@v5 with: path: ${{github.workspace}}/src/build/p/ - key: conan-${{ runner.os }}-${{matrix.arch}}-${{ hashFiles('**/conanfile.py', 'conan/corrade/**') }} + key: conan-${{ runner.os }}-${{matrix.arch}}-${{ hashFiles('**/conanfile.py', 'src/conan/corrade/**') }} restore-keys: conan-${{ runner.os }}-${{matrix.arch}}- - name: Export local Corrade recipe - run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + run: conan export ${{github.workspace}}/src/conan/corrade/ --name=corrade --version=cci.20260327 - name: Install dependencies working-directory: ${{github.workspace}}/src From d51f546f5e0b397189a73286069666e2101493a5 Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Sun, 12 Apr 2026 07:30:01 -0300 Subject: [PATCH 05/10] fix: add missing conan export to all remaining CI paths - build-release.yml prebuild-package: add export before cmake configure - build-release.yml release: add export before cmake configure - build_cross.yml pkvisor-cli: install conan and export before cmake configure - code-ql.yml: export after fresh clone, before cmake configure Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build-release.yml | 8 +++++++- .github/workflows/build_cross.yml | 6 ++++++ .github/workflows/code-ql.yml | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index bfd7af334..47f8062df 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -79,6 +79,9 @@ jobs: id: conan uses: turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d #v1.2 + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake to generate VERSION shell: bash working-directory: ${{github.workspace}}/build @@ -123,11 +126,14 @@ jobs: id: conan uses: turtlebrowser/get-conan@c171f295f3f507360ee018736a6608731aa2109d #v1.2 + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake to generate VERSION shell: bash working-directory: ${{github.workspace}}/build run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake - + - name: Set variables run: | echo "LAST_TAG=`git tag --sort=committerdate | tail -1`" >> $GITHUB_ENV diff --git a/.github/workflows/build_cross.yml b/.github/workflows/build_cross.yml index 4cd273049..0a0910094 100644 --- a/.github/workflows/build_cross.yml +++ b/.github/workflows/build_cross.yml @@ -182,6 +182,12 @@ jobs: - name: Checkout sources uses: actions/checkout@v6 + - name: Install Conan + run: pip install --no-cache-dir conan --force-reinstall + + - name: Export local Corrade recipe + run: conan export ${{github.workspace}}/conan/corrade/ --name=corrade --version=cci.20260327 + - name: Configure CMake to generate VERSION shell: bash run: VERSION_ONLY=1 cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake diff --git a/.github/workflows/code-ql.yml b/.github/workflows/code-ql.yml index a9cf7fe05..d3bbae530 100644 --- a/.github/workflows/code-ql.yml +++ b/.github/workflows/code-ql.yml @@ -68,6 +68,8 @@ jobs: # clone the repository, not sure if this needs to be done git clone https://github.com/netboxlabs/pktvisor.git cd pktvisor + # export the local Corrade recipe so conan_provider can resolve it + conan export conan/corrade/ --name=corrade --version=cci.20260327 mkdir build && cd build # configure and handle dependencies cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake .. From fc1611805fd2540c263fd940fdd8f881f6c192bf Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Sun, 12 Apr 2026 10:31:08 -0300 Subject: [PATCH 06/10] fix: run conan export from src/ in build_cross.yml to match conan home .conanrc sets conan_home=./build (relative). The pkvisor job checks out into src/ and runs conan install with working-directory=src, so its conan home resolves to src/build/. The export step was running from the workspace root, writing to a different conan home (build/ instead of src/build/), making the recipe invisible to conan install. Fix: add working-directory: src to the export step so both steps share the same conan home. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build_cross.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_cross.yml b/.github/workflows/build_cross.yml index 0a0910094..db798a474 100644 --- a/.github/workflows/build_cross.yml +++ b/.github/workflows/build_cross.yml @@ -123,7 +123,8 @@ jobs: restore-keys: conan-${{ runner.os }}-${{matrix.arch}}- - name: Export local Corrade recipe - run: conan export ${{github.workspace}}/src/conan/corrade/ --name=corrade --version=cci.20260327 + working-directory: ${{github.workspace}}/src + run: conan export conan/corrade/ --name=corrade --version=cci.20260327 - name: Install dependencies working-directory: ${{github.workspace}}/src From 1b7698cd1e836b3963843f1e97151c02152b1f5c Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Sun, 12 Apr 2026 10:44:16 -0300 Subject: [PATCH 07/10] fix: patch Corrade strerror_r for musl libc compatibility musl only provides the XSI strerror_r (returns int). Corrade's ErrorString.cpp falls into the GNU branch (expects char*) when _GNU_SOURCE is defined by GCC even on musl targets, causing a compile error: "invalid conversion from int to const char*". Add a portability patch that extends the existing POSIX branch condition to also cover non-glibc Linux (detected via __linux__ && !__GLIBC__), so musl builds use the int-returning XSI variant that actually exists. Co-Authored-By: Claude Sonnet 4.6 --- conan/corrade/conandata.yml | 6 ++++++ .../patches/0001-fix-strerror_r-musl-compat.patch | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 conan/corrade/patches/0001-fix-strerror_r-musl-compat.patch diff --git a/conan/corrade/conandata.yml b/conan/corrade/conandata.yml index 04a27772f..bf3e5a54f 100644 --- a/conan/corrade/conandata.yml +++ b/conan/corrade/conandata.yml @@ -2,3 +2,9 @@ sources: "cci.20260327": sha256: d8f30e9a857172003b6b02304783f40e8038c36e4127a0cfec7fe14f41c13fd4 url: https://github.com/mosra/corrade/archive/22e7ffc6fcdeaa0df96e0d8b3d482ad6abe7dc36.tar.gz + +patches: + "cci.20260327": + - patch_file: "patches/0001-fix-strerror_r-musl-compat.patch" + patch_description: "Fix strerror_r usage for non-glibc Linux (musl): always use POSIX XSI variant" + patch_type: "portability" diff --git a/conan/corrade/patches/0001-fix-strerror_r-musl-compat.patch b/conan/corrade/patches/0001-fix-strerror_r-musl-compat.patch new file mode 100644 index 000000000..b09c4af8a --- /dev/null +++ b/conan/corrade/patches/0001-fix-strerror_r-musl-compat.patch @@ -0,0 +1,12 @@ +--- a/src/Corrade/Utility/Implementation/ErrorString.cpp ++++ b/src/Corrade/Utility/Implementation/ErrorString.cpp +@@ -61,7 +61,8 @@ void printErrnoErrorString(Debug& debug, const int error) { + the buffer. Sigh. */ + /** @todo might want to add CORRADE_TARGET_BSD covering all three variants, + there's no overarching BSD define present on all BSDs :( */ +- #if ((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE) || defined(CORRADE_TARGET_EMSCRIPTEN) || defined(CORRADE_TARGET_APPLE) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) ++ /* Also include non-glibc Linux (e.g. musl) which always provides only the XSI variant returning int */ ++ #if ((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE) || defined(CORRADE_TARGET_EMSCRIPTEN) || defined(CORRADE_TARGET_APPLE) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || (defined(__linux__) && !defined(__GLIBC__)) + char string[256]; + CORRADE_INTERNAL_ASSERT_OUTPUT(strerror_r(error, string, Containers::arraySize(string)) == 0); + #else From 328b63c6ff542a79fff29fb12c0dc032cbad8739 Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Mon, 13 Apr 2026 10:23:04 -0300 Subject: [PATCH 08/10] fix: address PR review comments and fix remaining CI failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace broken patch file with replace_in_file() in conanfile.py for the musl strerror_r fix — patch-ng context lines were at wrong offset; replace_in_file does an exact string search and is more robust - Add #include to AbstractPlugin.cpp and Policies.cpp — both use std::string(plugin()) / std::string(StringView) but were missing the header that provides the STL interop conversion Co-Authored-By: Claude Sonnet 4.6 --- conan/corrade/conandata.yml | 6 ------ conan/corrade/conanfile.py | 11 ++++++++++- .../patches/0001-fix-strerror_r-musl-compat.patch | 12 ------------ src/AbstractPlugin.cpp | 1 + src/Policies.cpp | 1 + 5 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 conan/corrade/patches/0001-fix-strerror_r-musl-compat.patch diff --git a/conan/corrade/conandata.yml b/conan/corrade/conandata.yml index bf3e5a54f..04a27772f 100644 --- a/conan/corrade/conandata.yml +++ b/conan/corrade/conandata.yml @@ -2,9 +2,3 @@ sources: "cci.20260327": sha256: d8f30e9a857172003b6b02304783f40e8038c36e4127a0cfec7fe14f41c13fd4 url: https://github.com/mosra/corrade/archive/22e7ffc6fcdeaa0df96e0d8b3d482ad6abe7dc36.tar.gz - -patches: - "cci.20260327": - - patch_file: "patches/0001-fix-strerror_r-musl-compat.patch" - patch_description: "Fix strerror_r usage for non-glibc Linux (musl): always use POSIX XSI variant" - patch_type: "portability" diff --git a/conan/corrade/conanfile.py b/conan/corrade/conanfile.py index 822ac6407..847b88273 100644 --- a/conan/corrade/conanfile.py +++ b/conan/corrade/conanfile.py @@ -4,7 +4,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import cross_building from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.microsoft import is_msvc, check_min_vs required_conan_version = ">=2.0" @@ -71,6 +71,15 @@ def build_requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + # Fix strerror_r for non-glibc Linux (e.g. musl): always use POSIX XSI variant. + # GCC defines _GNU_SOURCE on Linux even for musl targets, so Corrade's preprocessor + # condition falls into the GNU branch (char* strerror_r) which musl doesn't provide. + replace_in_file( + self, + os.path.join(self.source_folder, "src/Corrade/Utility/Implementation/ErrorString.cpp"), + "#if ((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE) || defined(CORRADE_TARGET_EMSCRIPTEN) || defined(CORRADE_TARGET_APPLE) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)", + "#if ((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE) || defined(CORRADE_TARGET_EMSCRIPTEN) || defined(CORRADE_TARGET_APPLE) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || (defined(__linux__) && !defined(__GLIBC__))", + ) def generate(self): tc = CMakeToolchain(self) diff --git a/conan/corrade/patches/0001-fix-strerror_r-musl-compat.patch b/conan/corrade/patches/0001-fix-strerror_r-musl-compat.patch deleted file mode 100644 index b09c4af8a..000000000 --- a/conan/corrade/patches/0001-fix-strerror_r-musl-compat.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/src/Corrade/Utility/Implementation/ErrorString.cpp -+++ b/src/Corrade/Utility/Implementation/ErrorString.cpp -@@ -61,7 +61,8 @@ void printErrnoErrorString(Debug& debug, const int error) { - the buffer. Sigh. */ - /** @todo might want to add CORRADE_TARGET_BSD covering all three variants, - there's no overarching BSD define present on all BSDs :( */ -- #if ((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE) || defined(CORRADE_TARGET_EMSCRIPTEN) || defined(CORRADE_TARGET_APPLE) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -+ /* Also include non-glibc Linux (e.g. musl) which always provides only the XSI variant returning int */ -+ #if ((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE) || defined(CORRADE_TARGET_EMSCRIPTEN) || defined(CORRADE_TARGET_APPLE) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || (defined(__linux__) && !defined(__GLIBC__)) - char string[256]; - CORRADE_INTERNAL_ASSERT_OUTPUT(strerror_r(error, string, Containers::arraySize(string)) == 0); - #else diff --git a/src/AbstractPlugin.cpp b/src/AbstractPlugin.cpp index 10e22ff99..f6d129d45 100644 --- a/src/AbstractPlugin.cpp +++ b/src/AbstractPlugin.cpp @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "AbstractPlugin.h" +#include #include #include diff --git a/src/Policies.cpp b/src/Policies.cpp index 4fcb868ad..fe122fbad 100644 --- a/src/Policies.cpp +++ b/src/Policies.cpp @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "Policies.h" +#include #include "CoreRegistry.h" #include "HandlerManager.h" #include "InputStreamManager.h" From 2670aee429a38b043e0079f0d59e5556a4baf134 Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Mon, 13 Apr 2026 18:14:58 -0300 Subject: [PATCH 09/10] =?UTF-8?q?fix:=20add=20StringStl.h=20to=20Taps.h=20?= =?UTF-8?q?for=20explicit=20StringView=E2=86=92std::string=20interop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Taps::info_json() assigns plugin() and pluginInterface() (both StringView) directly to JSON values. The conversion worked transitively on some compilers, but the explicit include makes the dependency clear and avoids fragile transitive reliance on CORRADE_BUILD_DEPRECATED pulling it in. Co-Authored-By: Claude Sonnet 4.6 --- src/Taps.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Taps.h b/src/Taps.h index 3f51f0d58..24b11d93a 100644 --- a/src/Taps.h +++ b/src/Taps.h @@ -8,6 +8,7 @@ #include "AbstractModule.h" #include "Configurable.h" #include "InputModulePlugin.h" +#include #include namespace visor { From 93710a0036a04964267a0dd06664fb03b82a30d5 Mon Sep 17 00:00:00 2001 From: Leo Parente <23251360+leoparente@users.noreply.github.com> Date: Mon, 13 Apr 2026 19:14:04 -0300 Subject: [PATCH 10/10] fix: add conan export to Dockerfile and README build steps The vendored corrade/cci.20260327 recipe must be exported before any conan install/cmake invocation on a clean cache. Update: - docker/Dockerfile: COPY conan/ and run conan export before cmake - README.md: add conan export step to the local build instructions Co-Authored-By: Claude Sonnet 4.6 --- README.md | 2 ++ docker/Dockerfile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index c6a27f5b9..8010ded03 100644 --- a/README.md +++ b/README.md @@ -606,6 +606,8 @@ The general build steps are: git clone https://github.com/netboxlabs/pktvisor.git cd pktvisor/ conan profile detect -f +# export the vendored Corrade recipe (not in conan-center) +conan export conan/corrade/ --name=corrade --version=cci.20260327 cd build/ # configure and handle dependencies cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake .. diff --git a/docker/Dockerfile b/docker/Dockerfile index 7314fd173..b0c24a742 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,11 +21,13 @@ COPY ./cmake/ /pktvisor-src/cmake/ COPY ./CMakeLists.txt /pktvisor-src/ COPY ./conanfile.py /pktvisor-src/ COPY ./.conanrc /pktvisor-src/ +COPY ./conan/ /pktvisor-src/conan/ WORKDIR /pktvisor-src RUN \ conan profile detect -f && \ + conan export conan/corrade/ --name=corrade --version=cci.20260327 && \ cd build/ && \ PKG_CONFIG_PATH=/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./cmake/conan_provider.cmake .. && \ make all -j 4