Compile changes

Using assorted changes gotten from Huss we've managed to make it work with a few caveats:
-You need to open android studio via the terminal
-Certain libraries (OpenSSL) needed to be updated
-Rust Tool Chain has to be updated
-New NDK is 25, which changes and removes certain things from the per-architecture make files to the general make file (LD, AR, AS, RANLIB, STRIP)
pull/21/head M1_Compile
Sascha Bacardit 3 months ago
parent feaf96fdc5
commit 009c20f919
  1. 1
      Makefile.conf
  2. 7
      android/README.md
  3. 8
      android/build.gradle
  4. 10
      android/external/Makefile.conf
  5. 15
      android/external/arm64-v8a/Makefile
  6. 13
      android/external/armeabi-v7a/Makefile
  7. 1
      android/external/downloads/openssl-1.1.1h.tar.gz.md5
  8. 1
      android/external/downloads/openssl-1.1.1q.tar.gz.md5
  9. 21
      android/external/x86/Makefile
  10. 13
      android/external/x86_64/Makefile
  11. 2
      utils/ndk_toolchains_path.py

@ -21,7 +21,6 @@ ENGINE_INC_PATH=$(PREFIX)/include
AD_LIB_PATH=$(PREFIX)/lib
AD_INC_PATH=$(PREFIX)/include
### Guessing JAVA_HOME
ifeq ($(PLATFORM),linux)
JAVA_HOME=$(subst /bin,,$(dir $(realpath /usr/bin/javac)))

@ -16,13 +16,13 @@ It can be done with the SDK and the sdkmanager cli tool, or using Android Studio
Android studio -> Configure -> SDK Manager -> SDK Tools (tab) -> Select NDK and install
Tip: To install other versions click on "Show packages details" and select the desired NDK version (Currently using: 21.0.6113669)
Tip: To install other versions click on "Show packages details" and select the desired NDK version (Currently using: 25.1.8937393)
## Required env\_vars (for MacOS):
``` bash
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export ANDROID_NDK=$ANDROID_SDK/ndk/21.0.6113669
export JAVA_HOME=$(/usr/libexec/java_home -v 11)
export ANDROID_NDK=$ANDROID_SDK/ndk/25.1.8937393
export HOST_TAG=darwin-x86_64
export ANDROID_MIN_SDK_32=18
export ANDROID_MIN_SDK_64=21
@ -39,6 +39,7 @@ rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-andro
Tell rust the location of the new target linker and AR
TODO: Update and point to llvm-ar
```bash
echo "
[target.aarch64-linux-android]

