lixingcong / dnsmasq-regex

dnsmasq with regex match module(libpcre v8.45, the older version)
65 stars 15 forks source link

Building on Android error #12

Closed elias-Mimetrik closed 6 months ago

elias-Mimetrik commented 6 months ago

I am having an error on Android (LineageOS) I wonder if you can help me please..

I downloaded the Android NDK. Then I export the necessary variables:

export NDK_PROJECT_PATH=/home/myuser/Library/Projects/dnsmasq-Android/android-ndk-r26b/
export ANDROID_NDK=$NDK_PROJECT_PATH
export NDK=$NDK_PROJECT_PATH
export PATH=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH

Then I build it using the NDK version of make:

../android-ndk-r26b/prebuilt/linux-x86_64/bin/make clean
../android-ndk-r26b/prebuilt/linux-x86_64/bin/make ARCH=arm64-v8a

Now it compiles fine. So I copy the executable to the phone and when I run it, it gives this error: /system/bin/sh: /data/local/tmp/dnsmasq: not executable: 64-bit ELF file

If I run file dnsmasq I get: dnsmasq: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=2957f2a589e1b2e1d7ab9c97a89c9121a6bcd5f4, for GNU/Linux 4.4.0, not stripped Which looks like the executable wasn't compiled for Android.. Which means my compilaion commands aren't correct..

Are you familiar with Android building please?

lixingcong commented 6 months ago

You can try to compile a simple hello world in C, then build this repo again.

elias-Mimetrik commented 6 months ago

Thank you. This is exactly what I tried, but I was unsuccessful:

https://stackoverflow.com/questions/78126323/error-compiling-simple-c-hello-world-for-android