NangiDev/GDSerCommPlugin

Cannot compile shared library for Android

Closed this issue · 2 comments

Godot version: 3.5 (GDNative)
SO: Windows 11

So I was messing with this plugin and it works good on desktop platforms. However, Android needs it's own library (I think linux may work on armv8, didn't have a device to test). So I tried compiling it with ndk-build like this guy have done (sisik.eu/blog/godot/gd-native-on-android) and turns out the linker could not find the definition of many sercomm functions. Following the includes path I found only the header files "base.h", "comms.h" and etc. Is it possible to compile it and run on Android? Also, I need specifically the 32bit armv7 library (and Godot 3.x, GLES2 necessary), because I would run this on very limited hardware, basically an Android screen.

image

My Android.mk file:

# Android.mk
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := android_gdsercomm

LOCAL_C_INCLUDES := \
godot_headers sercomm/include/public

LOCAL_CPPFLAGS := -std=c++14
LOCAL_CPP_FEATURES := rtti exceptions
LOCAL_LDLIBS := -llog

LOCAL_SRC_FILES := \
GDSercomm.c

include $(BUILD_SHARED_LIBRARY)

Thanks in advance

Thanks for trying out this plugin and submitting an issue :)

Having it working for Android would be cool!
It was a while ago I worked with this code base and I haven't done anything like this with Android.

I can't promise if I will ever get time to look into this, but maybe it would work if you updated the sercomm.gdextension.template to reference the .so file? Similar to what he did in the blog you linked.

It could be worth a try at least

More info on how to reference the .so files

Perhaps the Sconstruct needs to be updated to include the Android platform. According to this thread it seems to be a thing

Would be amazing if you could share a minimal project that reproduce the issue

Thank you for your attention

I digged a little deeper and seems that sercomm lib don't have direct support to Android devices, mainly because the lack of POSIX compatibility. I'll keep in the track and try to find where exactly it is not compatible, and may find a workaround. If I manage to reach something, I'll let you know, but for now, this is closed.