fanquake
commented at 2:06 pm on December 10, 2024:
member
Windows cross builds using -O0 (-DCMAKE_BUILD_TYPE=Debug) currently fail to compile, as some objects have too many sections. As a convenience, add -mbig-obj to our compile flags when using the Debug build type, so that if someone tries to build this way, it will work.
This would also be needed if we switched the depends flags to -O0. (maybe in #29796).
-mbig-obj
On PE/COFF target this option forces the use of big object
file format, which allows more than 32768 sections.
Closes #28109. Seems unlikely that we are going to break up the relevant object files, and the main issue is still the inclusion of Boost.
DrahtBot
commented at 2:06 pm on December 10, 2024:
contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
DrahtBot added the label
Build system
on Dec 10, 2024
fanquake added the label
DrahtBot Guix build requested
on Dec 10, 2024
laanwj
commented at 2:20 pm on December 10, 2024:
member
Is there a drawback to enabling this?
Does it increase the size of binaries in non-O0 case? Break compatibility with old tools (we don’t care), etc?
TheCharlatan
commented at 2:26 pm on December 10, 2024:
contributor
Concept ACK
theuni
commented at 8:42 pm on December 10, 2024:
member
Is there a drawback to enabling this? Does it increase the size of binaries in non-O0 case? Break compatibility with old tools (we don’t care), etc?
This was my concern as well. I’m seeing various answers around the net.
I guess it’s not the end of the world if we further slow down the debug binaries, but it’d be a shame to pessimize the release ones for an issue that doesn’t affect them. Maybe do this only in debug mode?
fanquake force-pushed
on Dec 11, 2024
fanquake
commented at 10:19 am on December 11, 2024:
member
I guess it’s not the end of the world if we further slow down the debug binaries
Slow binaries are likely still better than no binaries, given that they don’t currently compile.
I did initally (locally) have this scoped to just the debug flags in depends, but dropped that given it wont work all the time, given the CMake flag handling in that regard is still a bit of a mess. I’ve changed the PR so that this is now only applied when the build type is Debug.
Doing the following (which currently fails on master) now works with this PR:
laanwj
commented at 10:34 am on December 11, 2024:
member
ACKcfdf8d91111838887344b920d6b680a559ca3d2b now that it’s scoped to just Debug
I guess it’s not the end of the world if we further slow down the debug binaries, but it’d be a shame to pessimize the release ones for an issue that doesn’t affect them. Maybe do this only in debug mode?
Right. To be clear i don’t care about the Debug binaries either, but yes making the windows release binaries slower/bigger would be bad. Especially as mingw-w64 already isn’t the toolchain producing the most optimal windows binaries. But scoping it to Debug is fine.
DrahtBot requested review from TheCharlatan
on Dec 11, 2024
fanquake
commented at 1:46 pm on December 11, 2024:
member
theuni
commented at 7:08 pm on December 11, 2024:
member
@fanquake I know this is going to make you grumpy but… I think that check a bit too simplistic depending on how robust the fix needs to be. Specifically:
I think try_append_cxx_flags is just kinda incompatible with multi-config because the solution is to use a generator expression, which is evaluated a build-time.
Since this isn’t the most important thing, maybe just use the hack in the example at the link above, and add a note that it doesn’t work for multi-config?
hebasto
commented at 1:08 pm on December 13, 2024:
member
Concept ACK.
The same problem happens when building on Windows with --config Debug. This case should also be fixed.
I think try_append_cxx_flags is just kinda incompatible with multi-config because the solution is to use a generator expression, which is evaluated a build-time.
0--- a/CMakeLists.txt
1+++ b/CMakeLists.txt
2@@ -298,6 +298,15 @@ if(WIN32)
3 try_append_linker_flag("-Wl,--major-subsystem-version,6" TARGET core_interface)
4 try_append_linker_flag("-Wl,--minor-subsystem-version,2" TARGET core_interface)
5 endif()
6+
7+ # Workaround producing large object files, which cannot be handled by the assembler.
8+ # More likely to happen with no, or lower levels of optimisation.
9+ # See discussion in [#28109](/bitcoin-bitcoin/28109/).
10+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
11+ try_append_cxx_flags("/bigobj" TARGET core_interface_debug SKIP_LINK)
12+ else()
13+ try_append_cxx_flags("-Wa,-mbig-obj" TARGET core_interface_debug SKIP_LINK)
14+ endif()
15 endif()
1617 # Use 64-bit off_t on 32-bit Linux.
build: use `-mbig-obj` for mingw-w64 Debug builds
Windows cross builds using `-O0` currently fail to compile, as some
objects have too many sections. As a convenience, add `-mbig-obj` to
our compile flags when using the `Debug` build type, so that if someone
tries to build this way, it will work.
This would also be needed if we switched the depends flags to -O0.
`-mbig-obj`
> On PE/COFF target this option forces the use of big object
> file format, which allows more than 32768 sections.
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2b9ff4a66d
fanquake force-pushed
on Dec 13, 2024
fanquake
commented at 3:33 pm on December 13, 2024:
member
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: 2024-12-21 12:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me