Skip to content

Reproducible build: fix MSVC build reproducibility#1407

Merged
mgovers merged 2 commits into
mainfrom
pgm/feature/more-reproducible-build
May 26, 2026
Merged

Reproducible build: fix MSVC build reproducibility#1407
mgovers merged 2 commits into
mainfrom
pgm/feature/more-reproducible-build

Conversation

@mgovers
Copy link
Copy Markdown
Member

@mgovers mgovers commented May 26, 2026

The MSVC build reproducibility failed recently (see e.g. https://github.com/PowerGridModel/power-grid-model/actions/runs/26438097171/job/77825539883)

The underlying reason seems to be related to a couple things related to the debug directories: (tested using dumpbin /HEADERS <first> <second> and also with a full check using dumpbin /ALL <first> <second>)

Changes in this PR

  • For the reproducibile build check, migrated from RelWithDebInfo to Release to get rid of more debug symbols
    • NOTE: THIS MAY CAUSE CMakeUserPresets.json TO BREAK FOR SOME DEVELOPERS
  • set /debug:None to force Debug Directories to be reproducible (creates a None string instead)
  • set /NOCOFFGRPINFO to remove the COFFGRP directory from the Debug Directories
  • set /LTCG to disable the default fast linking code generation (which is not fully disabled by disabling incremental build)

Test case

First

  Debug Directories

        Time Type        Size      RVA  Pointer
    -------- ------- -------- -------- --------
    E39168F9 cv            79 006D2934   6D1934    Format: RSDS, {9310574C-CE7A-FD1A-032B-721FC6B9EABA}, 1, D:\a\power-grid-model\power-grid-model\cpp_build\ci-msvc-reproducible\bin\power_grid_model_c.pdb
    E39168F9 feat          14 006D29B0   6D19B0    Counts: Pre-VC++ 11.00=0, C/C++=46, /GS=46, /sdl=0, guardN=37
    E39168F9 coffgrp      33C 006D29C4   6D19C4    4C544347 (LTCG)
    E39168F9 repro         24 006D2D00   6D1D00    4C 57 10 93 7A CE 1A FD 03 2B 72 1F C6 B9 EA BA 4A 7A A3 30 4A 32 40 08 69 87 BA 73 F9 68 91 E3

Second

  Debug Directories

        Time Type        Size      RVA  Pointer
    -------- ------- -------- -------- --------
    63B9CD42 cv            79 006D2934   6D1934    Format: RSDS, {EFB674F5-E861-8C49-023F-F88F6283BE43}, 1, D:\a\power-grid-model\power-grid-model\cpp_build\ci-msvc-reproducible\bin\power_grid_model_c.pdb
    63B9CD42 feat          14 006D29B0   6D19B0    Counts: Pre-VC++ 11.00=0, C/C++=46, /GS=46, /sdl=0, guardN=37
    63B9CD42 coffgrp      33C 006D29C4   6D19C4    4C544347 (LTCG)
    63B9CD42 repro         24 006D2D00   6D1D00    F5 74 B6 EF 61 E8 49 8C 02 3F F8 8F 62 83 BE 43 38 26 9D 50 D9 1F FE D0 12 2D 4E 50 42 CD B9 63

After this PR

  Debug Directories

        Time Type        Size      RVA  Pointer
    -------- ------- -------- -------- --------
    B825E477 repro         24 001A4F88   1A3788    1C DE 69 56 F8 9A 0F D4 97 D4 4E 6C 8E FB C9 E8 D5 EE C8 3A 4B 86 E4 CB 3D 0B F0 35 77 E4 25 B8

where the pointer and bytes are both consistent across multiple builds

To test

@mgovers mgovers self-assigned this May 26, 2026
@mgovers mgovers added bug Something isn't working do-not-merge This should not be merged labels May 26, 2026
@mgovers
Copy link
Copy Markdown
Member Author

mgovers commented May 26, 2026

do-not-merge label added for testing they are binary equivalent even across multiple reruns of the reproducibility pipeline; do-not-merge label removed

@mgovers mgovers removed the do-not-merge This should not be merged label May 26, 2026
@mgovers mgovers enabled auto-merge May 26, 2026 09:45
nitbharambe
nitbharambe previously approved these changes May 26, 2026
Copy link
Copy Markdown
Member

@nitbharambe nitbharambe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
@mgovers mgovers force-pushed the pgm/feature/more-reproducible-build branch from bf241a5 to a14e043 Compare May 26, 2026 12:08
@mgovers mgovers force-pushed the pgm/feature/more-reproducible-build branch from fdf6da3 to a14e043 Compare May 26, 2026 12:10
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
@sonarqubecloud
Copy link
Copy Markdown

@mgovers mgovers added this pull request to the merge queue May 26, 2026
Merged via the queue into main with commit 07a60d6 May 26, 2026
34 checks passed
@mgovers mgovers deleted the pgm/feature/more-reproducible-build branch May 26, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants