Compile standalone Linux, undefined references to juce::<many_things>

I keep getting undefined references when trying to compile the standalone plugin for Linux, any ideas? See Code::Blocks screenshot below.

If anyone has those errors, in my case they were LTO related. If I disable LTO (link time optimisation, an option in Projucer, e.g. check Release and Debug settings) it compiles fine.

1 Like

Try using gcc-ar, rather than ar:

AR=gcc-ar make

You’ll get a lot of warnings, but it should compile.

Is “AR=gcc-ar make” a one time command I execute in the shell?

make is the tool to build using Makefiles. I guess @t0m assumed you were using Makefiles, and didn’t realize that you are using Code::Blocks.

Yes, I did.

Part of the build process for compiling plug-ins (and the standalone exe) is the creation of a static library from a set of object files. The default tool for doing this on Linux is ar, but ar cannot correctly bundle object files that contain LTO information, so an LTO build will fail. If, however, you can configure Code::Blocks to use gcc-ar instead of ar then you will be able to compile using LTO.

1 Like

Alrighty, I’ll look into that, cheers.