DSP Module No Longer Compiles On Linux After April 17th commit


#1

linux build (CentOS 7.4.1708):
I now get the error:
“The juce_dsp module requires a compiler that supports constexpr”

g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)

Not 100% sure it was the April 17th commit as Feb. 14th was the last update that I used to compile.


#2

Surely that error message is pretty self-explanatory!?

GCC 4.8 is several years old, and JUCE requires full C++11 support now. Just update to a new version of GCC.


#3

It was. Just making sure that it needed to be updated (unfortunately stuck on old versions (a real pain)). Thanks for the quick response.


#4

Updated to gcc 7.2.1 and now get the following error:
In file included from …/…/JuceLibraryCode/modules/juce_dsp/juce_dsp.h:244:0,
from …/…/Source/…/JuceLibraryCode/JuceHeader.h:22,
from …/…/Source/ProcessAudio.h:12,
from …/…/Source/ProcessAudio.cpp:11:
…/…/JuceLibraryCode/modules/juce_dsp/containers/juce_SIMDRegister.h: In instantiation of ‘struct juce::dsp::SIMDRegister’:
…/…/Source/ProcessAudio.cpp:158:81: recursively required by substitution of ‘template juce::dsp::SIMDRegister juce::jmin(juce::dsp::SIMDRegister, juce::dsp::SIMDRegister) [with Type = long long int]’
…/…/Source/ProcessAudio.cpp:158:81: required from here
…/…/JuceLibraryCode/modules/juce_dsp/containers/juce_SIMDRegister.h:86:52: error: invalid use of incomplete type ‘struct juce::dsp::SIMDNativeOps’
using vSIMDType = typename NativeOps::vSIMDType;
^
In file included from …/…/JuceLibraryCode/modules/juce_dsp/juce_dsp.h:234:0,
from …/…/Source/…/JuceLibraryCode/JuceHeader.h:22,
from …/…/Source/ProcessAudio.h:12,
from …/…/Source/ProcessAudio.cpp:11:
…/…/JuceLibraryCode/modules/juce_dsp/native/juce_avx_SIMDNativeOps.h:56:8: note: declaration of ‘struct juce::dsp::SIMDNativeOps’
struct SIMDNativeOps;

The line in question is int64 posToStart = jmin<int64>(roundf(event.start * sampleRate),numSamps);
This will work if I use an int as the templated type instead of int64. The audioFormatReader returns an int64 for the number of samples. Works fine on OS X.


#5

I think this was announced, so not surprising at all.


#6

You shouldn’t be using jmin with an explicit template type - just write jmin (a, b) and make sure the args have matching types.

Also avoid roundf, it’s a C function, not C++. use std::round() instead.