From fe5dd917250f3856027b09f1927a84e8ab5153d3 Mon Sep 17 00:00:00 2001 From: Adam Strzelecki Date: Mon, 9 Oct 2017 16:07:39 +0200 Subject: [PATCH] Fix Android compilation 1. Define GIT_VERSION preprocessor variable in jni/Android.mk error: use of undeclared identifier 'GIT_VERSION' 2. Add -llog linker dependency for Android logging functions error: undefined reference to '__android_log_print' 3. Prevent Clang error providing explicit "%s" format for snprintf error: format string is not a string literal --- jni/Android.mk | 4 ++-- libretro/libretro-core.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jni/Android.mk b/jni/Android.mk index 992e664..d0041c1 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -23,8 +23,8 @@ CORE_DIR = .. include $(CORE_DIR)/Makefile.common LOCAL_SRC_FILES += $(SOURCES_C) -LOCAL_CFLAGS += -O2 -D__LIBRETRO__ -DFRONTEND_SUPPORTS_RGB565 -DNDEBUG=1 $(INCFLAGS) +LOCAL_CFLAGS += -O2 -D__LIBRETRO__ -DFRONTEND_SUPPORTS_RGB565 -DNDEBUG=1 -DGIT_VERSION=\"$(GIT_VERSION)\" $(INCFLAGS) -LOCAL_LDLIBS += -lz +LOCAL_LDLIBS += -lz -llog include $(BUILD_SHARED_LIBRARY) diff --git a/libretro/libretro-core.c b/libretro/libretro-core.c index 6566fed..f5dfe45 100644 --- a/libretro/libretro-core.c +++ b/libretro/libretro-core.c @@ -156,7 +156,7 @@ static void update_variables(void) { char *pch; char str[100]; - snprintf(str, sizeof(str), var.value); + snprintf(str, sizeof(str), "%s", var.value); pch = strtok(str, "x"); if (pch)