This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 5028c05ece45d67ef1a66264314d742fdc0abad3 Author: wangmingrong1 <[email protected]> AuthorDate: Mon Nov 2 19:00:08 2026 +0800 fix(sim): define _FILE_OFFSET_BITS=64 and _TIME_BITS=64 unconditionally glibc 2.34+ enforces that _TIME_BITS=64 can only be used together with _FILE_OFFSET_BITS=64. Previously these were gated behind CONFIG_FS_LARGEFILE and CONFIG_SIM_M32 respectively, so a 32-bit sim build without CONFIG_FS_LARGEFILE would fail: error: "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" Define both unconditionally for all host objects. This is safe: 1. On 64-bit hosts both are no-ops (off_t/time_t already 64-bit) 2. On 32-bit hosts both are mandatory for modern glibc 3. Host objects use fixed-width nuttx_off_t/nuttx_time_t at the NuttX boundary (nuttx/fs/hostfs.h), so host type widths never leak into NuttX regardless of CONFIG_FS_LARGEFILE state Signed-off-by: wangmingrong1 <[email protected]> --- arch/sim/src/CMakeLists.txt | 4 +--- arch/sim/src/Makefile | 4 +--- arch/sim/src/sim/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/sim/src/CMakeLists.txt b/arch/sim/src/CMakeLists.txt index 1a9a5bd0182..5f1b712691e 100644 --- a/arch/sim/src/CMakeLists.txt +++ b/arch/sim/src/CMakeLists.txt @@ -31,6 +31,4 @@ if(NOT CONFIG_BUILD_FLAT) common) endif() -if(CONFIG_FS_LARGEFILE) - target_compile_options(nuttx PRIVATE -D_FILE_OFFSET_BITS=64) -endif() +target_compile_options(nuttx PRIVATE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64) diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index 1883aee10b3..b92f8eef9bc 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -127,9 +127,7 @@ ifeq ($(CONFIG_SIM_X11FB),y) endif endif -ifeq ($(CONFIG_FS_LARGEFILE),y) - HOSTCFLAGS += -D_FILE_OFFSET_BITS=64 -endif +HOSTCFLAGS += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 HOSTSRCS = sim_hostirq.c sim_hostmemory.c sim_hostmisc.c sim_hosttime.c sim_hostuart.c HOSTSRCS += sim_hostfs.c sim_errno.c diff --git a/arch/sim/src/sim/CMakeLists.txt b/arch/sim/src/sim/CMakeLists.txt index 43a1427d946..dc8b4c72e01 100644 --- a/arch/sim/src/sim/CMakeLists.txt +++ b/arch/sim/src/sim/CMakeLists.txt @@ -34,6 +34,7 @@ if(CONFIG_COVERAGE_TOOLCHAIN) endif() list(APPEND HOST_DEFINITIONS -D__SIM__) +list(APPEND HOST_DEFINITIONS -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64) # common guest sources
