Android.mk是这样的
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := lua LOCAL_SRC_FILES := lua.cpp MY_FILES := $(wildcard $(LOCAL_PATH)/lua/*.c) MY_FILES := $(MY_FILES:$(LOCAL_PATH)/%=%) LOCAL_SRC_FILES += $(MY_FILES) # includes LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_C_INCLUDES += $(LOCAL_PATH)/lua/ include $(BUILD_SHARED_LIBRARY)
lua的源码放在jni/lua目录下,删除lua.c和luac.c
执行ndk-build,会报错:
llex.c:237:18: error: ‘struct lconv‘ has no member named ‘decimal_point‘
查了下,是定义小数点字符的,把这段注释掉,直接定义算了:
// #if !defined(l_getlocaledecpoint) // #define l_getlocaledecpoint() (localeconv()->decimal_point[0]) // #endif #define l_getlocaledecpoint() ‘.‘
还有个liolib.c也改下,这样就编译成功了。
我用的是lua5.3。
等会学习下lua
时间: 2024-12-20 18:54:42