Skip to content

Enable /bigobj for compiler_generators on Windows#644

Closed
c8ef wants to merge 1 commit into
facebook:mainfrom
c8ef:patch-1
Closed

Enable /bigobj for compiler_generators on Windows#644
c8ef wants to merge 1 commit into
facebook:mainfrom
c8ef:patch-1

Conversation

@c8ef

@c8ef c8ef commented Mar 25, 2025

Copy link
Copy Markdown
Contributor

When building fbthrift statically on Windows, I encountered the following error. Enabling this flag on Windows should help resolve the issue.

FAILED: thrift/compiler/generate/CMakeFiles/compiler_generators.dir/t_mstch_rust_generator.cc.obj 
C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\cl.exe   /TP -DTHRIFT_HAVE_LIBSNAPPY=0 -ID:\b\fbthrift\src\5.03.24.00-6181d269be.clean\. -ID:\b\fbthrift\x64-windows-static-dbg -external:ID:\installed\x64-windows-static\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP  /MTd /Z7 /Ob0 /Od /RTC1  -std:c++17 /utf-8 /showIncludes /Fothrift\compiler\generate\CMakeFiles\compiler_generators.dir\t_mstch_rust_generator.cc.obj /Fdthrift\compiler\generate\CMakeFiles\compiler_generators.dir\compiler_generators.pdb /FS -c D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_rust_generator.cc
D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_rust_generator.cc : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
[105/384] C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\cl.exe   /TP -DTHRIFT_HAVE_LIBSNAPPY=0 -ID:\b\fbthrift\src\5.03.24.00-6181d269be.clean\. -ID:\b\fbthrift\x64-windows-static-dbg -external:ID:\installed\x64-windows-static\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP  /MTd /Z7 /Ob0 /Od /RTC1  -std:c++17 /utf-8 /showIncludes /Fothrift\compiler\generate\CMakeFiles\compiler_generators.dir\t_mstch_cpp2_generator.cc.obj /Fdthrift\compiler\generate\CMakeFiles\compiler_generators.dir\compiler_generators.pdb /FS -c D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_cpp2_generator.cc
FAILED: thrift/compiler/generate/CMakeFiles/compiler_generators.dir/t_mstch_cpp2_generator.cc.obj 
C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\cl.exe   /TP -DTHRIFT_HAVE_LIBSNAPPY=0 -ID:\b\fbthrift\src\5.03.24.00-6181d269be.clean\. -ID:\b\fbthrift\x64-windows-static-dbg -external:ID:\installed\x64-windows-static\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP  /MTd /Z7 /Ob0 /Od /RTC1  -std:c++17 /utf-8 /showIncludes /Fothrift\compiler\generate\CMakeFiles\compiler_generators.dir\t_mstch_cpp2_generator.cc.obj /Fdthrift\compiler\generate\CMakeFiles\compiler_generators.dir\compiler_generators.pdb /FS -c D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_cpp2_generator.cc
D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_cpp2_generator.cc : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
ninja: build stopped: subcommand failed.
@c8ef

c8ef commented Mar 27, 2025

Copy link
Copy Markdown
Contributor Author

Hi @vitaut, could you please take a look at this patch? Thanks!

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@vitaut has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@vitaut merged this pull request in 10372f2.

facebook-github-bot pushed a commit to facebook/hhvm that referenced this pull request Mar 27, 2025
Summary:
When building `fbthrift` statically on Windows, I encountered the following error. Enabling this flag on Windows should help resolve the issue.

```
FAILED: thrift/compiler/generate/CMakeFiles/compiler_generators.dir/t_mstch_rust_generator.cc.obj
C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\cl.exe   /TP -DTHRIFT_HAVE_LIBSNAPPY=0 -ID:\b\fbthrift\src\5.03.24.00-6181d269be.clean\. -ID:\b\fbthrift\x64-windows-static-dbg -external:ID:\installed\x64-windows-static\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP  /MTd /Z7 /Ob0 /Od /RTC1  -std:c++17 /utf-8 /showIncludes /Fothrift\compiler\generate\CMakeFiles\compiler_generators.dir\t_mstch_rust_generator.cc.obj /Fdthrift\compiler\generate\CMakeFiles\compiler_generators.dir\compiler_generators.pdb /FS -c D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_rust_generator.cc
D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_rust_generator.cc : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
[105/384] C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\cl.exe   /TP -DTHRIFT_HAVE_LIBSNAPPY=0 -ID:\b\fbthrift\src\5.03.24.00-6181d269be.clean\. -ID:\b\fbthrift\x64-windows-static-dbg -external:ID:\installed\x64-windows-static\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP  /MTd /Z7 /Ob0 /Od /RTC1  -std:c++17 /utf-8 /showIncludes /Fothrift\compiler\generate\CMakeFiles\compiler_generators.dir\t_mstch_cpp2_generator.cc.obj /Fdthrift\compiler\generate\CMakeFiles\compiler_generators.dir\compiler_generators.pdb /FS -c D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_cpp2_generator.cc
FAILED: thrift/compiler/generate/CMakeFiles/compiler_generators.dir/t_mstch_cpp2_generator.cc.obj
C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\cl.exe   /TP -DTHRIFT_HAVE_LIBSNAPPY=0 -ID:\b\fbthrift\src\5.03.24.00-6181d269be.clean\. -ID:\b\fbthrift\x64-windows-static-dbg -external:ID:\installed\x64-windows-static\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /GR /EHsc /MP  /MTd /Z7 /Ob0 /Od /RTC1  -std:c++17 /utf-8 /showIncludes /Fothrift\compiler\generate\CMakeFiles\compiler_generators.dir\t_mstch_cpp2_generator.cc.obj /Fdthrift\compiler\generate\CMakeFiles\compiler_generators.dir\compiler_generators.pdb /FS -c D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_cpp2_generator.cc
D:\b\fbthrift\src\5.03.24.00-6181d269be.clean\thrift\compiler\generate\t_mstch_cpp2_generator.cc : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
ninja: build stopped: subcommand failed.
```

X-link: facebook/fbthrift#644

Reviewed By: praihan

Differential Revision: D71990661

Pulled By: vitaut

fbshipit-source-id: 97ac05d817231e5c8688c68be7dcf02901ffa63f
@vitaut

vitaut commented Mar 27, 2025

Copy link
Copy Markdown
Contributor

Merged, thanks!

@c8ef

c8ef commented Mar 28, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for your quick response!

@c8ef c8ef deleted the patch-1 branch March 28, 2025 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants