Fix TensorFlow Lite build error with Android NDK (#102572) #102674
Merged
copybara-service[bot] merged 1 commit intotensorflow:masterfrom Nov 10, 2025
Merged
Conversation
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
740e5f4 to
ef974d2
Compare
mihaimaruseac
approved these changes
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
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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