From 6b046aa61b7b50ac96c44d7c6756b880ccf90456 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 5 Nov 2014 12:19:27 +0100 Subject: [PATCH] Fix compilation using latest ndk (10c), now using gcc 4.8 instead of 4.6 (deprecated) --- Makefile | 6 ++++-- README | 2 +- jni/Application.mk | 1 - patches/ffmpeg_configh.patch | 20 ++++++++++++++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 patches/ffmpeg_configh.patch diff --git a/Makefile b/Makefile index df25baf0c..0b2225d10 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ NDK_PATH=$(shell dirname `which ndk-build`) SDK_PATH=$(shell dirname `which android`) SDK_PLATFORM_TOOLS_PATH=$(shell dirname `which adb`) -ARM_COMPILER_PATH=`find "$(NDK_PATH)" -name "arm-linux-androideabi-gcc*" -print -quit` +ARM_COMPILER_PATH=`find "$(NDK_PATH)" -name "arm-linux-androideabi-gcc-4*" -print | tail -1` ARM_TOOLCHAIN_PATH=$(shell dirname $(ARM_COMPILER_PATH))/arm-linux-androideabi- ARM_SYSROOT=$(shell find "${NDK_PATH}" -name arch-arm -print | \ awk '{n = split($$0,a,"/"); \ @@ -10,7 +10,7 @@ ARM_SYSROOT=$(shell find "${NDK_PATH}" -name arch-arm -print | \ print $$0 " " b[2]}' | \ sort -g -k 2 | \ awk '{ print $$1 }' | tail -1) -X86_COMPILER_PATH=`find "$(NDK_PATH)" -name "i686-linux-android-gcc*" -print -quit` +X86_COMPILER_PATH=`find "$(NDK_PATH)" -name "i686-linux-android-gcc-4*" -print | tail -1` X86_TOOLCHAIN_PATH=$(shell dirname $(X86_COMPILER_PATH))/i686-linux-android- X86_SYSROOT=$(shell find "${NDK_PATH}" -name arch-x86 -print | \ awk '{n = split($$0,a,"/"); \ @@ -144,6 +144,7 @@ $(FFMPEG_BUILD_DIR)/arm/libavcodec/libavcodec-linphone-arm.so: mkdir -p $(FFMPEG_BUILD_DIR)/arm && \ cd $(FFMPEG_BUILD_DIR)/arm && \ $(FFMPEG_SRC_DIR)/configure $(FFMPEG_CONFIGURE_OPTIONS) $(FFMPEG_ARM_CONFIGURE_OPTIONS) && \ + patch -p0 < $(TOPDIR)/patches/ffmpeg_configh.patch && \ make -j ${NUMCPUS} \ || ( echo "Build of ffmpeg for arm failed." ; exit 1 ) @@ -151,6 +152,7 @@ $(FFMPEG_BUILD_DIR)/x86/libavcodec/libavcodec-linphone-x86.so: mkdir -p $(FFMPEG_BUILD_DIR)/x86 && \ cd $(FFMPEG_BUILD_DIR)/x86 && \ $(FFMPEG_SRC_DIR)/configure $(FFMPEG_CONFIGURE_OPTIONS) $(FFMPEG_X86_CONFIGURE_OPTIONS) && \ + patch -p0 < $(TOPDIR)/patches/ffmpeg_configh.patch && \ make -j ${NUMCPUS} \ || ( echo "Build of ffmpeg for x86 failed." ; exit 1 ) diff --git a/README b/README index 456147ab4..634d3011a 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ To build liblinphone for Android, you must: 0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path. -1) download the Android ndk (>=r9d, < r10) from google and add it to your path (no symlink !!!). +1) download the Android ndk (>=10c) from google and add it to your path (no symlink !!!). 2) install yasm, nasm, curl, ant, rsync and the autotools: autoconf, automake, aclocal, libtoolize, pkgconfig On 64 bits linux systems you'll need the ia32-libs package With the latest Debian (multiarch), you need this: diff --git a/jni/Application.mk b/jni/Application.mk index b9b66a9b9..bb68dab84 100644 --- a/jni/Application.mk +++ b/jni/Application.mk @@ -1,5 +1,4 @@ APP_PROJECT_PATH := $(call my-dir)/../ -NDK_TOOLCHAIN_VERSION := 4.8 ifeq ($(BUILD_MEDIASTREAMER2_SDK),) BUILD_MEDIASTREAMER2_SDK=0 diff --git a/patches/ffmpeg_configh.patch b/patches/ffmpeg_configh.patch new file mode 100644 index 000000000..54a8659c5 --- /dev/null +++ b/patches/ffmpeg_configh.patch @@ -0,0 +1,20 @@ +--- config.h2 2014-11-05 11:24:36.723553170 +0100 ++++ config.h 2014-11-05 11:36:45.418743875 +0100 +@@ -182,7 +182,7 @@ + #define HAVE_FCNTL 1 + #define HAVE_FORK 1 + #define HAVE_GETADDRINFO 0 +-#define HAVE_GETHRTIME 1 ++#define HAVE_GETHRTIME 0 + #define HAVE_GETOPT 1 + #define HAVE_GETPROCESSAFFINITYMASK 0 + #define HAVE_GETPROCESSMEMORYINFO 0 +@@ -254,7 +254,7 @@ + #define HAVE_SYMVER_ASM_LABEL 0 + #define HAVE_SYMVER_GNU_ASM 1 + #define HAVE_SYSCONF 1 +-#define HAVE_SYSCTL 1 ++#define HAVE_SYSCTL 0 + #define HAVE_SYS_MMAN_H 1 + #define HAVE_SYS_PARAM_H 1 + #define HAVE_SYS_RESOURCE_H 1