Linker error:undefined reference to '__android_log_print'

1.3k Views Asked by At

When I porting Recovery from Android4.4.2 to AndroidM,I'm getting an undefined reference to __android_log_print.This problem exists,and I also have used all solutions I can search,but they don't work.

My error message is as follows:

external/libpng/pngerror.c:50: error:undefined reference to '__android_log_print'

This is my Android.mk file:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
    recovery.cpp \
    bootloader.cpp \
    install.cpp \
    roots.cpp \
    ui.cpp \
    screen_ui.cpp \
    verifier.cpp \
    adb_install.cpp \
    atc_update.cpp \
    XMLFile.cpp 

LOCAL_MODULE := recovery
LOCAL_FORCE_STATIC_EXECUTABLE := true
RECOVERY_API_VERSION := 3
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)

LOCAL_STATIC_LIBRARIES := \
    libext4_utils_static \
    libsparse_static \
    libminzip \
    libz \
    libmtdutils \
    libmincrypt \
    libminadbd \
    libminui \
    libpng \
    libcutils \
    libstdc++ \
    libm \
    libc

LOCAL_SHARED_LIBRARIES := libutils libcutils 
LOCAL_LDLIBS += -llog
...
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES += system/core/fs_mgr/include \
            $(KERNEL_HEADERS) \
            vendor/atc/proprietary/bootable/lk/platform/ac83xx/include \
            system/extras/ext4_utils
LOCAL_C_INCLUDES += kernel/kernel-3.18/drivers/misc/atc/inc
include $(BUILD_EXECUTABLE)

This is external/libpng/pngerror.c:

...
#include <android/log.h>
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,TAG,__VA_ARGS__)
...
    LOGD("png_error,msg:%s",error_message);
...

I also tried with LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog,but it doesn't fix the problem.

0

There are 0 best solutions below