libpd / pd-for-android

Pure Data for Android
353 stars 91 forks source link

Investigate NDK warnings when building externals #33

Closed tkirshboim closed 8 years ago

tkirshboim commented 8 years ago

We should investigate why the NDK gives these warning when ScenePlayer and PdTest are build:

Android NDK: WARNING:pd-for-android/ScenePlayer/jni/Android.mk:rj_accum: non-system libraries in linker flags: -lpd
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the current module
[...]

Reported by @joebowbeer : https://github.com/libpd/pd-for-android/pull/31#issuecomment-166155830 Related: http://android.mk/

joebowbeer commented 8 years ago

I think the solution is to move the libpd declarations into a separate module and then declare this module as a local shared library where needed. (Source: http://stackoverflow.com/a/25665219/901597)

Example from PdTest:

LOCAL_PATH := $(call my-dir)

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

include $(CLEAR_VARS)
LOCAL_MODULE := helloworld
LOCAL_CFLAGS := -DPD
LOCAL_SRC_FILES := helloworld.c
LOCAL_SHARED_LIBRARIES = pd
include $(BUILD_SHARED_LIBRARY)