Compilation with mingw gcc (4.2.0) on Windows XP gives following
errors at salsa.cpp compilation step.
g++ -DNDEBUG -g -O2 -msse2 -pipe -c salsa.cpp
In file included from c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.0/
include/xmmintrin.h:42,
                 from c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.0/
include/emmintrin.h:34,
                 from salsa.cpp:10:
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.0/include/mm_malloc.h: In
function 'void* __mingw_aligned_malloc(size_t, size_t)':
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.0/include/mm_malloc.h:34:
error: 'void* __mingw_aligned_malloc(size_t, size_t)' was declared
'extern' and later 'static'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.0/../../../../include/
malloc.h:88: error: previous declaration of 'void*
__mingw_aligned_malloc(size_t, size_t)'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.0/include/mm_malloc.h: In
function 'void __mingw_aligned_free(void*)':
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.0/include/mm_malloc.h:71:
error: 'void __mingw_aligned_free(void*)' was declared 'extern' and
later 'static'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.0/../../../../include/
malloc.h:90: error: previous declaration of 'void
__mingw_aligned_free(void*)'

The error occurs in all versions of gcc 3.4 - 4.2

The error occurs because in config.h (line 303) _mm_alloc is linked to
_mingw_aligned_malloc
#elif defined(__MINGW32__)
        #ifndef _mm_malloc
                #define _mm_malloc(a, b)    __mingw_aligned_malloc(a, b)
                #define _mm_free(a)         __mingw_aligned_free(a)
        #endif
        #define CRYPTOPP_MM_MALLOC_AVAILABLE

while in salsa.cpp (line 9) including emmintrin.h results in a error
since _mm_alloc is defined in mm_alloc.h as local function.
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
#include <emmintrin.h>
#endif


This quick and dirty fix in salsa.cpp solved the problem
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
+       #if defined(__MINGW32__)
+               #ifdef _mm_malloc
+                       #undef _mm_malloc
+                       #undef _mm_free
+               #endif
+       #endif
#include <emmintrin.h>
#endif

another possible fix could be in config.h
#if !defined(CRYPTOPP_DISABLE_SSE2) &&
(defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__))
        #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
+       #if defined(__MINGW32__)
+               #include <emmintrin.h>
+       #endif

#else
        #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
#endif


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to