MSVC: Fix error in debug mode (Fix #16245) #16246

pull NicolasDorier wants to merge 1 commits into bitcoin:master from NicolasDorier:fix/bigobj changing 1 files +2 −0
  1. NicolasDorier commented at 3:47 AM on June 20, 2019: contributor

    This fix a build error in Debug mode #16245

  2. MSVC: Fix error in debug mode (Fix #16245) eb832cd3b4
  3. fanquake added the label Build system on Jun 20, 2019
  4. fanquake added the label Windows on Jun 20, 2019
  5. NicolasDorier commented at 6:29 AM on June 20, 2019: contributor

    bigobj doc and the reason why it happens in debug only.

  6. sipsorcery commented at 9:30 PM on June 20, 2019: member

    tACK eb832cd3b46a0f9abff238dfa780e4e9df05fdb7

    As an aside I do get this issue with a VS2017 x64 debug built but NOT with a VS2019 x64 debug build so looks like something has been improved.

    TLDR;

    The root cause of the problem seems to be that when the compiler does not optimise the code the compilation fails with the "exceeded object file format error". The /Gy flag is not the cause instead it's the use of /Od (don't optimise to make debugging easier) and the lack of /O1 or /O2.

    The command line below are the standard options before applying this fix.

    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\CL.exe" /c /I..\..\src /I..\..\src\univalue\include /I..\..\src\secp256k1\include /I..\..\src\leveldb\include /I..\..\src\leveldb\helpers\memenv /I"c:\Tools\vcpkg\installed\x64-windows-static\include" /ZI /JMC /nologo /W3 /WX /diagnostics:classic /sdl /Od /D _UNICODE /D UNICODE /D ZMQ_STATIC /D NOMINMAX /D WIN32 /D HAVE_CONFIG_H /D _CRT_SECURE_NO_WARNINGS /D _SCL_SECURE_NO_WARNINGS /D _CONSOLE /D _WIN32_WINNT=0x0601 /D _DEBUG /Gm- /EHsc /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"x64\Debug\libbitcoin_wallet\wallet_wallet.obj" /Fd"x64\Debug\libbitcoin_wallet\libbitcoin_wallet.pdb" /Gd /TP /wd4018 /wd4221 /wd4244 /wd4267 /wd4715 /wd4805 /FC /errorReport:queue /utf-8 ..\..\src\wallet\wallet.cpp
    c:\Dev\github\sipsorcery_bitcoin\src\wallet\wallet.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
    

    It can be fixed with /bigobj as per this PR or by replacing /Od with /O1 or /O2. The /bigobj fix is the right option since it will keep the object files in an unoptimised state and more suitable for debugging.

  7. MarcoFalke merged this on Jun 20, 2019
  8. MarcoFalke closed this on Jun 20, 2019

  9. MarcoFalke referenced this in commit 23815ee74d on Jun 20, 2019
  10. Munkybooty referenced this in commit 805dc2fae7 on Oct 7, 2021
  11. Munkybooty referenced this in commit d520dcf33c on Oct 14, 2021
  12. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 03:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me