@ -2,8 +2,10 @@
def pEpEngineSrc = hasProperty('pEpEngineSrc') ? pEpEngineSrc : "../../pEpEngine"
def buildAutomatic = hasProperty('buildAutomatic') ? buildAutomatic : "true"
def threadsToUse = hasProperty('threadsToUse') ?
threadsToUse : Runtime.getRuntime().availableProcessors()
//CHeck M1 answers the correct thing off .avaialableprocessors here
//def threadsToUse = hasProperty('threadsToUse') ?
// threadsToUse : Runtime.getRuntime().availableProcessors()
def threadsToUse = 1
def pEpEngineDB = new File(new File(pEpEngineSrc), 'db')
@ -145,7 +147,7 @@ android {
from file(new File(pEpEngineDB, 'system.db'))
into 'assets'
}
ndkVersion '21.0.6113669'
ndkVersion '25.1.8937393'
if(buildAutomatic == "true") {
buildpEpEngineSystemDB.dependsOn(buildExternal)

@ -16,8 +16,16 @@ else
TOOLCHAIN_ARCH=linux-x86_64
endif
ANDROID_NDK_HOME=$(ANDROID_NDK)/toolchains/llvm/prebuilt/$(TOOLCHAIN_ARCH)
### Toolchain tools
LD := $(ANDROID_NDK_HOME)/bin/ld
AR := $(ANDROID_NDK_HOME)/bin/llvm-ar
RANLIB := $(ANDROID_NDK_HOME)/bin/llvm-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/llvm-strip
### Sequoia deps versions
OPENSSL_VERSION=1.1.1h
OPENSSL_VERSION=1.1.1q
GMP_VERSION=6.2.1
NETTLE_VERSION=3.7.3

@ -40,15 +40,9 @@ NDK_TOOLCHAIN = $(HOST)-$(NDK_TOOLCHAIN_COMPILER)
TARGET_ARCH_ABI = $(APP_ABI)
include $(ANDROID_NDK)/build/core/toolchains/$(NDK_TOOLCHAIN)/setup.mk
ANDROID_NDK_HOME=$(ANDROID_NDK)/toolchains/llvm/prebuilt/$(TOOLCHAIN_ARCH)
LD := $(ANDROID_NDK_HOME)/bin/$(HOST)-ld
AR := $(ANDROID_NDK_HOME)/bin/$(HOST)-ar
AS := $(ANDROID_NDK_HOME)/bin/$(HOST)-as
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang++
RANLIB := $(ANDROID_NDK_HOME)/bin/$(HOST)-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/$(HOST)-strip
AS := $(CC)
CFLAGS += -DANDROID -I$(LOCAL)/include $(TARGET_CFLAGS) -fPIE -fPIC -std=c99
LDFLAGS += -llog -L$(LOCAL)/lib $(TARGET_LDFLAGS) -pie
@ -291,6 +285,8 @@ nettle/libnettle.so: nettle/Makefile
$(LOCAL)/lib/libnettle.so: nettle/libnettle.so
$(MAKE) -C nettle DESTDIR=$(DESTDIR) prefix=$(prefix) install
cp nettle/libnettle.so $(LOCAL)/lib/libnettle.so
cp nettle/libhogweed.so $(LOCAL)/lib/libhogweed.so
nettle-build: nettle/libnettle.so
@ -305,7 +301,11 @@ CARGO_TARGET_DIR=$(EXTERNAL_ROOT)/../build/
sequoia.src.stamp: ../downloads/sequoia.tar.gz
mkdir -p sequoia
cd sequoia && tar xvf ../$<
$(SED) -i 's,1.48.0,1.49.0,' sequoia/rust-toolchain
cd sequoia && cargo update -p nettle-sys --precise 2.0.8
mkdir -p $(LOCAL)/lib/
# This is a bad fix, we should move this to a common makefile (but not the .conf one)
find -L $(ANDROID_NDK) -name libunwind.a -execdir sh -c 'echo "INPUT(-lunwind)" > $(LOCAL)/lib/libgcc.a' \;
touch $@
sequoia-ffi-clean:
@ -314,6 +314,7 @@ sequoia-ffi-clean:
$(CARGO_TARGET_DIR)/aarch64-linux-android/release/libsequoia_openpgp_ffi.so: sequoia.src.stamp sequoia-deps-build
cd sequoia && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" \
CC="$(CC)" LD="$(LD)" AR="$(AR)" AS="$(AS)" RANLIB=$(RANLIB) STRIP="$(STRIP)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
LD_LIBRARY_PATH=$(LOCAL)/lib/ \
PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig \
PKG_CONFIG_ALLOW_CROSS=1 \

@ -45,13 +45,9 @@ include $(ANDROID_NDK)/build/core/toolchains/$(NDK_TOOLCHAIN)/setup.mk
ANDROID_NDK_HOME=$(ANDROID_NDK)/toolchains/llvm/prebuilt/$(TOOLCHAIN_ARCH)
LD := $(ANDROID_NDK_HOME)/bin/$(HOST)-ld
AR := $(ANDROID_NDK_HOME)/bin/$(HOST)-ar
AS := $(ANDROID_NDK_HOME)/bin/$(HOST)-as
CC := $(ANDROID_NDK_HOME)/bin/$(HOST_V7)$(ANDROID_API)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST_V7)$(ANDROID_API)-clang++
RANLIB := $(ANDROID_NDK_HOME)/bin/$(HOST)-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/$(HOST)-strip
AS := $(CC)
CFLAGS += -DANDROID -I$(LOCAL)/include $(TARGET_CFLAGS) -fPIE -fPIC -std=c99
LDFLAGS += -llog -L$(LOCAL)/lib $(TARGET_LDFLAGS) -pie
@ -294,6 +290,8 @@ nettle/libnettle.so: nettle/Makefile
$(LOCAL)/lib/libnettle.so: nettle/libnettle.so
$(MAKE) -C nettle DESTDIR=$(DESTDIR) prefix=$(prefix) install
cp nettle/libnettle.so $(LOCAL)/lib/libnettle.so
cp nettle/libhogweed.so $(LOCAL)/lib/libhogweed.so
nettle-build: nettle/libnettle.so
@ -307,7 +305,11 @@ CARGO_TARGET_DIR=$(EXTERNAL_ROOT)/../build
sequoia.src.stamp: ../downloads/sequoia.tar.gz
mkdir -p sequoia
cd sequoia && tar xvf ../$<
$(SED) -i 's,1.48.0,1.49.0,' sequoia/rust-toolchain
cd sequoia && cargo update -p nettle-sys --precise 2.0.8
mkdir -p $(LOCAL)/lib/
# This is a bad fix, we should move this to a common makefile (but not the .conf one)
find -L $(ANDROID_NDK) -name libunwind.a -execdir sh -c 'echo "INPUT(-lunwind)" > $(LOCAL)/lib/libgcc.a' \;
touch $@
sequoia-ffi-clean:
@ -316,6 +318,7 @@ sequoia-ffi-clean:
$(CARGO_TARGET_DIR)/armv7-linux-androideabi/release/libsequoia_openpgp_ffi.so: sequoia.src.stamp sequoia-deps-build
cd sequoia && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" \
CC="$(CC)" LD="$(LD)" AR="$(AR)" AS="$(AS)" RANLIB=$(RANLIB) STRIP="$(STRIP)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
LD_LIBRARY_PATH=$(LOCAL)/lib/ \
PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig \
PKG_CONFIG_ALLOW_CROSS=1 \

