libpd / pd-for-android

Pure Data for Android
353 stars 91 forks source link

My externals won't run on amd64-v8 #93

Closed funkyfourier closed 5 years ago

funkyfourier commented 5 years ago

Some of my own externals are failing to run on devices with amd64-v8. They seem to compile fine and gets copied over to the apk in the right folder (armeabi-v7a, arm64-v8a etc). When I run my app on an older device everything runs fine.

The error message is "error: ... couldn't create" when the patch is run. I am on pd-core version 1.1.0.

Thanks for any suggestions.

My Application.mk:

APP_PLATFORM := android-17
APP_OPTIM := release
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
APP_ALLOW_MISSING_DEPS=true

In Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := pd
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../pd-for-android/PdCore/jni/libpd/pure-data/src
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../pd-for-android/PdCore/libs/$(TARGET_ARCH_ABI)/libpd.so
ifneq ($(MAKECMDGOALS),clean)
    include $(PREBUILT_SHARED_LIBRARY)
endif

#---------------------------------------------------------------

include $(CLEAR_VARS)
LOCAL_MODULE := samplelooper_tilde
LOCAL_CFLAGS := -DPD -std=c99
LOCAL_SRC_FILES := samplelooper~.c
LOCAL_SHARED_LIBRARIES = pd
include $(BUILD_SHARED_LIBRARY)

...etc same for all

Output from buildNatives:

14:38:22: Executing task 'buildNative'...

Executing tasks: [buildNative]

Configuration on demand is an incubating feature.

> Configure project :
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

> Task :android:buildNative
Android NDK: WARNING: APP_PLATFORM android-17 is higher than android:minSdkVersion 1 in /---/android/AndroidManifest.xml. NDK binaries will *not* be compatible with devices older than android-17. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.    
make: Entering directory `/---/android/jni'
[armeabi-v7a] Compile thumb  : samplelooper_tilde <= samplelooper~.c
[arm64-v8a] Compile        : samplelooper_tilde <= samplelooper~.c
[x86] Compile        : samplelooper_tilde <= samplelooper~.c
[x86_64] Compile        : samplelooper_tilde <= samplelooper~.c
[armeabi-v7a] Install        : libpd.so => libs/armeabi-v7a/libpd.so
[arm64-v8a] Install        : libpd.so => libs/arm64-v8a/libpd.so
[x86] Install        : libpd.so => libs/x86/libpd.so
[x86_64] Install        : libpd.so => libs/x86_64/libpd.so
[armeabi-v7a] SharedLibrary  : libsamplelooper_tilde.so
[x86] SharedLibrary  : libsamplelooper_tilde.so
[armeabi-v7a] Install        : libsamplelooper_tilde.so => libs/armeabi-v7a/libsamplelooper_tilde.so
[arm64-v8a] SharedLibrary  : libsamplelooper_tilde.so
[x86] Install        : libsamplelooper_tilde.so => libs/x86/libsamplelooper_tilde.so
[x86_64] SharedLibrary  : libsamplelooper_tilde.so
[x86_64] Install        : libsamplelooper_tilde.so => libs/x86_64/libsamplelooper_tilde.so
[arm64-v8a] Install        : libsamplelooper_tilde.so => libs/arm64-v8a/libsamplelooper_tilde.so
make: Leaving directory `---/android/jni'

BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
14:38:23: Task execution finished 'buildNative'.
funkyfourier commented 5 years ago

So I finally found out that I had this in my setup routine:

PdBase.addToSearchPath("/data/data/" + context.getPackageName() + "/lib");

Changed it to this which I found in PdService.java:

PdBase.addToSearchPath(context.getApplicationInfo().nativeLibraryDir);

I guess this is a more reliable way of determining the correct path.