Compilation problem on Fedora 24

I am currently compiling ardour and Carla on Fedora 24. They use gcc 6.1.1 and flac 1.3.1.
Here is the error message I’ve got:

Compiling juce_audio_formats.cpp
In file included from …/…/…/JUCE/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp:78:0,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:100:
…/…/…/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/lpc_flac.c: Dans la fonction ‘long int juce::FlacNamespace::lround(double)’:
…/…/…/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/lpc_flac.c:60:39: erreur : ‘long int juce::FlacNamespace::lround(double)’ conflicts with a previous declaration
static inline long int lround(double x) {
^
In file included from /usr/include/math.h:83:0,
from /usr/include/c++/6.1.1/cmath:45,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/system/juce_StandardHeader.h:70,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/juce_core.h:140,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/juce_audio_basics.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:38:
/usr/include/bits/mathcalls.h:341:17: note : previous declaration ‘long int lround(double)’
__MATHDECL (long int,lround, (Mdouble __x));
^~~~~~
In file included from …/…/…/JUCE/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp:78:0,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:100:
…/…/…/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/lpc_flac.c: Dans la fonction ‘int juce::FlacNamespace::FLAC__lpc_quantize_coefficients(const FLAC__real*, unsigned int, unsigned int, juce::FlacNamespace::FLAC__int32*, int*)’:
…/…/…/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/lpc_flac.c:213:20: erreur : call of overloaded ‘lround(juce::FlacNamespace::FLAC__double&)’ is ambiguous
q = lround(error);
^
In file included from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/system/juce_StandardHeader.h:70:0,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/juce_core.h:140,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/juce_audio_basics.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:38:
/usr/include/c++/6.1.1/cmath:1594:3: note : candidate: constexpr long int std::lround(long double)
lround(long double __x)
^~~~~~
In file included from /usr/include/math.h:83:0,
from /usr/include/c++/6.1.1/cmath:45,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/system/juce_StandardHeader.h:70,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/juce_core.h:140,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/juce_audio_basics.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:38:
/usr/include/bits/mathcalls.h:341:17: note : candidate: long int lround(double)
__MATHDECL (long int,lround, (Mdouble __x));
^~~~~~
In file included from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/system/juce_StandardHeader.h:70:0,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/juce_core.h:140,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/juce_audio_basics.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:38:
/usr/include/c++/6.1.1/cmath:1590:3: note : candidate: constexpr long int std::lround(float)
lround(float __x)
^~~~~~
In file included from …/…/…/JUCE/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp:78:0,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:100:
…/…/…/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/lpc_flac.c:60:24: note : candidate: long int juce::FlacNamespace::lround(double)
static inline long int lround(double x) {
^~~~~~
In file included from …/…/…/JUCE/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp:78:0,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:100:
…/…/…/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/lpc_flac.c:242:20: erreur : call of overloaded ‘lround(juce::FlacNamespace::FLAC__double&)’ is ambiguous
q = lround(error);
^
In file included from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/system/juce_StandardHeader.h:70:0,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/juce_core.h:140,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/juce_audio_basics.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:38:
/usr/include/c++/6.1.1/cmath:1594:3: note : candidate: constexpr long int std::lround(long double)
lround(long double __x)
^~~~~~
In file included from /usr/include/math.h:83:0,
from /usr/include/c++/6.1.1/cmath:45,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/system/juce_StandardHeader.h:70,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/juce_core.h:140,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/juce_audio_basics.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:38:
/usr/include/bits/mathcalls.h:341:17: note : candidate: long int lround(double)
__MATHDECL (long int,lround, (Mdouble __x));
^~~~~~
In file included from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/system/juce_StandardHeader.h:70:0,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/…/juce_core/juce_core.h:140,
from …/…/…/JUCE/modules/juce_audio_formats/…/juce_audio_basics/juce_audio_basics.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.h:28,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:38:
/usr/include/c++/6.1.1/cmath:1590:3: note : candidate: constexpr long int std::lround(float)
lround(float __x)
^~~~~~
In file included from …/…/…/JUCE/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp:78:0,
from …/…/…/JUCE/modules/juce_audio_formats/juce_audio_formats.cpp:100:
…/…/…/JUCE/modules/juce_audio_formats/codecs/flac/libFLAC/lpc_flac.c:60:24: note : candidate: long int juce::FlacNamespace::lround(double)
static inline long int lround(double x) {
^~~~~~
Makefile:730 : la recette pour la cible « build/intermediate/Release/juce_audio_formats_5c144c69.o » a échouée
make[1]: *** [build/intermediate/Release/juce_audio_formats_5c144c69.o] Erreur 1

Best regards,

YC

I think you might want to report this to the Carla or Ardour devs. I’m not sure which JUCE version they are using.

The problem can still happen with the current version of JUCE.
In

I replaced

static inline long int lround(double x) {
return (long)(x + copysign (0.5, x));
}

by
static inline long int jlround(double x) {

And replaced all the occurences of lround in this file and the problem was fixed. No more conflict with std::lround.