MinGW make

148 views
Skip to first unread message

Jean

unread,
Jan 26, 2020, 3:44:46 PM1/26/20
to Crypto++ Users
Hi !

I try to compile this library: Crypto++® Library 8.2

I'm new with MingW. Downloaded the latest from (Date: 2017-09-06, Size: 91.00 KB)

The same kind of error appears many time when compiling:   aria_simd.cpp

emmintrin.h:615:1:  error: inlining failed in call to always_inline '__m128i _mm_set_epi8
emmintrin.h:718:1:  error: inlining failed in call to always_inline 'void _mm_storeu_si128
emmintrin.h:1290:1: error: inlining failed in call to always_inline '__m128i _mm_xor_si128
emmintrin.h:700:1:  error: inlining failed in call to always_inline '__m128i _mm_loadu_si128
tmmintrin.h:136:1:  error: inlining failed in call to always_inline '__m128i _mm_shuffle_epi8
emmintrin.h:694:1:  error: inlining failed in call to always_inline '__m128i _mm_load_si128

___________________________________________________________________________________

$ make  -B                                                                                                              
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c cryptlib.cpp                                                        
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c cpu.cpp                                                             
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c integer.cpp                                                         
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c 3way.cpp                                                            
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c adler32.cpp                                                         
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c algebra.cpp                                                         
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c algparam.cpp                                                        
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c arc4.cpp                                                            
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c aria.cpp                                                            
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c aria_simd.cpp                                                       
aria_simd.cpp: In function 'void CryptoPP::ARIA_ProcessAndXorBlock_SSSE3(const byte*, CryptoPP::byte*, const byte*, CryptoPP::word32*)':
aria_simd.cpp:156:76: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
  const __m128i MASK = _mm_set_epi8(12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3);
                                                                            ^
In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\pmmintrin.h:31,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\tmmintrin.h:31,
                 from aria_simd.cpp:14:
c:\mingw\lib\gcc\mingw32\8.2.0\include\emmintrin.h:615:1: error: inlining failed in call to always_inline '__m128i _mm_set_epi8(char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char)': target specific option mismatch
 _mm_set_epi8 (char __q15, char __q14, char __q13, char __q12,
 ^~~~~~~~~~~~
aria_simd.cpp:156:35: note: called from here
  const __m128i MASK = _mm_set_epi8(12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3);
                       ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\pmmintrin.h:31,
                 from c:\mingw\lib\gcc\mingw32\8.2.0\include\tmmintrin.h:31,
                 from aria_simd.cpp:14:
c:\mingw\lib\gcc\mingw32\8.2.0\include\emmintrin.h:718:1: error: inlining failed in call to always_inline 'void _mm_storeu_si128(__m128i_u*, __m128i)': target specific option mismatch
 _mm_storeu_si128 (__m128i_u *__P, __m128i __B)
 ^~~~~~~~~~~~~~~~
aria_simd.cpp:178:19: note: called from here
   _mm_storeu_si128(M128_CAST(outBlock),
   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
    _mm_xor_si128(
    ~~~~~~~~~~~~~~
     _mm_loadu_si128(CONST_M128_CAST(xorBlock)),
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     _mm_xor_si128(
     ~~~~~~~~~~~~~~
      _mm_loadu_si128(CONST_M128_CAST(outBlock)),
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      _mm_shuffle_epi8(_mm_load_si128(CONST_M128_CAST(rk)), MASK)))
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    );
    
...    
___________________________________________________________________________________

Any suggestion is appreciated.

Good day.






Jeffrey Walton

unread,
Jan 26, 2020, 4:00:50 PM1/26/20
to Crypto++ Users List
On Sun, Jan 26, 2020 at 3:44 PM Jean <jean2...@gmail.com> wrote:
>
> I try to compile this library: Crypto++® Library 8.2
>
> I'm new with MingW. Downloaded the latest from (Date: 2017-09-06, Size: 91.00 KB)
> https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/
>
> The same kind of error appears many time when compiling: aria_simd.cpp
>
> emmintrin.h:615:1: error: inlining failed in call to always_inline '__m128i _mm_set_epi8
> emmintrin.h:718:1: error: inlining failed in call to always_inline 'void _mm_storeu_si128
> emmintrin.h:1290:1: error: inlining failed in call to always_inline '__m128i _mm_xor_si128
> emmintrin.h:700:1: error: inlining failed in call to always_inline '__m128i _mm_loadu_si128
> tmmintrin.h:136:1: error: inlining failed in call to always_inline '__m128i _mm_shuffle_epi8
> emmintrin.h:694:1: error: inlining failed in call to always_inline '__m128i _mm_load_si128
>
> ___________________________________________________________________________________
>
> $ make -B
> ...
> g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c aria_simd.cpp
> aria_simd.cpp: In function 'void CryptoPP::ARIA_ProcessAndXorBlock_SSSE3(const byte*, CryptoPP::byte*, const byte*, CryptoPP::word32*)':
> aria_simd.cpp:156:76: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
> const __m128i MASK = _mm_set_epi8(12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3);

The aria_simd.cpp recipe should use -mssse3. Other *_simd.cpp files
have similar requirements; see
https://www.cryptopp.com/wiki/BASE+SIMD#Arch_Options.

What operating system are you using?

Jeff

Jean

unread,
Jan 26, 2020, 10:24:19 PM1/26/20
to Crypto++ Users
Hi Jeffrey !

Thanks for your very quick reply!  
I didn't expect an answer so soon, especially a sunday afternoon.

> The aria_simd.cpp recipe should use -mssse3. Other *_simd.cpp files
> have similar requirements; see
https://www.cryptopp.com/wiki/BASE+SIMD#Arch_Options.
>
> What operating system are you using?

Windows 10 Pro
64 bit Operating System, x64-based processor

All #Arch_Options from wiki page work just fine.

2 ..._simd.cpp are missing on that page
I used the following lines.
Can you tell me if flag -mssse3 are good in those 2 cases ?
It should be ok according to comments in GNUmakefile 

g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c -mssse3 keccak_simd.cpp      
g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c -mssse3 simeck_simd.cpp   

In GNUmakefile we can read:

# SSSE3 or NEON available
aria_simd.o : aria_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(ARIA_FLAG) -c) $<