@ -1 +0,0 @@
53840c70434793127a3574433494e8d3 openssl-1.1.1h.tar.gz

@ -0,0 +1 @@
c685d239b6a6e1bd78be45624c092f51 openssl-1.1.1q.tar.gz

@ -42,13 +42,9 @@ include $(ANDROID_NDK)/build/core/toolchains/$(NDK_TOOLCHAIN)/setup.mk
ANDROID_NDK_HOME=$(ANDROID_NDK)/toolchains/llvm/prebuilt/$(TOOLCHAIN_ARCH)
LD := $(ANDROID_NDK_HOME)/bin/$(HOST)-ld
AR := $(ANDROID_NDK_HOME)/bin/$(HOST)-ar
AS := $(ANDROID_NDK_HOME)/bin/$(HOST)-as
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang++
RANLIB := $(ANDROID_NDK_HOME)/bin/$(HOST)-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/$(HOST)-strip
AS := $(CC)
CFLAGS += -DANDROID -I$(LOCAL)/include $(TARGET_CFLAGS) -fPIE -fPIC -std=c99
LDFLAGS += -llog -L$(LOCAL)/lib $(TARGET_LDFLAGS) -pie
@ -285,15 +281,17 @@ nettle/Makefile: nettle.src.stamp
--host=$(HOST) \
--prefix=$(LOCAL)
nettle/libnettle.so: nettle/Makefile
nettle/libnettle.so nettle/libhogweed.so: nettle/Makefile
$(MAKE) -C nettle
$(LOCAL)/lib/libnettle.so: nettle/libnettle.so
$(LOCAL)/lib/libnettle.so $(LOCAL)/lib/libhogweed.so: nettle/libnettle.so nettle/libhogweed.so
$(MAKE) -C nettle DESTDIR=$(DESTDIR) prefix=$(prefix) install
cp nettle/libnettle.so $(LOCAL)/lib/libnettle.so
cp nettle/libhogweed.so $(LOCAL)/lib/libhogweed.so
nettle-build: nettle/libnettle.so
nettle-build: nettle/libnettle.so nettle/libhogweed.so
nettle-install: $(LOCAL)/lib/libnettle.so
nettle-install: $(LOCAL)/lib/libnettle.so $(LOCAL)/lib/libhogweed.so
#------------------------------------------------------------------------------#
@ -304,7 +302,11 @@ CARGO_TARGET_DIR=$(EXTERNAL_ROOT)/../build/
sequoia.src.stamp: ../downloads/sequoia.tar.gz
mkdir -p sequoia
cd sequoia && tar xvf ../$<
$(SED) -i 's,1.48.0,1.49.0,' sequoia/rust-toolchain
cd sequoia && cargo update -p nettle-sys --precise 2.0.8
mkdir -p $(LOCAL)/lib/
# This is a bad fix, we should move this to a common makefile (but not the .conf one)
find -L $(ANDROID_NDK) -name libunwind.a -execdir sh -c 'echo "INPUT(-lunwind)" > $(LOCAL)/lib/libgcc.a' \;
touch $@
sequoia-ffi-clean:
@ -313,6 +315,7 @@ sequoia-ffi-clean:
$(CARGO_TARGET_DIR)/i686-linux-android/release/libsequoia_openpgp_ffi.so: sequoia.src.stamp sequoia-deps-build
cd sequoia && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" \
CC="$(CC)" LD="$(LD)" AR="$(AR)" AS="$(AS)" RANLIB=$(RANLIB) STRIP="$(STRIP)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
LD_LIBRARY_PATH=$(LOCAL)/lib/ \
PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig \
PKG_CONFIG_ALLOW_CROSS=1 \

