Change Compilation on Windows (Part II)#22650
Draft
thiagoftsm wants to merge 24 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
5 issues found across 12 files
Confidence score: 2/5
- There is clear regression risk in
CMakeLists.txt:BEFOREis placed incorrectly fortarget_include_directories, which can cause CMake parse/configuration failures. packaging/windows/clion-msys-mingw64-environment.bathas a high-impact toolchain misconfiguration (GOROOTset to the MSYS2 prefix) that can make Go/CMake resolve the wrong root on Windows builds.- Given multiple medium/high-severity, high-confidence Windows build-path issues (
MSYSTEMordering, PATH precedence/quoting), this is not yet a safe merge without fixes. - Pay close attention to
CMakeLists.txt,packaging/windows/clion-msys-mingw64-environment.bat,packaging/windows/compile-on-windows.sh,packaging/windows/clion-msys-msys-environment.bat- build/toolchain resolution can select incorrect binaries or fail configuration.
Architecture diagram
sequenceDiagram
participant Dev as Developer Machine
participant CI as CI/CD Pipeline
participant MSYS as MSYS2 Shell
participant CMake as CMake Build System
participant Go as Go Toolchain
participant DDK as Windows DDK Headers
participant NSIS as NSIS Installer
Note over Dev,NSIS: NEW: UCRT64 Build Environment on Windows
Dev->>MSYS: Run compile-on-windows.sh / build.ps1
MSYS->>MSYS: validate MSYSTEM=UCRT64
MSYS->>MSYS: set MSYSTEM=UCRT64 (if not set)
CI->>MSYS: Run install-dependencies.ps1
MSYS->>MSYS: set MSYSTEM=UCRT64
MSYS->>MSYS: invoke-msys2.ps1 with MSYSTEM=UCRT64
MSYS->>MSYS: install only ucrt64/* packages (no mingw64)
MSYS->>CMake: cmake -DCMAKE_BUILD_TYPE=...
CMake->>CMake: NetdataPlatform.cmake - detect MSYSTEM=UCRT64
alt MSYSTEM=UCRT64
CMake->>CMake: include ucrt64 headers
else MSYSTEM=MSYS
CMake->>CMake: include msys headers
else other (MINGW64 removed)
CMake->>CMake: skip (no mingw64 include path)
end
Note over CMake,DDK: Driver compilation with UCRT64 DDK headers
CMake->>CMake: locate DDK headers
CMake->>DDK: target_include_directories(/ucrt64/include/ddk)
DDK-->>CMake: provide driver headers
CMake->>CMake: compile netdata_driver.sys
Note over CMake,Go: Go toolchain discovery with UCRT64 priority
CMake->>Go: find_program(go PATHS ... /ucrt64/lib/go/bin ...)
Go-->>CMake: return go executable path
Note over MSYS,NSIS: Packaging with UCRT64 NSIS
MSYS->>NSIS: package.ps1 (MSYSTEM=UCRT64)
NSIS-->>MSYS: create installer using ucrt64/mingw-w64-ucrt-x86_64-nsis
Note over Dev,CI: CLion IDE configuration
Dev->>Dev: configure CLion toolchain
Dev->>Dev: set MSYSTEM=UCRT64
Dev->>Dev: set GOROOT=C:\msys64\ucrt64
Dev->>Dev: set PATH includes C:\msys64\ucrt64\bin
Dev->>Dev: set PROTOBUF_PROTOC_EXECUTABLE=C:/msys64/ucrt64/bin/protoc.exe
Note over MSYS: Validation gates
alt MSYSTEM != UCRT64 in compile-and-run-windows.sh
MSYS->>MSYS: exit 1 with error message
end
alt MSYSTEM != UCRT64 in msys2-dependencies.sh
MSYS->>MSYS: exit 1 with error message
end
MSYS-->>Dev: build output (exe, sys, installer)
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Contributor
|
You're iterating quickly on this pull request. To help protect your rate limits, cubic has paused automatic reviews on new pushes for now—when you're ready for another review, comment |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Netdata is adjusting internal codes and compilation environment, allowing the source code to be compiled directly on Windows.
This PR gives the first step to achieve goal given in #22551: "Pivot the Windows build to MSYSTEM=UCRT64 so the C side of the agent matches the C runtime, data model, and CRT linkage of the Rust toolchain. Unblocks in-process Rust FFI on Windows and lets us drop the bundled MSYS2 root from the installer."
Test Plan
Additional Information
For users: How does this change affect me?
Summary by cubic
Switch Windows builds to MSYS2 UCRT64 and drop all
mingw64paths. This unblocks Rust FFI and fixes Windows-specific build issues (Judy word size, syslog constants,libbacktrace,claim), while skipping POSIX-only tools.Refactors
MSYSTEM=UCRT64;compile-and-run-windows.shandmsys2-dependencies.shhard-check;compile-on-windows.shauto-sets it and uses/ucrt64/bin/cmake./ucrt64/include/ddkfor the driver;FindGosearches/ucrt64/lib/go/bin(drop/mingw64).NetdataProtobuffindsprotocvia PATH;libbacktraceconfig runs viabash;NetdataClaimlinks with-mwindows.nd-run; do not require or buildndsudo(still used on POSIX). On Linux linklibcapwhen available.Judyusesunsigned long longforWord_ton Win64 and casts masks/sentinels toWord_t; define syslog priority constants; aliaswcscasecmpto_wcsicmp./opt/netdata.libyamlwithCMAKE_POLICY_VERSION_MINIMUM=3.5for CMake 3.28+.Migration
MSYSTEM=UCRT64; ensureC:\msys64\ucrt64\binis on PATH.ucrt64/mingw-w64-ucrt-x86_64-go,ucrt64/mingw-w64-ucrt-x86_64-cmake,ucrt64/mingw-w64-ucrt-x86_64-curl,ucrt64/mingw-w64-ucrt-x86_64-nsis,ucrt64/mingw-w64-ucrt-x86_64-libyaml,ucrt64/mingw-w64-ucrt-x86_64-zstd.Written for commit 914d74c. Summary will update on new commits.