# Compile standalone Linux, undefined references to juce::\<many\_things\>

**URL:** <https://forum.juce.com/t/compile-standalone-linux-undefined-references-to-juce-many-things/25924>\
**Category:** Linux\
**Created:** [January 12, 2018, 2:17pm UTC](https://forum.juce.com/t/compile-standalone-linux-undefined-references-to-juce-many-things/25924 "2018-01-12T14:17:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![izmar](https://avatars.discourse-cdn.com/v4/letter/i/8e7dd6/32.png) [@izmar](https://forum.juce.com/u/izmar)\
**Post date:** [January 12, 2018, 2:17pm UTC](https://forum.juce.com/t/compile-standalone-linux-undefined-references-to-juce-many-things/25924/1 "2018-01-12T14:17:09Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/f/f440566d4d8f8b9501c6b62b5c2795c3294bc79e.png)

---

<div class="post-metadata">

**Author:** ![izmar](https://avatars.discourse-cdn.com/v4/letter/i/8e7dd6/32.png) [@izmar](https://forum.juce.com/u/izmar)\
**Post date:** [January 13, 2018, 4:37pm UTC](https://forum.juce.com/t/compile-standalone-linux-undefined-references-to-juce-many-things/25924/2 "2018-01-13T16:37:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [January 15, 2018, 12:31pm UTC](https://forum.juce.com/t/compile-standalone-linux-undefined-references-to-juce-many-things/25924/3 "2018-01-15T12:31:44Z")

</div>

Try using `gcc-ar`, rather than `ar`:

```
AR=gcc-ar make

```

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

---

<div class="post-metadata">

**Author:** ![izmar](https://avatars.discourse-cdn.com/v4/letter/i/8e7dd6/32.png) [@izmar](https://forum.juce.com/u/izmar)\
**Post date:** [January 16, 2018, 8:33pm UTC](https://forum.juce.com/t/compile-standalone-linux-undefined-references-to-juce-many-things/25924/4 "2018-01-16T20:33:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mcmartin](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mcmartin/32/7432_2.png) [@mcmartin](https://forum.juce.com/u/mcmartin)\
**Post date:** [January 16, 2018, 8:35pm UTC](https://forum.juce.com/t/compile-standalone-linux-undefined-references-to-juce-many-things/25924/5 "2018-01-16T20:35:21Z")

</div>

`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.

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [January 17, 2018, 9:48am UTC](https://forum.juce.com/t/compile-standalone-linux-undefined-references-to-juce-many-things/25924/6 "2018-01-17T09:48:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![izmar](https://avatars.discourse-cdn.com/v4/letter/i/8e7dd6/32.png) [@izmar](https://forum.juce.com/u/izmar)\
**Post date:** [January 17, 2018, 10:01am UTC](https://forum.juce.com/t/compile-standalone-linux-undefined-references-to-juce-many-things/25924/7 "2018-01-17T10:01:50Z")

</div>

Alrighty, I’ll look into that, cheers.
