It doesn't look like an official build of GCC 4.2 for MINGW is available. I 
do see an unofficial one at http://www.thisiscool.com/gcc_mingw.htm#gcj42. 
Is that where you obtained your copy?

The reason _mm_alloc is defined to be __mingw_aligned_malloc is that 
_mm_alloc doesn't exist in my build of GCC (3.4.2) for MINGW. I'm not sure 
if either of your suggested fixes is backwards compatible.
The simplest fix would be to remove all of the following from config.h:

#elif defined(__MINGW32__)
 #if (CRYPTOPP_GCC_VERSION < 40100) && !defined(_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

and just let the code in Crypto++ do the malloc alignment. Can you try that 
and let me know if it works?

----- Original Message ----- 
From: "phokat" <[EMAIL PROTECTED]>
To: "Crypto++ Users" <[EMAIL PROTECTED]>
Sent: Monday, May 28, 2007 7:11 AM
Subject: Compilation errors with MINGW (possible bug)


>
>
> 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