View Issue Details

IDCategoryLast Update
0007690bugs2018-11-25 07:22
ReporteraquilarubraAssigned To 
Reproducibilityalways 
Status newResolutionopen 
Platformx86_64OSWindowsOS Version10
Product Version5.X git (version in description) 
Fixed in Version 
Summary0007690: M_PI compilation issues
Descriptionmath.h is not included in all the required places, at least while compiling with mingw-w64.

To compile correctly, I currently need to modify the source:

sed -i '1s/^/#ifndef M_PI\n #define M_PI 3.14159265358979323846\n#endif/' libs/qm-dsp/base/KaiserWindow.h
sed -i '1s/^/#ifndef M_PI\n #define M_PI 3.14159265358979323846\n#endif/' libs/qm-dsp/base/Window.h
sed -i '1s/^/#ifndef M_PI\n #define M_PI 3.14159265358979323846\n#endif/' libs/qm-dsp/base/SincWindow.h
sed -i '1s/^/#ifndef M_PI\n #define M_PI 3.14159265358979323846\n#endif/' libs/qm-dsp/dsp/phasevocoder/PhaseVocoder.h
sed -i '1s/^/#ifndef M_PI\n #define M_PI 3.14159265358979323846\n#endif/' libs/qm-dsp/maths/MathUtilities.h
sed -i '1s/^/#ifndef M_PI\n #define M_PI 3.14159265358979323846\n#endif/' libs/vamp-plugins/TruePeak.h
sed -i '1s/^/#ifndef M_PI\n #define M_PI 3.14159265358979323846\n#endif/' libs/zita-resampler/zita-resampler/resampler-table.h
sed -i '1s/^/#ifndef M_PI\n #define M_PI 3.14159265358979323846\n#endif/' libs/pbd/boost_debug.cc
sed -i '1s/^/#ifndef M_PI\n #define M_PI 3.14159265358979323846\n#endif/' libs/pbd/cartesian.cc

I used the usual definition of M_PI from math.h, but for better precision it can be:

#define M_PI 3.14159265358979323846264338327950288

#define M_PI
TagsNo tags attached.

Activities

x42

2018-11-24 13:17

administrator   ~0020477

Could you please provide actual compiler invocation, flags and output how those fail and what the issue is that you address?

qm-dsp is C++ library. KaiserWindow.h for example does #include <cmath> for C's math.h
libs/pbd/cartesian.cc does have a <math.h> include..

It does compiles just fine with mingw-w64: https://nightly.ardour.org/i/A_WIN_x86_64/build_log.txt
Also John Emmas maintains a MSVC build where this isn't an issue apparently.

timbyr

2018-11-24 22:46

developer   ~0020478

John Emmas probably has _USE_MATH_DEFINES defined in his MSVC build config.

Newer versions of mingw-w64 also require this AFAIR, I guess to be more like MSVC headers.

Perhaps also see:

https://stackoverflow.com/questions/6563810/m-pi-works-with-math-h-but-not-with-cmath-in-visual-studio/

aquilarubra

2018-11-25 07:22

reporter   ~0020486

I was also perplex, because it seemed to me that there was the <cmath> include, but it wasn't picked up.

Anyway, since last week I saw there was a important revamp of the code, which passed from 1031 compilation cases to 999. Now it works. No errors any longer.

Issue History

Date Modified Username Field Change
2018-11-24 11:30 aquilarubra New Issue
2018-11-24 13:17 x42 Note Added: 0020477
2018-11-24 22:46 timbyr Note Added: 0020478
2018-11-25 07:22 aquilarubra Note Added: 0020486