DSP module breaks compilation on Linux


#1

Hi,

I’ve just included the dsp module into my project and it seems that the jmax macros for the SIMD types break compilation because they expand calls to jmax<int64> to a SIMD call (the actual compiler error is a forward declaring issue because it can’t resolve NativeOps::SimdType<long long int> or some weird rocketscience stuff.

Commenting out these lines at the end of juce_dsp/containers/juce_SIMDRegister.h fixes the error:

// Extend some common used global functions to SIMDRegister types
template <typename Type>
inline dsp::SIMDRegister<Type> JUCE_VECTOR_CALLTYPE jmin (dsp::SIMDRegister<Type> a, dsp::SIMDRegister<Type> b) { return dsp::SIMDRegister<Type>::min (a, b); }
template <typename Type>
inline dsp::SIMDRegister<Type> JUCE_VECTOR_CALLTYPE jmax (dsp::SIMDRegister<Type> a, dsp::SIMDRegister<Type> b) { return dsp::SIMDRegister<Type>::max (a, b); }

This is only happening on Linux though. Is there are smarter solution than to remove these lines?


#2

Thanks - yep, we’ll get this fixed asap!


#3

Hi @chrisboy2000, can you let me know which compiler and compiler version you are using. I can’t really see anything wrong with that line.

Fabian


#4

GCC 5.4.0 on Ubuntu 16.04

This is the (cleaned) error message:

/juce_dsp/containers/juce_SIMDRegister.h: In instantiation of ‘struct juce::dsp::SIMDRegister<long long int>’:

hi_streaming/hi_streaming/MonolithAudioFormat.h:402:77:   recursively required by substitution of ‘template<class Type> juce::dsp::SIMDRegister<Type> juce::jmax(juce::dsp::SIMDRegister<Type>, juce::dsp::SIMDRegister<Type>) [with Type = long long int]’

juce_dsp/containers/juce_SIMDRegister.h:84:43: error: invalid use of incomplete type ‘struct juce::dsp::SIMDNativeOps<long long int>’ typedef typename NativeOps::vSIMDType vSIMDType;
                                          ^

The code in MonolithAudioFormat.h uses something like jmax<int64>(int64 v1, int64 v2) which seems to be expanded to a SIMD version of the jmax macro defined in the location shown above (maybe a vector of 4 shorts?). If I change the line to:

jmax<int>((int)int64Value1, (int)int64Value2);

so that the template argument is int, it compiles.

I also got reports of users not being able to compile this on macOS (so most probably clang), however my XCode didn’t complain.