This fix a build error in Debug mode #16245
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-
NicolasDorier commented at 3:47 AM on June 20, 2019: contributor
-
MSVC: Fix error in debug mode (Fix #16245) eb832cd3b4
- fanquake added the label Build system on Jun 20, 2019
- fanquake added the label Windows on Jun 20, 2019
-
NicolasDorier commented at 6:29 AM on June 20, 2019: contributor
bigobj doc and the reason why it happens in debug only.
-
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 /bigobjIt can be fixed with
/bigobjas per this PR or by replacing/Odwith/O1or/O2. The/bigobjfix is the right option since it will keep the object files in an unoptimised state and more suitable for debugging. - MarcoFalke merged this on Jun 20, 2019
- MarcoFalke closed this on Jun 20, 2019
- MarcoFalke referenced this in commit 23815ee74d on Jun 20, 2019
- Munkybooty referenced this in commit 805dc2fae7 on Oct 7, 2021
- Munkybooty referenced this in commit d520dcf33c on Oct 14, 2021
- DrahtBot locked this on Dec 16, 2021