Linking in a static library

Hi, new to Android dev so wondered if someone could help me out. I have a static library that I’m building and wanting to link into a main project. Am ok doing this with win, osx and iOs, but not really sure what the output of the static library build is under Android and how to go about including that into the main project…

Any pointers much appreciated!

We are currently working on supporting this use-case.

good to know, thanks… Ping an update here when ready and I’ll be happy to test out… Cheers

Just a quick note: Building static libraries and linking to them in other JUCE projects can really be a lot of hit & miss for a variety of reasons (incompatible build flags, duplicate symbols (especially if both projects use JUCE), strange order of static initialisers, etc.). Consider creating your own JUCE module instead.

In any case, we will have a fix for building static libraries on Android.

ah, I see… yes, that might be a good idea - thanks for the suggestion, I’ll look into that…

Any updates on support for static libraries? I’m getting duplicate symbol errors.

We are actively working on supporting this use-case better. For now, if you are sure that both libraries are using the exact same version of JUCE you can simply tell the linker to ignore duplicate symbols. We do this with ROLI’s Noise app for example and it doesn’t seem to cause any problems.

Yep, all my Android builds have:

image

Hey guys, I was just wondering if there was a solution to the static library / duplicate symbol thing coming soon? Would be very helpful if there was.

Thanks!

Adam

Hi Adam,

One thing you can do already now, is to manually remove any JUCE modules from being built in the static library: i.e. just keep the includes that include the JUCE headers and your own code.

The missing JUCE symbols will then be resolved when you link your JUCE app.

or just add the -z muldefs as detailed above - that should fix the problem… does it not for you?

1 Like