Building instruction on github page aren't working

I have done:

  • git clone --recursive GitHub - deltachat/deltachat-android: Email-based instant messaging for Android.

  • sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386

  • Android studio Bumblebee 2021.11 was installed, because I have rebuild several other apk’s before

  • NDK version 21 til 25 are installed in ~/Android/SDK because I have rebuild several other apk’s before

  • open deltachat-android in Android studio

  • run in AWD Pixel5 Android12 emulation.

  • app was installed, but crahes after opening

  • log: libnative-utils.so not found

  • build fatDebug apk

  • installed apk on Redmi Note 10 Android12 device

  • app crashes after opening

  • logcat is showing: libnative-utils.so not found

in web I have found that I should run build-ndk in home folder of app sources.

  • error messages:
    Android NDK: ERROR:jni/Android.mk:deltachat-core-rust: LOCAL_SRC_FILES points to a missing file
    Android NDK: Check that jni/armeabi-v7a/libdeltachat.a exists or that its path is correct
    /home/ich/Android/Sdk/ndk/25.0.8221429/build/core/prebuilt-library.mk:51: *** Android NDK: Aborting . Schluss.

So, why does the building / comiling is not working ??
I have build succesfull Threema and Matrix client. All working fine. So I think it’s not an issue on my build environment

have you built deltachat core? you need rustup installed and some rust targets installed (for the 4 architectures android could have)

You could probably skip the architectures that are not your phone, that would result in a smaller apk, but you can then only run it on phones with that specific processor architecture

I’m have found out that I have to run ./ndk-make.sh in root of sources not of pc. But now I’m getting a build error
— stderr
/bin/sh: 1: armv7a-linux-androideabi16-clang: not found
make[1]: *** [Makefile:662: crypto/aes/aes_cbc.o] Error 127
make[1]: *** Waiting for unfinished jobs…
/bin/sh: 1: armv7a-linux-androideabi16-clang: not found
make[1]: *** [Makefile:666: crypto/aes/aes_ecb.o] Error 127
/bin/sh: 1: armv7a-linux-androideabi16-clang: not found
/bin/sh: 1: armv7a-linux-androideabi16-clang: not found
make[1]: *** [Makefile:668: crypto/aes/aes_ige.o] Error 127
make[1]: *** [Makefile:664: crypto/aes/aes_cfb.o] Error 127
make: *** [Makefile:172: build_libs] Fehler 2
thread ‘main’ panicked at ’

Error building OpenSSL:
Command: “make” “build_libs”
Exit status: exit status: 2

  ', /home/ich/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.18.0+1.1.1n/src/lib.rs:479:13

note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

in the build instructions is nothing about building deltachat core

install the build stuff for openssl on your OS maybe?

in the build instructions is nothing about building deltachat core

readme in the android repo:

Then, install Rust using rustup. Install Rust toolchains for cross-compilation by executing scripts/install-toolchains.sh.

After that, call ./ndk-make.sh in the root directory to build core-rust. Afterwards run the project in Android Studio. The project requires API 25.

There is still nothing about building about building deltachat core

And I’m running into my new issue when trying the ndk-make.sh, as I have written before

yes you probably need the openssl header files, how to install them depends on the OS you are using

libssl-dev is already installed

Package: libssl-dev
Version: 1.1.1f-1ubuntu2.12
Priority: optional
Section: libdevel
Source: openssl
Origin: Ubuntu
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Original-Maintainer: Debian OpenSSL Team pkg-openssl-devel@lists.alioth.debian.org
Bugs: OpenID transaction in progress
Installed-Size: 8.009 kB
Depends: libssl1.1 (= 1.1.1f-1ubuntu2.12)
Suggests: libssl-doc
Conflicts: libssl1.0-dev
Homepage: https://www.openssl.org/
Download-Size: 1.584 kB
APT-Manual-Installed: yes
APT-Sources: Index of /ubuntu focal-updates/main amd64 Packages
Description: Werkzeugsatz für das Secure Socket Layer (SSL) - Entwicklungsdateien
Dieses Paket ist Teil der vom Projekt OpenSSL entwickelten Implementierung
der Kryptographieprotokolle SSL und TLS für sichere Internetkommunikation.
.
Es enthält Entwicklungsbibliotheken, Header-Dateien und englischsprachige
Handbuchseiten für libssl und libcrypto.

