Fixed bug 3979 - Failed to link with "multiple definition of `scalbln'" error on both MinGW and MinGW-w64 by CMake
authorSam Lantinga <slouken@libsdl.org>
Fri, 24 Nov 2017 03:01:07 -0800
changeset 117130083f778ede4
parent 11712 b94292eebb5c
child 11714 f10f06ee8207
Fixed bug 3979 - Failed to link with "multiple definition of `scalbln'" error on both MinGW and MinGW-w64 by CMake

Vitaly Novichkov

Once I ran build of my codecs collection on AppVeyor where my CMake script downloads latest SDL2 from HG repo, failed to link because of math functions conflict:

https://ci.appveyor.com/project/Wohlstand/audiocodecs/build/1.0.44
The revision is b94292eebb5c

There are both vanilla MinGW and MinGW-w64 are failed to build.


```
[100%] Linking C shared library libSDL2.dll
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libmingwex.a(scalbn.o):(.text+0x0): multiple definition of `scalbln'
CMakeFiles\SDL2.dir/objects.a(s_scalbn.c.obj):C:/projects/audiocodecs/build-MinGW-Release-Win32/external/SDL2/src/SDL2HG/src/libm/s_scalbn.c:30: first defined here
src/libm/math_private.h
     1.1 --- a/src/libm/math_private.h	Tue Nov 21 21:58:27 2017 -0800
     1.2 +++ b/src/libm/math_private.h	Fri Nov 24 03:01:07 2017 -0800
     1.3 @@ -40,6 +40,7 @@
     1.4  #define __ieee754_fmod  SDL_uclibc_fmod
     1.5  #define __ieee754_log   SDL_uclibc_log
     1.6  #define __ieee754_pow   SDL_uclibc_pow
     1.7 +#define scalbln         SDL_uclibc_scalbln
     1.8  #define scalbn          SDL_uclibc_scalbn
     1.9  #define sin             SDL_uclibc_sin
    1.10  #define __ieee754_sqrt  SDL_uclibc_sqrt