Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building with GCC 6.x requires cmath #7

Open
dilworks opened this issue Oct 10, 2016 · 0 comments
Open

Building with GCC 6.x requires cmath #7

dilworks opened this issue Oct 10, 2016 · 0 comments

Comments

@dilworks
Copy link

dilworks commented Oct 10, 2016

I tried to build the plugin on my two Debian boxes: one running Stable (which runs GCC 4.9) and another running Testing (which switched to GCC 6 recently). On the Stable box, it builds just fine, but on the Testing/GCC6 it fails with this:

tomman@himawari:~/workbench/tsdx-mbench/vs-filters/VapourSynth-FFT3DFilter$ make
g++ -msse2 -mfpmath=sse -O3 -ffast-math -fomit-frame-pointer -fno-tree-vectorize -Wall -std=c++11 -I. -I. -fPIC -I/opt/tsdx_workbench/include -march=native -fexcess-precision=fast -c fft3dfilter_c.cpp -o fft3dfilter_c.o
fft3dfilter_c.cpp: In function ‘void ApplyWiener2D_C(float (*)[2], int, int, int, int, float, float, float, float, float, const float*, float, const float*, float)’:
fft3dfilter_c.cpp:74:158: error: ‘sqrt’ was not declared in this scope
   WienerFactor *= 1 + sharpen*wsharpen[w]*sqrt( psd*sigmaSquaredSharpenMax/((psd + sigmaSquaredSharpenMin)*(psd + sigmaSquaredSharpenMax)) ); // sharpen factor - changed in v.1.1
                                                                                                                                            ^
fft3dfilter_c.cpp:114:158: error: ‘sqrt’ was not declared in this scope
           WienerFactor *= 1 + sharpen*wsharpen[w]*sqrt( psd*sigmaSquaredSharpenMax/((psd + sigmaSquaredSharpenMin)*(psd + sigmaSquaredSharpenMax)) ) *
                                                                                                                                                    ^
fft3dfilter_c.cpp: In function ‘void Sharpen_C(float (*)[2], int, int, int, int, float, float, float, const float*, float, const float*, float)’:
fft3dfilter_c.cpp:680:151: error: ‘sqrt’ was not declared in this scope
                sfact = (1 + sharpen*wsharpen[w]*sqrt( psd*sigmaSquaredSharpenMax/((psd + sigmaSquaredSharpenMin)*(psd + sigmaSquaredSharpenMax)) ) ) ;
                                                                                                                                                  ^
fft3dfilter_c.cpp:723:151: error: ‘sqrt’ was not declared in this scope
                sfact = (1 + sharpen*wsharpen[w]*sqrt( psd*sigmaSquaredSharpenMax/((psd + sigmaSquaredSharpenMin)*(psd + sigmaSquaredSharpenMax)) ) ) *
                                                                                                                                                  ^
fft3dfilter_c.cpp: In function ‘void Sharpen_degrid_C(float (*)[2], int, int, int, int, float, float, float, const float*, float, const float (*)[2], float, const float*, float)’:
fft3dfilter_c.cpp:772:151: error: ‘sqrt’ was not declared in this scope
                 sfact = (1 + sharpen*wsharpen[w]*sqrt( psd*sigmaSquaredSharpenMax/((psd + sigmaSquaredSharpenMin)*(psd + sigmaSquaredSharpenMax)) )) ;
                                                                                                                                                   ^
fft3dfilter_c.cpp:837:151: error: ‘sqrt’ was not declared in this scope
                 sfact = (1 + sharpen*wsharpen[w]*sqrt( psd*sigmaSquaredSharpenMax/((psd + sigmaSquaredSharpenMin)*(psd + sigmaSquaredSharpenMax)) )) *
                                                                                                                                                   ^
fft3dfilter_c.cpp: In function ‘void ApplyWiener2D_degrid_C(float (*)[2], int, int, int, int, float, float, float, float, float, const float*, float, const float (*)[2], float, const float*, float)’:
fft3dfilter_c.cpp:916:158: error: ‘sqrt’ was not declared in this scope
   WienerFactor *= 1 + sharpen*wsharpen[w]*sqrt( psd*sigmaSquaredSharpenMax/((psd + sigmaSquaredSharpenMin)*(psd + sigmaSquaredSharpenMax)) ); // sharpen factor - changed in v.1.1
                                                                                                                                            ^
fft3dfilter_c.cpp:980:158: error: ‘sqrt’ was not declared in this scope
           WienerFactor *= 1 + sharpen*wsharpen[w]*sqrt( psd*sigmaSquaredSharpenMax/((psd + sigmaSquaredSharpenMin)*(psd + sigmaSquaredSharpenMax)) ) *
                                                                                                                                                    ^
GNUmakefile:27: fallo en las instrucciones para el objetivo 'fft3dfilter_c.o'
make: *** [fft3dfilter_c.o] Error 1

I managed to build on this setup only after including <math.h> on fft3dfilter_c.cpp and FFT3DFilter.cpp. I'm unsure if math.h is the proper header (I'm not a C++ guy) since it appears sqrt() is overloaded on quite a few headers these days, but at least it got the build going on for me (but I've yet to test it!)

To be fair, very few distros are using GCC 6.x now, and I'm not clear on why this change (as I said, the plugin builds just fine without any changes under GCC 4.9!), but that's something to watch out in the future as more distros switch to newer GCC.

UPDATE: It seems that the proper header to include is actually cmath!

@dilworks dilworks changed the title Building with GCC 6.x requires math.h Building with GCC 6.x requires cmath Oct 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant