From 2173f7301d6332bbdb7c9c4d1aa25ddce6ff5964 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Fri, 7 Jul 2017 03:52:46 +0200 Subject: [PATCH] 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 . --- build-package.sh | 5 +++-- ndk-patches/sys-cdefs.h.patch | 17 +++++++++++++++++ packages/coreutils/build.sh | 2 +- packages/mariadb/build.sh | 5 ++++- packages/ndk-sysroot/build.sh | 2 +- packages/openssh/build.sh | 2 +- 6 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 ndk-patches/sys-cdefs.h.patch diff --git a/build-package.sh b/build-package.sh index a382020d..b3871818 100755 --- a/build-package.sh +++ b/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 diff --git a/ndk-patches/sys-cdefs.h.patch b/ndk-patches/sys-cdefs.h.patch new file mode 100644 index 00000000..3842b337 --- /dev/null +++ b/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 + diff --git a/packages/coreutils/build.sh b/packages/coreutils/build.sh index 47556be7..c1ea3964 100755 --- a/packages/coreutils/build.sh +++ b/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. diff --git a/packages/mariadb/build.sh b/packages/mariadb/build.sh index 9035f4fd..a27bfd7a 100644 --- a/packages/mariadb/build.sh +++ b/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: diff --git a/packages/ndk-sysroot/build.sh b/packages/ndk-sysroot/build.sh index 549b5b78..6500d3b0 100644 --- a/packages/ndk-sysroot/build.sh +++ b/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" diff --git a/packages/openssh/build.sh b/packages/openssh/build.sh index 34d21e3d..7aa80b94 100755 --- a/packages/openssh/build.sh +++ b/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" -- 2.11.0