Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose -DBUILD_WITHOUT_64BIT_OFFSET #5941

Merged
merged 2 commits into from Jun 20, 2022

Conversation

m-kuhn
Copy link
Contributor

@m-kuhn m-kuhn commented Jun 20, 2022

to allow building for 32bit Android

to allow building for 32bit Android.
@m-kuhn m-kuhn force-pushed the build_without_64bit_offset branch from a25f6d4 to 551b67b Compare June 20, 2022 11:01
@rouault
Copy link
Member

rouault commented Jun 20, 2022

to allow building for 32bit Android

As far as I can see from https://github.com/OSGeo/gdal/runs/6955472239?check_suite_focus=true which is the autoconf Android build of https://github.com/OSGeo/gdal/blob/master/.github/workflows/android/start.sh , 64-bit I/O is correctly supported and this is a 32 bit build

checking for 64bit file io... yes
checking for stat64... yes
checking for fopen64... yes
checking for ftruncate64... yes
checking size of int... 4
checking size of unsigned long... 4
checking size of void*... 4

So I assume that there's something missing in the CMake detection logic (our CMake Android build https://github.com/OSGeo/gdal/blob/master/.github/workflows/android_cmake/start.sh is a 64-bit one)

@m-kuhn
Copy link
Contributor Author

m-kuhn commented Jun 20, 2022

That's what I got here (x86-android)