It seems to me that $(ARIA_FLAG) wasn't well defined since it requires manual compilation.
Same remark for all ..._simd.cpp

And a new error

g++ -DNDEBUG -g2 -O3 -D_WIN32_WINNT=0x0501 -pipe -c test.cpp
test.cpp: In function 'void CryptoPP::Test::SetArgvPathHint(const char*, std::__cxx11::string&)':
test.cpp:495:19: error: 'realpath' was not declared in this scope
  char* resolved = realpath (pathHint.c_str(), NULLPTR);

Thanks again for your support !  

Jeffrey Walton

unread,
Jan 27, 2020, 2:29:37 AM1/27/20
to Crypto++ Users


On Sunday, January 26, 2020 at 10:24:19 PM UTC-5, Jean wrote:
Hi Jeffrey !

Thanks for your very quick reply!  
I didn't expect an answer so soon, especially a sunday afternoon.

> The aria_simd.cpp recipe should use -mssse3. Other *_simd.cpp files
> have similar requirements; see
https://www.cryptopp.com/wiki/BASE+SIMD#Arch_Options.
>
> What operating system are you using?

Windows 10 Pro
64 bit Operating System, x64-based processor

You will need this commit for the (1) arch compile error: https://github.com/weidai11/cryptopp/commit/cc23a39fb9e0 .

You will need this commit for the (2) realpath compile error: https://github.com/weidai11/cryptopp/commit/9f0b2e27bbae

The second error, (2) realpath, will not affect the library. It does affect the self tests since cryptest.exe does not build.

You may need this patch, if you have problems with localtime or asctime: https://github.com/weidai11/cryptopp/commit/b706548e6cd5

Jeff

Jean

unread,
Jan 28, 2020, 12:54:32 AM1/28/20
to Crypto++ Users

You may need this patch, if you have problems with localtime or asctime: https://github.com/weidai11/cryptopp/commit/b706548e6cd5


Hi Jeffrey !
 
Commit (1) and (2) work just as fine.

I couldn't apply the patch about localtime or asctime. The compilation didn't complain about validate.h.
The submitted patch for time is probably from a repository's branch and doesn't match the downloaded validate.h.
See function TimeToString() below.
___________________________________________________________________________________
// Safer functions on Windows for C&A, http://github.com/weidai11/cryptopp/issues/55
inline std::string TimeToString(const time_t& t)
{
#if (CRYPTOPP_MSC_VERSION >= 1400)
tm localTime = {};
char timeBuf[64];
errno_t err;

err = ::localtime_s(&localTime, &t);
CRYPTOPP_ASSERT(err == 0);
err = ::asctime_s(timeBuf, sizeof(timeBuf), &localTime);
CRYPTOPP_ASSERT(err == 0);

std::string str(timeBuf);
#else
std::string str(::asctime(::localtime(&t)));
#endif

// Cleanup whitespace
std::string::size_type pos = 0;
while (!str.empty() && std::isspace(str[str.length()-1]))
{str.erase(str.end()-1);}
while (!str.empty() && std::string::npos != (pos = str.find("  ", pos)))
{str.erase(pos, 1);}

return str;
}

___________________________________________________________________________________

I don't need cross-compiling. But i gave it a try with a similar patch around line 199 in GNUmakefile-cross.
It compile fine except for those two.

g++ -DNDEBUG -g2 -O3 -fPIC -pipe -Wall -c -mpclmul      gf2n_simd.cpp
g++ -DNDEBUG -g2 -O3 -fPIC -pipe -Wall -c -mssse3       keccak_simd.cpp

Thanks for all you did.
I'm all set now and can go on.


 
Reply all
Reply to author
Forward
0 new messages