From 5bd55f11e1b6cc2cb08a0001f9c77f56fb8ac649 Mon Sep 17 00:00:00 2001 From: Kevin Lin Date: Mon, 18 Apr 2022 12:17:40 -0700 Subject: [PATCH] thrift/compiler/compiler.cc: Include fstream to fix compatibility with Boost 1.79.0 (#494) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: This patch fixes fbthrift build compatibility with Boost 1.79.0. The symptom is the following compiler error: ``` /opt/mcrouter-build/fbthrift/thrift/compiler/compiler.cc: In function ‘bool apache::thrift::compiler::{anonymous}::generate(const apache::thrift::compiler::{anonymous}::gen_params&, apache::thrift::compiler::t_program*, std::set >&)’: /opt/mcrouter-build/fbthrift/thrift/compiler/compiler.cc:331:19: error: aggregate ‘std::ofstream genfile’ has incomplete type and cannot be defined 331 | std::ofstream genfile; | ^~~~~~~ make[2]: *** [thrift/compiler/CMakeFiles/thrift1.dir/build.make:76: thrift/compiler/CMakeFiles/thrift1.dir/compiler.cc.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:253: thrift/compiler/CMakeFiles/thrift1.dir/all] Error 2 make: *** [Makefile:152: all] Error 2 ``` To reproduce, install the standard fbthrift dependencies, but with Boost 1.79.0 compiled from source, followed by: ``` $ mkdir build && cd build $ cmake -DCMAKE_BUILD_TYPE=RELEASE CXXFLAGS="-fPIC" .. $ make -j ``` Adding an include on `fstream` allows for the build to complete successfully. Pull Request resolved: https://github.com/facebook/fbthrift/pull/494 Reviewed By: iahs Differential Revision: D35709922 Pulled By: vitaut fbshipit-source-id: 96f0764c7b33047acb7b5ad26b21076757aaa5e7 --- thrift/compiler/compiler.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/thrift/compiler/compiler.cc b/thrift/compiler/compiler.cc index 721ff7dbf3..da944c2950 100644 --- a/thrift/compiler/compiler.cc +++ b/thrift/compiler/compiler.cc @@ -32,6 +32,7 @@ #include #endif #include +#include #include #include -- 2.34.1.windows.1