[73/939] /usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=i686-none-linux-android21 --gcc-toolchain=/usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DDONT_DEPRECATE_SPRINTF -DENABLE_UFFD -DGDAL_CMAKE_BUILD -DGDAL_COMPILATION -DHAVE_LIBZ -DHAVE_ZLIB -DHAVE_ZLIB_H -DINST_DATA=\"/home/runner/work/QField/QField/vcpkg/base/packages/gdal_x86-android/share/gdal\" -DSYSCONFDIR=\"/home/runner/work/QField/QField/vcpkg/base/packages/gdal_x86-android/etc\" -DZIP_SUPPORT -I/home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/src/v3.5.0RC2-9048b93868.clean/port -I/home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/x86-android-rel/port -I/home/runner/builddir/vcpkg_installed/x86-android/include/json-c -I/home/runner/builddir/vcpkg_installed/x86-android/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -frtti -fexceptions  -fPIC -fstack-protector-strong  -fvisibility=hidden -O2 -DNDEBUG    -Wall -Wextra -Winit-self -Wunused-parameter -Wmissing-declarations -Wshorten-64-to-32 -Wshadow -Wshadow-field -Wmissing-include-dirs -Wformat -Werror=format-security -Wno-format-nonliteral -Werror=vla -Wdate-time -Wnull-dereference -Wextra-semi -Wcomma -Wfloat-conversion -Wdocumentation -Wno-documentation-deprecated-sync -Wunused-private-field -Wnon-virtual-dtor -Woverloaded-virtual -Wsuggest-override -fno-operator-names -Wzero-as-null-pointer-constant -Wold-style-cast -Weffc++ -pthread -std=gnu++11 -MD -MT port/CMakeFiles/cpl.dir/cpl_vsil_unix_stdio_64.cpp.o -MF port/CMakeFiles/cpl.dir/cpl_vsil_unix_stdio_64.cpp.o.d -o port/CMakeFiles/cpl.dir/cpl_vsil_unix_stdio_64.cpp.o -c /home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/src/v3.5.0RC2-9048b93868.clean/port/cpl_vsil_unix_stdio_64.cpp
FAILED: port/CMakeFiles/cpl.dir/cpl_vsil_unix_stdio_64.cpp.o 
/usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=i686-none-linux-android21 --gcc-toolchain=/usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/usr/local/lib/android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DDONT_DEPRECATE_SPRINTF -DENABLE_UFFD -DGDAL_CMAKE_BUILD -DGDAL_COMPILATION -DHAVE_LIBZ -DHAVE_ZLIB -DHAVE_ZLIB_H -DINST_DATA=\"/home/runner/work/QField/QField/vcpkg/base/packages/gdal_x86-android/share/gdal\" -DSYSCONFDIR=\"/home/runner/work/QField/QField/vcpkg/base/packages/gdal_x86-android/etc\" -DZIP_SUPPORT -I/home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/src/v3.5.0RC2-9048b93868.clean/port -I/home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/x86-android-rel/port -I/home/runner/builddir/vcpkg_installed/x86-android/include/json-c -I/home/runner/builddir/vcpkg_installed/x86-android/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -frtti -fexceptions  -fPIC -fstack-protector-strong  -fvisibility=hidden -O2 -DNDEBUG    -Wall -Wextra -Winit-self -Wunused-parameter -Wmissing-declarations -Wshorten-64-to-32 -Wshadow -Wshadow-field -Wmissing-include-dirs -Wformat -Werror=format-security -Wno-format-nonliteral -Werror=vla -Wdate-time -Wnull-dereference -Wextra-semi -Wcomma -Wfloat-conversion -Wdocumentation -Wno-documentation-deprecated-sync -Wunused-private-field -Wnon-virtual-dtor -Woverloaded-virtual -Wsuggest-override -fno-operator-names -Wzero-as-null-pointer-constant -Wold-style-cast -Weffc++ -pthread -std=gnu++11 -MD -MT port/CMakeFiles/cpl.dir/cpl_vsil_unix_stdio_64.cpp.o -MF port/CMakeFiles/cpl.dir/cpl_vsil_unix_stdio_64.cpp.o.d -o port/CMakeFiles/cpl.dir/cpl_vsil_unix_stdio_64.cpp.o -c /home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/src/v3.5.0RC2-9048b93868.clean/port/cpl_vsil_unix_stdio_64.cpp
/home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/src/v3.5.0RC2-9048b93868.clean/port/cpl_vsil_unix_stdio_64.cpp:139:1: error: static_assert failed due to requirement 'sizeof (ftello(nullptr)) == sizeof(unsigned long long)' "File API does not seem to support 64-bit offset. If you still want to build GDAL without > 4GB file support, add the -DBUILD_WITHOUT_64BIT_OFFSET define"
static_assert( sizeof(VSI_FTELL64(nullptr)) == sizeof(vsi_l_offset),
^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/src/v3.5.0RC2-9048b93868.clean/port/cpl_vsil_unix_stdio_64.cpp:315:42: warning: implicit conversion loses integer precision: 'vsi_l_offset' (aka 'unsigned long long') to 'off_t' (aka 'long') [-Wshorten-64-to-32]
    const int nResult = VSI_FSEEK64( fp, nOffsetIn, nWhence );
                        ~~~~~~~~~~~      ^~~~~~~~~
/home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/src/v3.5.0RC2-9048b93868.clean/port/cpl_vsil_unix_stdio_64.cpp:422:30: warning: implicit conversion loses integer precision: 'vsi_l_offset' (aka 'unsigned long long') to 'off_t' (aka 'long') [-Wshorten-64-to-32]
        if( VSI_FSEEK64( fp, m_nOffset, SEEK_SET ) != 0 )
            ~~~~~~~~~~~      ^~~~~~~~~
/home/runner/work/QField/QField/vcpkg/base/buildtrees/gdal/src/v3.5.0RC2-9048b93868.clean/port/cpl_vsil_unix_stdio_64.cpp:484:30: warning: implicit conversion loses integer precision: 'vsi_l_offset' (aka 'unsigned long long') to 'off_t' (aka 'long') [-Wshorten-64-to-32]
        if( VSI_FSEEK64( fp, m_nOffset, SEEK_SET ) != 0 )
            ~~~~~~~~~~~      ^~~~~~~~~
3 warnings and 1 error generated.

@m-kuhn
Copy link
Contributor Author

m-kuhn commented Jun 20, 2022

For reference with the same environment this also had to be disabled with autoconf.

@rouault
Copy link
Member

rouault commented Jun 20, 2022

Perhaps related to https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md : "Android does not require the _LARGEFILE_SOURCE macro to be used to make fseeko and ftello available. Instead they're always available from API level 24 where they were introduced, and never available before then." . Can you bump API level to 24 ?

@m-kuhn
Copy link
Contributor Author

m-kuhn commented Jun 20, 2022

Thanks for the insights.
For the moment we try to keep old hardware running (Down to Android 5).
Especially 32 bit hardware very often runs an API level <24 (< Android 7). Given that, limitation on file size sounds preferable to me.
We'll build for newer hardware (64bit) with this flag disabled.

Co-authored-by: Matthias Kuhn <matthias@opengis.ch>
@rouault
Copy link
Member

rouault commented Jun 20, 2022

For the moment we try to keep old hardware running (Down to Android 5).

ok, makes sense.

@rouault rouault merged commit 6be8e18 into OSGeo:master Jun 20, 2022
@m-kuhn m-kuhn deleted the build_without_64bit_offset branch June 20, 2022 15:13
g8sqh pushed a commit to g8sqh/gdal that referenced this pull request Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants