Browse Source

Drop -D_FILE_OFFSET_BITS=64 support for now

32-bit android uses 32-bit off_t by default. When building with
-D_FILE_OFFSET_BITS=64 with unified headers off_t are promoted
to 64-bit, but there are bugs in the toolchain and spotty support
for it in the platform (not all functions are available until
android-24, and the platform zlib is compiled with 32-bit off_t).

Also, unless every library&program is rebuilt with 64-bit off_t,
including user-built ones, we risk a mismatch between programs and
libraries which can cause serious (but sometimes subtle) runtime
failures.

As -D_FILE_OFFSET_BITS=64 is not that important for most users
(with mariadb requiring it as an exception), we drop the support
for now by patching it away in <sys/cdefs.h>.
android-5
Fredrik Fornwall 8 years ago
parent
commit
2173f7301d
  1. 5
      build-package.sh
  2. 17
      ndk-patches/sys-cdefs.h.patch
  3. 2
      packages/coreutils/build.sh
  4. 5
      packages/mariadb/build.sh
  5. 2
      packages/ndk-sysroot/build.sh
  6. 2
      packages/openssh/build.sh

5
build-package.sh

@ -221,7 +221,7 @@ termux_step_setup_variables() {
TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/${TERMUX_NDK_VERSION}-${TERMUX_ARCH}-${TERMUX_API_LEVEL}"
# Bump the below version if a change is made in toolchain setup to ensure
# that everyone gets an updated toolchain:
TERMUX_STANDALONE_TOOLCHAIN+="-v5"
TERMUX_STANDALONE_TOOLCHAIN+="-v6"
export prefix=${TERMUX_PREFIX}
export PREFIX=${TERMUX_PREFIX}
@ -451,7 +451,7 @@ termux_step_setup_toolchain() {
# We put this after system PATH to avoid picking up toolchain stripped python
export PATH=$PATH:$TERMUX_STANDALONE_TOOLCHAIN/bin
export CFLAGS=""
export CFLAGS="" #-Werror=implicit-function-declaration"
export LDFLAGS="-L${TERMUX_PREFIX}/lib"
if [ "$TERMUX_PKG_CLANG" = "no" ]; then
@ -516,6 +516,7 @@ termux_step_setup_toolchain() {
export ac_cv_func_getpwent=no
export ac_cv_func_getpwnam=no
export ac_cv_func_getpwuid=no
export ac_cv_func_sigsetmask=no
if [ ! -d $TERMUX_STANDALONE_TOOLCHAIN ]; then
# Do not put toolchain in place until we are done with setup, to avoid having a half setup

17
ndk-patches/sys-cdefs.h.patch

@ -0,0 +1,17 @@
diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/sys/cdefs.h ./usr/include/sys/cdefs.h
--- /home/fornwall/lib/android-ndk/sysroot/usr/include/sys/cdefs.h 2017-06-20 17:41:56.000000000 +0200
+++ ./usr/include/sys/cdefs.h 2017-07-07 03:27:59.327850834 +0200
@@ -234,13 +234,6 @@
# define __USE_BSD 1
#endif
-/* _FILE_OFFSET_BITS 64 support. */
-#if !defined(__LP64__) && defined(_FILE_OFFSET_BITS)
-#if _FILE_OFFSET_BITS == 64
-#define __USE_FILE_OFFSET64 1
-#endif
-#endif
-
#define __BIONIC__ 1
#include <android/api-level.h>

2
packages/coreutils/build.sh

@ -1,7 +1,7 @@
TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/coreutils/
TERMUX_PKG_DESCRIPTION="Basic file, shell and text manipulation utilities from the GNU project"
TERMUX_PKG_VERSION=8.27
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/coreutils/coreutils-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=8891d349ee87b9ff7870f52b6d9312a9db672d2439d289bc57084771ca21656b
# pinky has no usage on Android.

5
packages/mariadb/build.sh

@ -46,6 +46,9 @@ TERMUX_PKG_DEPENDS="liblzma, ncurses, libedit, openssl, pcre, libcrypt, libandro
TERMUX_PKG_MAINTAINER="Vishal Biswas @vishalbiswas"
TERMUX_PKG_CONFLICTS="mysql"
TERMUX_PKG_RM_AFTER_INSTALL="bin/mysqltest*"
# Does not build with 32-bit off_t, and Termux does not use
# _FILE_OFFSET_BITS=64 as it doesn't work very well on Android.
TERMUX_PKG_BLACKLISTED_ARCHES="arm,i686"
termux_step_host_build () {
termux_setup_cmake
@ -59,7 +62,7 @@ termux_step_host_build () {
termux_step_pre_configure () {
# it will try to define off64_t with off_t if unset
# and 32 bit Android has wrong off_t defined
CPPFLAGS="$CPPFLAGS -Dushort=u_short -D__off64_t_defined"
CPPFLAGS="$CPPFLAGS -Dushort=u_short"
if [ $TERMUX_ARCH = "i686" ]; then
# Avoid undefined reference to __atomic_load_8:

2
packages/ndk-sysroot/build.sh

@ -1,7 +1,7 @@
TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html
TERMUX_PKG_DESCRIPTION="System header and library files from the Android NDK needed for compiling C programs"
TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_NO_DEVELSPLIT=yes
# Depend on libandroid-support-dev so that iconv.h and libintl.h are available:
TERMUX_PKG_DEPENDS="libandroid-support-dev"

2
packages/openssh/build.sh

@ -1,7 +1,7 @@
TERMUX_PKG_HOMEPAGE=https://www.openssh.com/
TERMUX_PKG_DESCRIPTION="Secure shell for logging into a remote machine"
TERMUX_PKG_VERSION=7.5p1
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=http://mirrors.evowise.com/pub/OpenBSD/OpenSSH/portable/openssh-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=9846e3c5fab9f0547400b4d2c017992f914222b3fd1f8eee6c7dc6bc5e59f9f0
TERMUX_PKG_DEPENDS="libandroid-support, ldns, openssl, libedit, libutil"

Loading…
Cancel
Save