I'm not sure if anyone is still interested in this, but I'll give an answer 
here for anyone else who comes looking.

First of all, the 'GNUmakefile' in CryptoPP 5.6.2 seems not to be updated 
for building the dll.

The variable 'DLLSRCS' only contains some of the files required to build 
the dll. Replace the line that contains the definition of that variable 
with the following:

DLLSRCS = algebra.cpp algparam.cpp asn.cpp authenc.cpp basecode.cpp 
cbcmac.cpp ccm.cpp channels.cpp cmac.cpp cpu.cpp cryptlib.cpp des.cpp 
dessp.cpp dh.cpp dll.cpp dsa.cpp ec2n.cpp eccrypto.cpp ecp.cpp emsa2.cpp 
eprecomp.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gcm.cpp 
gf2n.cpp gfpcrypt.cpp hex.cpp hmac.cpp hrtimer.cpp integer.cpp iterhash.cpp 
misc.cpp modes.cpp mqueue.cpp nbtheory.cpp oaep.cpp osrng.cpp pch.cpp 
pkcspad.cpp pssr.cpp pubkey.cpp queue.cpp randpool.cpp rdtables.cpp 
rijndael.cpp rng.cpp rsa.cpp rw.cpp sha.cpp simple.cpp skipjack.cpp 
strciphr.cpp trdlocal.cpp

Furthermore, since GCC 4.7 (I think), another options must be added to the 
variable 'CXXFLAGS' when building large dlls with lots of inline member 
functions (like Crypto++ or wxWidgets) [put this line near the top of the 
file, where most of variables are defined]: 

CXXFLAGS += -fno-keep-inline-dllexport

(Note: I say since GCC 4.7 because I've compiled with GCC 4.6.1 and 
everything went fine without specifying this option)

Two more things, even if they're not strictly related to building the dll.

1) The first line defines CXXFLAGS as: '-DNDEBUG -g -O2'. You might want to 
omit the '-g' if you're building a "release" dll and conversely remove the '
-O2' and modify '-DNDEBUG' in '-DDEBUG' for a 'debug' dll. Even if GCC 
allows you to mix '-g' and '-O', I recommend you do this only in special 
cases. Otherwise, a normal 'release' (for production) and a normal 'debug' 
dll (for developing) is your best bet.

2) The makefile tries to identify the version of GNU assembler, but the 
supplied commands only work on Linux (and possibly Cygwin, I haven't 
tried). Without identifying the assembler - the dll will be built without 
ASM optimizations (no SSSE3, no AESNI, etc.) So here's some updated 
commands that correctly identify the assembler [replace the original ones 
in the makefile]:

GAS210_OR_LATER = $(shell $(AS) --version 2>&1 | $(EGREP) -c "GNU assembler 
.*? (2\.[1-9][0-9]|[3-9])")
GAS217_OR_LATER = $(shell $(AS) --version 2>&1 | $(EGREP) -c "GNU assembler 
.*? (2\.1[7-9]|2\.[2-9]|[3-9])")
GAS219_OR_LATER = $(shell $(AS) --version 2>&1 | $(EGREP) -c "GNU assembler 
.*? (2\.19|2\.[2-9]|[3-9])")

That's about it. It should build successfuly now, by issuing the command: 

make (or mingw32-make) cryptopp.dll

Tested with TDM-GCC 4.7 and 4.8.1, 32 and 64 bit.

P.S.1:  In GCC 4.7, if you decide to increase the optimization to '-O3' 
you'll get some warnings about "duplicate section has different size", but 
everything seems to be fine in the end. Funny enough, these warnings are 
gone in 4.8.1.

P.S.2: Still, I cannot build 'dlltest.exe', due to some other compiler 
errors. But, anyway...

On Thursday, August 8, 2013 4:36:48 PM UTC+2, Elvis Dukaj wrote:
>
> I'm able to build the library as static and all test passed succefull, but 
> I've no idea how to build it as shared library
>

-- 
-- 
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.
--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to