bazelbuild / rules_android_ndk

Apache License 2.0
31 stars 15 forks source link

How to correctly link to liblog? #38

Closed fernand closed 1 year ago

fernand commented 1 year ago

I have a project using the latest android_ndk_repository with NDK 25.

Everything builds fine, including large third party dependencies. I’m however unable to link to liblog.so, even when passing ‘-llog’, in which case lld can’t find the library.

if I revert to using the builtin Bazel NDK rule and NDK 21, the problem goes away.

jiawen commented 1 year ago

Can you share a repro or a snippet? It's encouraging that it's working in ndk 21.

ted-xie commented 1 year ago

What API level are you targetting? It looks like in r25c, there's no more support for APIs {16, 17, 18}, which older NDKs like r20b did support. It looks like liblig.so is in $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/<host platform>/sysroot/usr/lib/{arch}-{platform}/{api_level}.

fernand commented 1 year ago

I confirm that this was an API level issue, thanks for the help!