Skip to content

Fix TensorFlow Lite build error with Android NDK (#102572) #102674

Merged
copybara-service[bot] merged 1 commit intotensorflow:masterfrom
jameslovespancakes:fix-tflite-android-ndk-build
Nov 10, 2025
Merged

Fix TensorFlow Lite build error with Android NDK (#102572) #102674
copybara-service[bot] merged 1 commit intotensorflow:masterfrom
jameslovespancakes:fix-tflite-android-ndk-build

Conversation

@jameslovespancakes
Copy link
Contributor

Fix TensorFlow Lite build error with Android NDK (#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

@google-ml-butler google-ml-butler bot added the size:XS CL Change Size: Extra Small label Oct 21, 2025
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow#102572
@jameslovespancakes jameslovespancakes force-pushed the fix-tflite-android-ndk-build branch from 740e5f4 to ef974d2 Compare October 21, 2025 18:26
@google-ml-butler google-ml-butler bot added the awaiting review Pull request awaiting review label Oct 22, 2025
@github-project-automation github-project-automation bot moved this to Assigned Reviewer in PR Queue Oct 22, 2025
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Oct 22, 2025
@github-project-automation github-project-automation bot moved this from Assigned Reviewer to Approved by Reviewer in PR Queue Oct 22, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Oct 22, 2025
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Oct 22, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

FUTURE_COPYBARA_INTEGRATE_REVIEW=tensorflow/tensorflow#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e
PiperOrigin-RevId: 822651695
@keerthanakadiri keerthanakadiri removed the awaiting review Pull request awaiting review label Oct 23, 2025
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Oct 23, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

FUTURE_COPYBARA_INTEGRATE_REVIEW=tensorflow/tensorflow#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e
PiperOrigin-RevId: 822651695
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Oct 23, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

FUTURE_COPYBARA_INTEGRATE_REVIEW=tensorflow/tensorflow#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e
PiperOrigin-RevId: 822651695
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Oct 23, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

FUTURE_COPYBARA_INTEGRATE_REVIEW=tensorflow/tensorflow#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e
PiperOrigin-RevId: 822651695
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Oct 23, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

FUTURE_COPYBARA_INTEGRATE_REVIEW=tensorflow/tensorflow#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e
PiperOrigin-RevId: 822651695
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Oct 23, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

FUTURE_COPYBARA_INTEGRATE_REVIEW=tensorflow/tensorflow#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e
PiperOrigin-RevId: 822651695
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Oct 23, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

FUTURE_COPYBARA_INTEGRATE_REVIEW=tensorflow/tensorflow#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e
PiperOrigin-RevId: 822651695
@keerthanakadiri keerthanakadiri added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Nov 4, 2025
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Nov 4, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

FUTURE_COPYBARA_INTEGRATE_REVIEW=tensorflow/tensorflow#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e
PiperOrigin-RevId: 827760300
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Nov 10, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

FUTURE_COPYBARA_INTEGRATE_REVIEW=tensorflow/tensorflow#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e
PiperOrigin-RevId: 827760300
copybara-service bot pushed a commit to google-ai-edge/LiteRT that referenced this pull request Nov 10, 2025
Imported from GitHub PR tensorflow/tensorflow#102674

Fix TensorFlow Lite build error with Android NDK (tensorflow/tensorflow#102572)
Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes tensorflow/tensorflow#102572
Copybara import of the project:

--
ef974d25fa30a0b21fbb09f34a58a8f95dc3a69e by jameslovespancakes <jmlenhard@wm.edu>:

Fix TensorFlow Lite build error with Android NDK (#102572)

Guard sys/types.h include to prevent build failures on Windows and
certain Android NDK configurations.

The file_util.h header unconditionally included <sys/types.h>, which
is not available or doesn't properly define off_t on Windows. Since
the code already handles Windows separately by using __int64 for the
Offset type alias instead of off_t, the sys/types.h include is only
needed on POSIX systems.

This fix adds a platform guard to only include sys/types.h on
non-Windows platforms, preventing compilation errors when building
TensorFlow Lite for Android with CMake and Android NDK.

Fixes #102572

Merging this change closes #102674

PiperOrigin-RevId: 830514085
@copybara-service copybara-service bot merged commit 6b3273c into tensorflow:master Nov 10, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from Approved by Reviewer to Closed/Rejected in PR Queue Nov 10, 2025
@github-project-automation github-project-automation bot moved this from Closed/Rejected to Merged in PR Queue Nov 10, 2025
copybara-service bot pushed a commit that referenced this pull request Nov 10, 2025
…e GCUs.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#102674 from jameslovespancakes:fix-tflite-android-ndk-build ef974d2
PiperOrigin-RevId: 829509249
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to pull PR ready for merge process size:XS CL Change Size: Extra Small

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

build tersonflow-lite error

5 participants