Building Crypto++ using MinGW under Windows 10

1,310 views
Skip to first unread message

Daniel Karcz

unread,
Jul 27, 2017, 3:01:29 PM7/27/17
to Crypto++ Users
Hi,

Can somebody provide GCC's make commands for building static and dynamic libraries under Windows using MinGw.

I've tried with commands what I found for example on this discussions group, but I always getting couple of errors connected with 'mutex'.

Thanks in advance,
Daniel 

Marcel Raad

unread,
Jul 27, 2017, 3:48:08 PM7/27/17
to Daniel Karcz, Crypto++ Users
Hi Daniel,

which flavor and version of MinGW are you using? The original version from mingw.org or MinGW-w64?

If you're using MinGW-w64, you should choose POSIX rather than Windows threads to get std::mutex. If you're using the original MinGW, you probably need a third-party threading library. Or try compiling with -std=gnu++98.

Marcel

--
--
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscribe@googlegroups.com.
More information about Crypto++ and this group is available at http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Karcz

unread,
Jul 28, 2017, 2:08:28 AM7/28/17
to Crypto++ Users, daniel...@gmail.com
Hello Marcel,

thanks for your reply, I'm using original version from mingw.org, but since your post I've decided to try MinGW-w64. I tried both POSIX and win32 versions, with both I'm getting the same output after: (after mingw32-make):

process_begin: CreateProcess(NULL, uname, ...) failed.
mingw32-make: GNUmakefile:16: pipe: No error
'uname' is not recognized as an internal or external command,
operable program or batch file.
'uname' is not recognized as an internal or external command,
operable program or batch file.
'uname' is not recognized as an internal or external command,
operable program or batch file.
'uname' is not recognized as an internal or external command,
operable program or batch file.
'uname' is not recognized as an internal or external command,
operable program or batch file.
'uname' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
'cut' is not recognized as an internal or external command,
operable program or batch file.
'cut' is not recognized as an internal or external command,
operable program or batch file.
'cut' is not recognized as an internal or external command,
operable program or batch file.
'egrep' is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, cat Filelist.txt, ...) failed.
mingw32-make: GNUmakefile:672: pipe: No such file or directory
g++ -DNDEBUG -g2 -O2 -march=native -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180 -mbnu210 -native -KPIC -template=no%extdef -DCRYPTOPP_INCLUDE_VECTOR_CC -c cryptlib.cpp
g++: error: unrecognized command line option '-wd68'
g++: error: unrecognized command line option '-wd186'
g++: error: unrecognized command line option '-wd279'
g++: error: unrecognized command line option '-wd327'
g++: error: unrecognized command line option '-wd161'
g++: error: unrecognized command line option '-wd3180'
g++: error: unrecognized command line option '-mbnu210'
g++: error: unrecognized command line option '-native'; did you mean '--time'?
g++: error: unrecognized command line option '-KPIC'; did you mean '-fPIC'?
g++: error: unrecognized command line option '-template=no%extdef'; did you mean '-ftemplate-depth-'?
mingw32-make: *** [GNUmakefile:784: cryptlib.o] Error 1


Daniel



On Thursday, 27 July 2017 21:48:08 UTC+2, Marcel Raad wrote:
Hi Daniel,

which flavor and version of MinGW are you using? The original version from mingw.org or MinGW-w64?

If you're using MinGW-w64, you should choose POSIX rather than Windows threads to get std::mutex. If you're using the original MinGW, you probably need a third-party threading library. Or try compiling with -std=gnu++98.

Marcel

Am 27.07.2017 9:01 nachm. schrieb "Daniel Karcz" <daniel...@gmail.com>:
Hi,

Can somebody provide GCC's make commands for building static and dynamic libraries under Windows using MinGw.

I've tried with commands what I found for example on this discussions group, but I always getting couple of errors connected with 'mutex'.

Thanks in advance,
Daniel 

--
--
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-user...@googlegroups.com.

More information about Crypto++ and this group is available at http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-user...@googlegroups.com.

Marcel Raad

unread,
Jul 28, 2017, 1:57:21 PM7/28/17
to Daniel Karcz, Crypto++ Users
Ah, that's probably because you're building from a DOS box without unix tools? Try the MSYS2 version of MinGW-w64 (www.msys2.org). With this one, I can build Crypto++ fine by just typing "make" in the shell in all 3 variants (MinGW32, MinGW64, MSYS - you probably want one of the first two depending on target architecture).

Marcel

To unsubscribe, send an email to cryptopp-users-unsubscribe@googlegroups.com.

More information about Crypto++ and this group is available at http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscribe@googlegroups.com.

Daniel Karcz

