RawTherapee 5 and DCMAKE_CXX_FLAGS

I’m packaging RawTherapee for Fedora, in your blog post about RawTherapee 5 released you recommend to use -DCMAKE_CXX_FLAGS="-std=c++11", but in sources you set it -gnu++11
So, do I need to patch sources and set it c++11 or gnu++11 is just fine?
Thanks.

@mattiaverga we discussed this before releasing and it was suggested that there is no need for
-DCMAKE_CXX_FLAGS="-std=c++11" for the reason you pointed out, but I decided to leave the recommendation because we’ve been using that for a long time and know it works on all systems. Feel free to try compiling without it.
Please use the source tarballs from Index of /shared/source because git will show an incorrect version - issue #3622.

@Morgan_Hardwood Maybe we should replace the gnu++11 in CMakeLists.txt with the standard c++11 now. I see no benefit in gnu++11 and the recommendation to use -DCMAKE_CXX_FLAGS="-std=c++11".

@floessie that’s up to you guys to decide, I’ll just try to get things working for everyone when you make a decision.

@floessie, Just so you know, I’ve been building with C++14 just fine on my Mac.

That’s good to know. Has Clang an emulation for -std=gnu++11 or did you compile with -DCMAKE_CXX_FLAGS="-std=c++14"? Anyway, I think we should change CMakeLists.txt.

Thanks, building with gnu++11 shows no problem and all seems to work fine at the moment.

@floessie, I compiled with DCMAKE_CXX_FLAGS=" … -std=c++14".

I have to do that since some of my dependencies were built with C++14 to get them to build, notably libsigc++.

Thanks,
Partha

I was able to compile on NixOS using -gnu++11 as well.

Shouldn’t C++14 be ABI compatible to C++11?

Anyway, I’ve opened a PR to get rid of -std=gnu++11.

Best
Flössie

@floessie,

You’d think right? :frowning:

Anyway, this might be a clang thing, but I could not compile one of the dependencies without c++14.

Okay, reading this SO answer by Jonathan Wakely tells me, they are compatible but it must be explicitly taken care of. I’m sure Jonathan Wakely is able to take care of the subtleties, but I (and I guess others) as an ordinary C++ programmer am not. :wink:

So C++11 and 14 are theoretically ABI compatible (one point for me), practically they aren’t (one point for you). :grin:

Best
Flössie

I downloaded the source tarballs and modified the CMakeLists.txt file to change the -std=gnu++11 flags to -std=std++11 (line 24 and 25) but it failed to compile on Windows 64. Here’s the error message:

