From c213e41eb901ca65bf910d4381c4a07049d794a3 Mon Sep 17 00:00:00 2001 From: Tommy Chiang Date: Thu, 4 Jan 2024 02:50:33 -0800 Subject: [PATCH] Enable Large-file Support (#1726) * Enable Large-file Support This should fix https://github.com/google/benchmark/issues/1725 * Use whitespaces instead of tab in BUILD.bazel --------- Co-authored-by: dominic <510002+dmah42@users.noreply.github.com> --- BUILD.bazel | 4 ++++ CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/BUILD.bazel b/BUILD.bazel index 64188344..c51cd895 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -51,6 +51,10 @@ cc_library( }), defines = [ "BENCHMARK_STATIC_DEFINE", + # Turn on Large-file Support + "_FILE_OFFSET_BITS=64", + "_LARGEFILE64_SOURCE", + "_LARGEFILE_SOURCE", ] + select({ ":perfcounters": ["HAVE_LIBPFM"], "//conditions:default": [], diff --git a/CMakeLists.txt b/CMakeLists.txt index 57572832..e7bce157 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,10 @@ if (MSVC) set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /LTCG") endif() else() + # Turn on Large-file Support + add_definitions(-D_FILE_OFFSET_BITS=64) + add_definitions(-D_LARGEFILE64_SOURCE) + add_definitions(-D_LARGEFILE_SOURCE) # Turn compiler warnings up to 11 add_cxx_compiler_flag(-Wall) add_cxx_compiler_flag(-Wextra)