mstorsjo / fdk-aac

A standalone library of the Fraunhofer FDK AAC code from Android.

Home Page:https://sourceforge.net/projects/opencore-amr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NDK cross compilation missing file

pengfalin opened this issue · comments

NDK version:14
lib-aac version:2.0.1

libSBRdec/src/lpp_tran.cpp:122:21: fatal error: log/log.h: No such file or directory
#include "log/log.h"

This project isn't buildable as such directly with the android NDK. If you really want to, it should be fairly straightforward to comment out a few android specific ifdef blocks (they contain code that only build in the android platform codebase, not with the NDK).

There's a couple reasons for not actively supporting building for android:

  • The license of the project is a bit hard to interpret correctly, and some people have concerns about redistributability of it - so people use the code e.g. on servers and other place where the built programs aren't redistributed to end users.
  • The fdk-aac encoder and decoder are already available as part of the Android platform itself, since Android 4.1, available via the MediaCodec API.

Thanks, I want to use ffmpeg cross compilation, and link fdk-aac and x264. I hope to use JNI development to write my own C + + code. I finally used version 2.0.0 and successfully linked to ffmpeg. I will try to compile version 2.0.1 when I have time.

I got one step further while experimenting with the mobile-ffmpeg project:

  1. Installed the android-libcutils-dev package.
  2. Changed "log/log.h" to <cutils/log.h>

This fixed the error message above.

Now it fails on following:

lib/libfdk-aac.a(lpp_tran.o):lpp_tran.cpp:function lppTransposer(SBR_LPP_TRANS*, QMF_SCALE_FACTOR*, long**, long*, long**, int, int, int, int, int, int, int, INVF_MODE*, INVF_MODE*): error: undefined reference to '__android_log_error_write'

The missing file is here, download and patch it:
curl "https://android.googlesource.com/platform/system/bt/+/master/linux_include/log/log.h?format=TEXT" | base64 --decode | sed 's/OS_GENERIC/__ANDROID__/' >libSBRdec/include/log/log.h

patch this script fix it.

dumy missing log.h, ignore function impl.

mkdir -p libSBRdec/include/log/

echo "void android_errorWriteLog(int i, const char *string){}" > libSBRdec/include/log/log.h

该项目不能直接使用 android NDK 构建。如果你真的想要,注释掉一些 android 特定的 ifdef 块应该相当简单(它们包含仅在 android 平台代码库中构建的代码,而不是 NDK)。

2.0.1 fail

commented

patch this script fix it.

dumy missing log.h, ignore function impl.

mkdir -p libSBRdec/include/log/

echo "void android_errorWriteLog(int i, const char *string){}" > libSBRdec/include/log/log.h

This is the right solution!