Linking libjuce_jni.so FAILED

Trying to build an existing Juce project on Android and keep getting this error:

clang++: error: linker command failed with exit code 1

libjuce_jni.so is not being generated on build. That’s why it can’t link it. I’ve tried building for arm64-8va, x86_64, x86 all result in this same error. When I create a brand new Juce project and export with Android I have no problem. It creates the file and links it.
I’ve tried what seems like every possible thing in cmake and no dice.

Does anyone know what code generates libjuce_jni.so?

Or any others possible ideas??


CMakeLists.txt (335.7 KB)

What’s the exact text of the error message that you get? Normally the linker will explain why it failed (missing symbols, missing files, duplicate symbols etc.).

1 Like

My Understanding is because libjuce_jni.so fails everything else fails with it. With previous testing I was under the impression that everything else was linked properly. I could be wrong. But my main focus is libjuce_jni.so

This is failing to find symbols from the ffmpeg library. Perhaps your library search path is incorrect, or maybe you’re trying to link a library which was built for the wrong platform (e.g. linking a mac build of ffmpeg to an Android target).

1 Like

Oh! I thought it wasn’t building libjuce_jni.so so then everything else was failing. You’re saying it isn’t building libjuce_jni.so because everything else is failing. Is that correct?

I’m pretty positive my ffmpeg build is for android and not for mac.
I built with GitHub - Javernaut/ffmpeg-android-maker: Contains a script that assembles FFmpeg library for Android
I’ve also double checked the paths to ffmpeg headers relative to cmake and those are good. But I guess the error could be the linking to those libraries.

Let me try a couple things and I’ll hit you back.
Thanks!!

This is a more typical output (also this one is on macbuild error.pdf (78.2 KB) )

“undefined reference to symbol…” means that the symbol could not be found for some reason. In this case, the missing symbols are from ffmpeg, so there’s probably something wrong with the way the library is being linked.

I don’t see the library names (avformat, avutil etc.) mentioned in the linkline in the output you linked, so double-check the paths. Also, the ‘external libraries to link’ field in the Projucer should contain just the library names - the lib/ prefix might be throwing things off. That should be part of the library search path instead.

1 Like

Thank you! Soon as I get home from work I’ll do some debugging and report back.

Thank you so much for your help :slight_smile:

It worked! You were absolutely right. It was such a big error list I couldn’t make heads or tails of what was really wrong. My main mistake was the “Extra Library Search Paths”. THIS is where you put the paths to the libraries. I thought to just put the full path in the “External libraries to link” but that does not work. The “Extra” was throwing me. For anyone who is still confused read this post:

Thanks so much @reuk ! Really got me out of the weeds :pray: :pray: :pray: