diff --git a/src/mongo/db/auth/security_key_test.cpp b/src/mongo/db/auth/security_key_test.cpp
index 96f95829..e64aded8 100644
--- src/mongo/db/auth/security_key_test.cpp
+++ src/mongo/db/auth/security_key_test.cpp
@@ -30,6 +30,7 @@
 #include "mongo/platform/basic.h"
 
 #include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
 
 #include "mongo/base/string_data.h"
 #include "mongo/db/auth/authorization_manager.h"
diff --git a/src/mongo/db/repl/tenant_migration_shard_merge_util.cpp b/src/mongo/db/repl/tenant_migration_shard_merge_util.cpp
index 05779a48..011c49e7 100644
--- src/mongo/db/repl/tenant_migration_shard_merge_util.cpp
+++ src/mongo/db/repl/tenant_migration_shard_merge_util.cpp
@@ -32,6 +32,7 @@
 #include "mongo/db/repl/tenant_migration_shard_merge_util.h"
 
 #include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
 #include <boost/filesystem/operations.hpp>
 #include <boost/filesystem/path.hpp>
 #include <fmt/format.h>
diff --git a/src/mongo/db/storage/storage_repair_observer.cpp b/src/mongo/db/storage/storage_repair_observer.cpp
index 22b76a6a..ec5bcece 100644
--- src/mongo/db/storage/storage_repair_observer.cpp
+++ src/mongo/db/storage/storage_repair_observer.cpp
@@ -41,6 +41,7 @@
 #include <sys/types.h>
 #endif
 
+#include <boost/filesystem/fstream.hpp>
 #include <boost/filesystem/path.hpp>
 
 #include "mongo/db/dbhelpers.h"
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index 2c5a6ed5..6c98c384 100644
--- src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -48,6 +48,7 @@
 #include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h"
 
 #include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
 #include <boost/filesystem/operations.hpp>
 #include <boost/filesystem/path.hpp>
 #include <boost/system/error_code.hpp>
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp
index 9917d95e..c4073444 100644
--- src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp
+++ src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp
@@ -34,6 +34,7 @@
 #include "mongo/db/storage/kv/kv_engine_test_harness.h"
 
 #include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
 #include <boost/filesystem/path.hpp>
 #include <memory>
 
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
index de31ec10..c29fbd33 100644
--- src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
+++ src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
@@ -36,6 +36,7 @@
 #include <limits>
 
 #include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
 #include <boost/filesystem/path.hpp>
 
 #include "mongo/base/simple_string_data_comparator.h"
diff --git a/src/mongo/shell/shell_utils_extended.cpp b/src/mongo/shell/shell_utils_extended.cpp
index 6cd6dc6e..318d6a8d 100644
--- src/mongo/shell/shell_utils_extended.cpp
+++ src/mongo/shell/shell_utils_extended.cpp
@@ -37,6 +37,7 @@
 #endif
 
 #include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
 #include <fmt/format.h>
 #include <fstream>
 
diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
index 37e3d2ea..9027110d 100644
--- src/mongo/util/processinfo_linux.cpp
+++ src/mongo/util/processinfo_linux.cpp
@@ -36,6 +36,7 @@
 #include <iostream>
 #include <malloc.h>
 #include <pcrecpp.h>
+#include <fstream>
 #include <sched.h>
 #include <stdio.h>
 #include <sys/mman.h>
diff --git a/src/mongo/util/stacktrace_threads.cpp b/src/mongo/util/stacktrace_threads.cpp
index d7157d0e..3aca6357 100644
--- src/mongo/util/stacktrace_threads.cpp
+++ src/mongo/util/stacktrace_threads.cpp
@@ -36,6 +36,7 @@
 #include <array>
 #include <atomic>
 #include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
 #include <cstdint>
 #include <cstdlib>
 #include <dirent.h>