Scanning dependencies of target AboutFile
[  0%] Creating the about file
[  0%] Built target AboutFile
Scanning dependencies of target rtexif
[  0%] Building CXX object rtexif/CMakeFiles/rtexif.dir/rtexif.cc.obj
[  1%] Building CXX object rtexif/CMakeFiles/rtexif.dir/stdattribs.cc.obj
In file included from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/opthelper.h:26:0,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/LUT.h:71,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/procparams.h:30,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/rtexif.h:32,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/stdattribs.cc:26:
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xsin(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:270:38: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi_vd(vmul(d, vcast_vd_d(M_1_PI)));
                                      ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xcos(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:300:43: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi_vd(vsub(vmul(d, vcast_vd_d(M_1_PI)), vcast_vd_d(0.5)));
                                           ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble2 xsincos(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:333:38: error: 'M_2_PI' was not declared in this scope
   q = vrint_vi_vd(vmul(d, vcast_vd_d(M_2_PI)));
                                      ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xtan(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:388:38: error: 'M_2_PI' was not declared in this scope
   q = vrint_vi_vd(vmul(d, vcast_vd_d(M_2_PI)));
                                      ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble atan2k(vdouble, vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:462:47: error: 'M_PI' was not declared in this scope
   t = vadd(t, vmul(vcast_vd_vi(q), vcast_vd_d(M_PI/2)));
                                               ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xatan2(vdouble, vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:471:78: error: 'M_PI' was not declared in this scope
   r = vsel(vorm(vmask_isinf(x), vmask_eq(x, vcast_vd_d(0))), vsub(vcast_vd_d(M_PI/2), visinf2(x, vmulsign(vcast_vd_d(M_PI/2), x))), r);
                                                                              ^
In file included from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/opthelper.h:26:0,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/LUT.h:71,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/procparams.h:30,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/rtexif.h:32,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/stdattribs.cc:26:
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xacos(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:495:68: error: 'M_PI' was not declared in this scope
   y = (vdouble)vandm(vmask_lt(d, vcast_vd_d(0)), (vmask)vcast_vd_d(M_PI));
                                                                    ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xatan(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:534:79: error: 'M_PI' was not declared in this scope
   t = vsel(vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(1)), vsub(vcast_vd_d(M_PI/2), t), t);
                                                                               ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xsinf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1008:47: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)M_1_PI)));
                                               ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xcosf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1034:53: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi2_vf(vsubf(vmulf(d, vcast_vf_f((float)M_1_PI)), vcast_vf_f(0.5f)));
                                                     ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat2 xsincosf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1063:47: error: 'M_2_PI' was not declared in this scope
   q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)M_2_PI)));
                                               ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xtanf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1114:52: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)(2 * M_1_PI))));
                                                    ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xatanf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1168:93: error: 'M_PI' was not declared in this scope
   t = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(1)), vsubf(vcast_vf_f((float)(M_PI/2)), t), t);
                                                                                             ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat atan2kf(vfloat, vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1200:58: error: 'M_PI' was not declared in this scope
   t = vaddf(t, vmulf(vcast_vf_vi2(q), vcast_vf_f((float)(M_PI/2))));
                                                          ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xatan2f(vfloat, vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1209:93: error: 'M_PI' was not declared in this scope
   r = vself(vorm(vmaskf_isinf(x), vmaskf_eq(x, vcast_vf_f(0.0f))), vsubf(vcast_vf_f((float)(M_PI/2)), visinf2f(x, vmulsignf(vcast_vf_f((float)(M_PI/2)), x))), r);
                                                                                             ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xacosf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1233:78: error: 'M_PI' was not declared in this scope
   y = (vfloat)vandm(vmaskf_lt(d, vcast_vf_f(0.0f)), (vmask)vcast_vf_f((float)M_PI));
                                                                              ^
In file included from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/opthelper.h:26:0,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/LUT.h:71,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/procparams.h:30,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/rtexif.h:32,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/rtexif.cc:30:
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xsin(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:270:38: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi_vd(vmul(d, vcast_vd_d(M_1_PI)));
                                      ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xcos(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:300:43: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi_vd(vsub(vmul(d, vcast_vd_d(M_1_PI)), vcast_vd_d(0.5)));
                                           ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble2 xsincos(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:333:38: error: 'M_2_PI' was not declared in this scope
   q = vrint_vi_vd(vmul(d, vcast_vd_d(M_2_PI)));
                                      ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xtan(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:388:38: error: 'M_2_PI' was not declared in this scope
   q = vrint_vi_vd(vmul(d, vcast_vd_d(M_2_PI)));
                                      ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble atan2k(vdouble, vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:462:47: error: 'M_PI' was not declared in this scope
   t = vadd(t, vmul(vcast_vd_vi(q), vcast_vd_d(M_PI/2)));
                                               ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xatan2(vdouble, vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:471:78: error: 'M_PI' was not declared in this scope
   r = vsel(vorm(vmask_isinf(x), vmask_eq(x, vcast_vd_d(0))), vsub(vcast_vd_d(M_PI/2), visinf2(x, vmulsign(vcast_vd_d(M_PI/2), x))), r);
                                                                              ^
In file included from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/opthelper.h:26:0,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/LUT.h:71,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/procparams.h:30,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/rtexif.h:32,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/rtexif.cc:30:
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xacos(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:495:68: error: 'M_PI' was not declared in this scope
   y = (vdouble)vandm(vmask_lt(d, vcast_vd_d(0)), (vmask)vcast_vd_d(M_PI));
                                                                    ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vdouble xatan(vdouble)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:534:79: error: 'M_PI' was not declared in this scope
   t = vsel(vmaski_eq(vandi(q, vcast_vi_i(1)), vcast_vi_i(1)), vsub(vcast_vd_d(M_PI/2), t), t);
                                                                               ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xsinf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1008:47: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)M_1_PI)));
                                               ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xcosf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1034:53: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi2_vf(vsubf(vmulf(d, vcast_vf_f((float)M_1_PI)), vcast_vf_f(0.5f)));
                                                     ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat2 xsincosf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1063:47: error: 'M_2_PI' was not declared in this scope
   q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)M_2_PI)));
                                               ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xtanf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1114:52: error: 'M_1_PI' was not declared in this scope
   q = vrint_vi2_vf(vmulf(d, vcast_vf_f((float)(2 * M_1_PI))));
                                                    ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xatanf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1168:93: error: 'M_PI' was not declared in this scope
   t = vself(vmaski2_eq(vandi2(q, vcast_vi2_i(1)), vcast_vi2_i(1)), vsubf(vcast_vf_f((float)(M_PI/2)), t), t);
                                                                                             ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat atan2kf(vfloat, vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1200:58: error: 'M_PI' was not declared in this scope
   t = vaddf(t, vmulf(vcast_vf_vi2(q), vcast_vf_f((float)(M_PI/2))));
                                                          ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xatan2f(vfloat, vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1209:93: error: 'M_PI' was not declared in this scope
   r = vself(vorm(vmaskf_isinf(x), vmaskf_eq(x, vcast_vf_f(0.0f))), vsubf(vcast_vf_f((float)(M_PI/2)), visinf2f(x, vmulsignf(vcast_vf_f((float)(M_PI/2)), x))), r);
                                                                                             ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c: In function 'vfloat xacosf(vfloat)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleefsseavx.c:1233:78: error: 'M_PI' was not declared in this scope
   y = (vfloat)vandm(vmaskf_lt(d, vcast_vf_f(0.0f)), (vmask)vcast_vf_f((float)M_PI));
                                                                              ^
rtexif/CMakeFiles/rtexif.dir/build.make:86 : la recette pour la cible « rtexif/CMakeFiles/rtexif.dir/stdattribs.cc.obj » a échouée
make[2]: *** [rtexif/CMakeFiles/rtexif.dir/stdattribs.cc.obj] Erreur 1
make[2]: *** Attente des tâches non terminées....
In file included from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/color.h:28:0,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/iimage.h:30,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/rtengine.h:31,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtgui/options.h:23,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtgui/cacheimagedata.h:23,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/rtexif.cc:32:
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'double atan2k(double, double)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:312:12: error: 'M_PI' was not declared in this scope
   t = q * (M_PI/2) + t;
            ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'double xatan2(double, double)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:321:32: error: 'M_PI' was not declared in this scope
   if (xisinf(x) || x == 0) r = M_PI/2 - (xisinf(x) ? (sign(x) * (M_PI  /2)) : 0);
                                ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:322:32: error: 'M_PI' was not declared in this scope
   if (xisinf(y)          ) r = M_PI/2 - (xisinf(x) ? (sign(x) * (M_PI*1/4)) : 0);
                                ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:323:49: error: 'M_PI' was not declared in this scope
   if (             y == 0) r = (sign(x) == -1 ? M_PI : 0);
                                                 ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'double xacos(double)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:333:69: error: 'M_PI' was not declared in this scope
   return mulsign(atan2k(sqrt((1+d)*(1-d)), xfabs(d)), d) + (d < 0 ? M_PI : 0);
                                                                     ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'double xsin(double)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:377:22: error: 'M_1_PI' was not declared in this scope
   q = (int)xrint(d * M_1_PI);
                      ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'double xcos(double)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:406:28: error: 'M_1_PI' was not declared in this scope
   q = 1 + 2*(int)xrint(d * M_1_PI - 0.5);
                            ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'double2 xsincos(double)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:436:27: error: 'M_1_PI' was not declared in this scope
   q = (int)xrint(d * (2 * M_1_PI));
                           ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'double xtan(double)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:481:27: error: 'M_1_PI' was not declared in this scope
   q = (int)xrint(d * (2 * M_1_PI));
                           ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'float xsinf(float)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:991:30: error: 'M_1_PI' was not declared in this scope
   q = (int)xrintf(d * (float)M_1_PI);
                              ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'float xcosf(float)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:1016:36: error: 'M_1_PI' was not declared in this scope
   q = 1 + 2*(int)xrintf(d * (float)M_1_PI - 0.5f);
                                    ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'float2 xsincosf(float)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:1042:34: error: 'M_1_PI' was not declared in this scope
   q = (int)rint(d * ((float)(2 * M_1_PI)));
                                  ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'float xtanf(float)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:1083:35: error: 'M_1_PI' was not declared in this scope
   q = (int)xrintf(d * (float)(2 * M_1_PI));
                                   ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'float atan2kf(float, float)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:899:25: error: 'M_PI_2' was not declared in this scope
 #define M_PIf_2 ((float)M_PI_2)
                         ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:1159:25: note: in expansion of macro 'M_PIf_2'
   return mlaf(q,(float)(M_PIf_2),t);
                         ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'float xatan2f(float, float)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:898:23: error: 'M_PI' was not declared in this scope
 #define M_PIf ((float)M_PI)
                       ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:1166:33: note: in expansion of macro 'M_PIf'
   if (xisinff(x) || x == 0) r = M_PIf/2 - (xisinff(x) ? (signf(x) * (float)(M_PIf*.5f)) : 0);
                                 ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:898:23: error: 'M_PI' was not declared in this scope
 #define M_PIf ((float)M_PI)
                       ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:1167:33: note: in expansion of macro 'M_PIf'
   if (xisinff(y)          ) r = M_PIf/2 - (xisinff(x) ? (signf(x) * (float)(M_PIf*.25f)) : 0);
                                 ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:898:23: error: 'M_PI' was not declared in this scope
 #define M_PIf ((float)M_PI)
                       ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:1168:51: note: in expansion of macro 'M_PIf'
   if (              y == 0) r = (signf(x) == -1 ? M_PIf : 0);
                                                   ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c: In function 'float xacosf(float)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/sleef.c:1178:85: error: 'M_PI' was not declared in this scope
   return mulsignf(atan2kf(sqrtf((1.0f+d)*(1.0f-d)), fabsf(d)), d) + (d < 0 ? (float)M_PI : 0.0f);
                                                                                     ^
In file included from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/iimage.h:30:0,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/rtengine.h:31,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtgui/options.h:23,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtgui/cacheimagedata.h:23,
                 from C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtexif/rtexif.cc:32:
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/color.h: In static member function 'static T rtengine::Color::interpolatePolarHue_01(T, T, U)':
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/color.h:824:20: error: 'M_PI' was not declared in this scope
         if (d < T(-M_PI) || d < T(0) || d > T(M_PI)) { //there was an inversion here !! d > T(M_PI)
                    ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/color.h:833:19: error: 'M_PI' was not declared in this scope
         if(h < T(-M_PI)) {
                   ^
C:/msys64/home/sguyader/rawtherapee-5.0-gtk3/rtengine/color.h:837:18: error: 'M_PI' was not declared in this scope
         if(h > T(M_PI)) {
                  ^
rtexif/CMakeFiles/rtexif.dir/build.make:62 : la recette pour la cible « rtexif/CMakeFiles/rtexif.dir/rtexif.cc.obj » a échouée
make[2]: *** [rtexif/CMakeFiles/rtexif.dir/rtexif.cc.obj] Erreur 1
CMakeFiles/Makefile2:122 : la recette pour la cible « rtexif/CMakeFiles/rtexif.dir/all » a échouée
make[1]: *** [rtexif/CMakeFiles/rtexif.dir/all] Erreur 2
Makefile:127 : la recette pour la cible « all » a échouée
make: *** [all] Erreur 2

I reverted to -std=gnu++11 and it did compile.
I should mention that I’m still using an outdated MSYS2 environment inorder to compile with Gtk+ version 3.18, and it comes with GCC 5.3.0. Is the -std=c++11 flag incompatible with GCC 5.3.0?

@sguyader,

This simply means that the correct headers are not being picked up when you are stricter. :slight_smile: You can either add math.h or do what you did.

Yes, c++11 is compatible with 5.3.0

BTW, I use gcc 6.2.0 for compiling on Windows.

Hm, this seems rather MSYS than compiler specific. Those defines are guarded by

#if defined __USE_MISC || defined __USE_XOPEN

which seems not to be the case with MSYS and -std=c++11. My wild guess is, that -std=gnu++11 triggers the definition of __USE_MISC while __USE_XOPEN is defined on Linux. M_*_PI and friends are non-standard, so we must find another solution for them. I’ll take care of them in my PR this weekend.

Thanks for reporting! :thumbsup:

I’ve created a new branch for you to test with your old MSYS2.

Merged to dev. :slight_smile:

dev_5.0-r1-gtk3-51-gd2b4fe5e_WinVista_64 ( gtk3.22.8) uploaded at https://drive.google.com/open?id=0B2q9OrgyDEfPS2FpdDAtMVI1RG8

Version: 5.0-r1-gtk3-51-gd2b4fe5e
Branch: dev
Commit: d2b4fe5e
Commit date: 2017-02-21
Compiler: gcc 6.3.0
Processor: generic x86
System: Windows
Bit depth: 64 bits
Gtkmm: V3.22.0
Build type: release
Build flags: -m64 -mwin32 -mthreads -Werror=unused-label -Werror=unknown-pragmas -Wno-aggressive-loop-optimizations -std=c++11 -mtune=generic -Werror=unused-label -fopenmp -Werror=unknown-pragmas -mwindows -DNDEBUG -msse2 -O3
Link flags: -m64 -mthreads -static-libgcc -mtune=generic -mwindows -s -O3
OpenMP support: ON
MMAP support: ON

Just one additional warning during compilation :

In file included from Y:/RTSOURCE/rawtherapee/rtengine/dcraw.cc:72:0:
C:/msys64/mingw64/x86_64-w64-mingw32/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
 #warning Please include winsock2.h before windows.h
  ^~~~~~~

I have this “additional warning” for several days. It belongs to the lpc-fix of DCRAW.

I always ignore (especially this windows specific) warnings in dcraw.cc
Though I think it does not belong to the lcp-fix, but to the lossy-dng fix.
But that also does not matter for me as I ignore all the warnings in dcraw code