Ok the error says something about clang missing, if you have all the required rust targets (scripts/install-toolchains.sh) then my next guess would be that $ANDROID_NDK_ROOT or an other env var is not set correctly

what’s the full log of ndk-make.sh?

The script was running successful.

PATH is OK
export PATH=${PATH}:/home/ich/Android/Sdk/platform-tools
export PATH=${PATH}:/home/ich/Android/Sdk/build-tools
export ANDROID_NDK_ROOT=${HOME}/Android/Sdk/ndk
export PATH=${PATH}:${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/:${ANDROID_NDK_ROOT}

clang is found here
/home/ich/Android/Sdk/ndk/25.0.8221429/build/core/toolchains/aarch64-linux-android-clang

I think this first error is the problem, but I can’t find a working solution

error: failed to run custom build command for openssl-sys v0.9.72

complete error you will find here https://leos-gsi.de/downloads/miscellaneous/error.txt
(sorry, I’m not allowed to attach a file here :frowning: )

armv7a-linux-androideabi16-clang: not found, so I assume your NDK stuff is not setup properly.

@LeOS-GSI did you follow the build instructions at GitHub - deltachat/deltachat-android: Email-based instant messaging for Android.? If yes, did you follow the “Build Using Dockerfile” or the “Install Build Environment (without Docker or Podman)” instructions?

(I’m one of the Android developers)

Yes, as you can see in my first post, I have followed it step by step. And yes, Install Build Environment I have also done. I wont make my own Version so I need to build with Android Studio.

I’m a bit further. The OpenSSL error I have solved.
the armv7a-linux-androideabi16-clang error I have solved with change the make file. I have removed the 16, because NDK 25.xx has only clang files 19 and above.

Now I stuck at this error when running
error occurred: Failed to find tool. Is arm-linux-androideabi-ar installed?

I think I will give up. I have invested hours and hours to get it running, but running into one error after the other.

it’s sad, because it would be nice to have it included in my ungoogled LeOS-GSi.
./ndk-make.sh

This sounds a bit like you didn’t run ./sripts/install-toolchains.sh (but could have other reasons I don’t know of course).

In any case, if you manage to install Docker or Podman (or even already have it installed), the instructions at “Build Using Dockerfile” are generally less error-prone than the ones at “Install Build Environment (without Docker or Podman)”

By the way

Yes, building Threema and Matrix is easier since you don’t have to compile some Rust code first and

All of the build instructions in the Readme are about dc core except for some lonely lines (“./gradlew assembleDebug”, “Afterwards run the project in Android Studio.”)

This is because while building the Android part is easy, while building the rust core for Android requires some work.

:warning: Important: You do need to follow the instructions at GitHub - deltachat/deltachat-android: Email-based instant messaging for Android. even if you managed to build other apps before. The build instructions are specific to DeltaChat since we have a Rust core, and it’s not sufficient to have a build environment that can build Android apps.

in the building instruction is no single word that I have to build the dc core !!!
So, shall I only run cargo build inside the dc core folder ??? Or what have I to do ??

I hate docker. And once more: I want to change a bit in sources, so docker is not usable

scripts where running successful

I have all done successful in Linux Mint 20 and also in Linux Mint 18

Then, install Rust using [rustup](https://rustup.rs/). Install Rust toolchains for cross-compilation by executing `scripts/install-toolchains.sh`.

After that, call `./ndk-make.sh` in the root directory to build core-rust. Afterwards run the project in Android Studio. The project requires API 25.

both scrips are inside /ndk-make.sh’ folder deltachat-android and not in core folder. so the command ‘/ndk-make.sh’ have to be executed in folder deltachat-android and not in core folder. right ???


I have made a complete new start. You can see the log here ZeroBin.net

Dockerfile currently uses Android NDK 22.1.7171670 and inside docker the instruction works. Maybe there is an incompatibility with newer NDK since we have not updated it.

No, ndk-make.sh does this for you.

Use Podman, then :wink: You can change the sources just fine also if you build with Docker/Podman (the current working directory will be mapped into the container, so that only the building stuff is in the container, the source code can be edited as always)

My intuition was wrong, then :confused:

Right.

wow, very old. OK, I will try with that NDK