Skip to content

Fix Android NDK build error in "external/logging/logging.c" #12

Description

@rafaelqcc

When building Dobby for Android with NDK r28c, "external/logging/logging.c" fails to compile because "<android/log.h>" is included inside the "log_internal_impl()" function.

Clang reports:

error: function definition is not allowed here

The problem is caused by the Android header being included inside a function body. Moving the include and "ANDROID_LOG_TAG" definition to the top-level Android section of the file fixes the build.

Change

Move:

#include <android/log.h>
#define ANDROID_LOG_TAG "Dobby"

from inside "log_internal_impl()" to the top of "logging.c":

#if defined(ANDROID)
#include <android/log.h>
#define ANDROID_LOG_TAG "Dobby"
#endif

This allows Dobby to build successfully for Android arm64, armv7, x86, and x86_64 with NDK r28c.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions