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


#1

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


Link error building release iOS
#2

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.


#3

Try using gcc-ar, rather than ar:

AR=gcc-ar make

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


#4

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


#5

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.


#6

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.


#7

Alrighty, I’ll look into that, cheers.