@ -42,13 +42,9 @@ include $(ANDROID_NDK)/build/core/toolchains/$(NDK_TOOLCHAIN)/setup.mk
ANDROID_NDK_HOME=$(ANDROID_NDK)/toolchains/llvm/prebuilt/$(TOOLCHAIN_ARCH)
LD := $(ANDROID_NDK_HOME)/bin/$(HOST)-ld
AR := $(ANDROID_NDK_HOME)/bin/$(HOST)-ar
AS := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-as
CC := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang
CXX := $(ANDROID_NDK_HOME)/bin/$(HOST)$(ANDROID_API)-clang++
RANLIB := $(ANDROID_NDK_HOME)/bin/$(HOST)-ranlib
STRIP := $(ANDROID_NDK_HOME)/bin/$(HOST)-strip
AS := $(CC)
CFLAGS += -DANDROID -I$(LOCAL)/include $(TARGET_CFLAGS) -fPIE -fPIC -std=c99
LDFLAGS += -llog -L$(LOCAL)/lib $(TARGET_LDFLAGS) -pie
@ -290,6 +286,8 @@ nettle/libnettle.so: nettle/Makefile
$(LOCAL)/lib/libnettle.so: nettle/libnettle.so
$(MAKE) -C nettle DESTDIR=$(DESTDIR) prefix=$(prefix) install
cp nettle/libnettle.so $(LOCAL)/lib/libnettle.so
cp nettle/libhogweed.so $(LOCAL)/lib/libhogweed.so
nettle-build: nettle/libnettle.so
@ -304,7 +302,11 @@ CARGO_TARGET_DIR=$(EXTERNAL_ROOT)/../build/
sequoia.src.stamp: ../downloads/sequoia.tar.gz
mkdir -p sequoia
cd sequoia && tar xvf ../$<
$(SED) -i 's,1.48.0,1.49.0,' sequoia/rust-toolchain
cd sequoia && cargo update -p nettle-sys --precise 2.0.8
mkdir -p $(LOCAL)/lib/
# This is a bad fix, we should move this to a common makefile (but not the .conf one)
find -L $(ANDROID_NDK) -name libunwind.a -execdir sh -c 'echo "INPUT(-lunwind)" > $(LOCAL)/lib/libgcc.a' \;
touch $@
sequoia-ffi-clean:
@ -313,6 +315,7 @@ sequoia-ffi-clean:
$(CARGO_TARGET_DIR)/x86_64-linux-android/release/libsequoia_openpgp_ffi.so: sequoia.src.stamp sequoia-deps-build
cd sequoia && PATH="$(ANDROID_NDK_HOME)/bin:$(PATH)" \
CC="$(CC)" LD="$(LD)" AR="$(AR)" AS="$(AS)" RANLIB=$(RANLIB) STRIP="$(STRIP)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
LD_LIBRARY_PATH=$(LOCAL)/lib/ \
PKG_CONFIG_PATH=$(LOCAL)/lib/pkgconfig \
PKG_CONFIG_ALLOW_CROSS=1 \

@ -42,7 +42,7 @@ def main():
host_tag = get_host_tag_or_die()
toolchain_path = get_toolchain_path_or_die(args.ndk, host_tag)
print toolchain_path
print(toolchain_path)
if __name__ == '__main__':
main()

Loading…
Cancel
Save