unread,
Jul 29, 2017, 2:22:46 PM7/29/17
to Crypto++ Users, daniel...@gmail.com
Hi Marcel,

I was building under Windows, without dosbox.  I've just downloaded MinnGW-w64 from original project website.
Now I already installed the MSYS2, I opened the mingw64.exe from default MSYS2 installation folder, after opening I used command  "pacman -S git mingw-w64-x86_64-gcc base-devel" to install gcc.

After these steps I copied to my msys64 home folder files downloaded and unzipped from Crypto++ project website. (I done this because I don't know if it's possible to reach windows folders from MSYS2 bash).

Now when I'm in folder with crypto++ files, I'm using like you write before just 'make' command. After few minutes process is done, but I don't have files with *.lib or *.dll extensions in folder. I see libcryptopp.a file - I think this is a static library for unix systems, but I would like to use library under Windows.

Daniel

Jeffrey Walton

unread,
Jul 30, 2017, 12:24:51 PM7/30/17
to Crypto++ Users, daniel...@gmail.com


On Saturday, July 29, 2017 at 2:22:46 PM UTC-4, Daniel Karcz wrote:
...
Now when I'm in folder with crypto++ files, I'm using like you write before just 'make' command. After few minutes process is done, but I don't have files with *.lib or *.dll extensions in folder. I see libcryptopp.a file - I think this is a static library for unix systems, but I would like to use library under Windows.

I believe you need to 'make cryptopp.dll'. Also see https://github.com/weidai11/cryptopp/blob/master/GNUmakefile#L725 .

_IF_ you experience missing source files, then let us know. DLLSRCS in the Makefile may not be up to date. We can check-in a change quickly,

But be careful of DLLs on Windows. Usually, you want the static archive. Later, you wrap it in your DLL with your API if that's want you want to do.

The FIPS DLL almost always causes problems. Avoid it if possible. Also see https://www.cryptopp.com/wiki/FIPS_DLL and https://www.cryptopp.com/wiki/Visual_Studio.

Jeff

Daniel Karcz

unread,
Jul 31, 2017, 1:17:54 AM7/31/17
to Crypto++ Users, daniel...@gmail.com
Hello Jeffrey,

Yes I would like to get a Windows static library instead of DLL. What exactly I had to write into bash to get static library.

I also try with command 'make cryptopp.dll' and like you write before, I think some files are missing because after some compilations make is giving me this message:
'make: *** No rule to make target 'poly1305.export.o', needed by 'cryptopp.dll'.  Stop.'

Daniel

Marcel Raad

unread,
Jul 31, 2017, 3:33:32 PM7/31/17
to Daniel Karcz, Crypto++ Users
Hi Daniel,

(sorry to everyone for top-posting all the time and not being able to quote correctly, I have to use the Gmail Android App at the moment, which won't let me do that)

I think libcryptopp.a is the one you want as a static library. The MinGW linker accepts both lib*.a and *.lib files. IIRC, I also successfully used MinGW-generated *.a files with the MSVC linker once. But mixing both is probably a bad idea because of the different runtimes used.

Marcel

--
--
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscribe@googlegroups.com.

More information about Crypto++ and this group is available at http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups "Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscribe@googlegroups.com.

Jeffrey Walton

unread,
Jul 31, 2017, 8:02:48 PM7/31/17
to Crypto++ Users, daniel...@gmail.com

Yes I would like to get a Windows static library instead of DLL. What exactly I had to write into bash to get static library.

In that case you probably don't need the 'make cryptopp.dll' recipe.
 
I also try with command 'make cryptopp.dll' and like you write before, I think some files are missing because after some compilations make is giving me this message:
'make: *** No rule to make target 'poly1305.export.o', needed by 'cryptopp.dll'.  Stop.'

This issue should be fixed. Its usually a matter of typing 'make sources', and then copying the resulting list of "Library Sources" into GNUmakefile's DLLSRCS variable.

Also see https://github.com/weidai11/cryptopp/commit/2171a3a3792c

Jeff

Daniel Karcz

unread,
Aug 2, 2017, 1:27:03 AM8/2/17
to Crypto++ Users, daniel...@gmail.com
Hi,

Everything is working ok, as you wrote. I used just 'make' command and I'm currently using static library 'libcryptopp.a'. I tried yesterday with g++ compiler from mentioned before MSYS2 under Windows 10 - to do this I have install Code::Blocks without compiler. I have to update path to compiler, add builded before 'libcryptopp.a' to linker path and add path with library files (*.h) to compiler search directories.

Thank You very much for helping me to run this library.
Daniel
Reply all
Reply to author
Forward
0 new messages