Linking error when compiling Rust crate tinyaudio for Android

76 Views Asked by At

I'm trying to compile a library that uses a Rust crate tinyaudio, and I'm getting a linking error:

ld: error: unable to find library -laaudio

I have Android studio installed and:

  • Android SDK Platform 33
  • Android SDK Build-Tools 33.0.1
  • NDK 22.1 (also tried 25.2)
  • Android SDK Command-line Tools (latest)
  • Android SDK Platform Tools

I have set environment variables:

[System.Environment]::SetEnvironmentVariable("NDK_HOME", "$env:LocalAppData\Android\Sdk\ndk\22.1.7171670", "User")
[System.Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:LocalAppData\Android\Sdk", "User")
[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Android\Android Studio\jbr", "User")

And restarted the system afterward.

I have tried adding additional variables: ANDROID_NDK_HOME and ANDROID_NDK_ROOT to point to the same path as NDK_HOME and restarted, with no result.

I have tried changing from NDK 25.2 to 22.1, as some users suggested some similar linking errors were solved by using older libraries.

I have tried reinstalling Android 13.0 SKD package as it was missing Sources for Android 33, and Android 13.0 Platform SDK 33-ext5, with no result.

I am obviously missing something, but I'm running out of ideas what that might be.

It probably has to do something with the NDK, since changing from 25.2 to 22.1 yielded another error:

ld: error: unable to find library -laaudio
ld: error: unable to find library -lunwind

And I've seen -lunwind being mentioned in some other posts, but it seems silly changing from NDK to NDK, seeing if one of them will work. I will do it tomorrow, but until then, I hope someone has some idea what I could try.

0

There are 0 best solutions below