The Crypto++ Library, which is an open sourced C++ Cryptographic library, has a makefile for creating a static library. The library turns out to be a large library. Static link times when linking into my project aren't fast, particularily when used in a VMWare based development environment. To make linking and running faster, a shared library would be much better. I'm using the library in an Linux hosted Eclipse/C++ based IDE.
As I really havn't built a makefile by hand before, I
cheated and used Eclipse to create a project in which
to create the library. These are the steps I used:
- Create a new C++ project with a shared library as the target
- Created a src directory in the project GUI, manually copied the .h and .cpp files into the
directory
- Excluded the test files (bench*, bench2* test*, validat*, adhoc*, datatest*, regtest*,
fipsalgt*, dlltest*)
- In the C++ Compiler Preprocessor settings, added CRYPTOPP_DISABLE_ASM, which seemed to fix
an 'asm' message in vmac.cpp
- Unchecking the 'All Warningss (-Wall)' box in the C++ Compiler Warnings settings will
disable a flood of warnings
- Added '-pthread', '-pipe', and '-fPIC' flags to the C++ Miscellaneous flags (-fpic might
create smaller code, or -fpic may even be left out, but I havn't tried that).
- Named the object 'cryptopp' in the C++ Linker Shared Library Settings for Shared Object
Name (-Wl,-soname=)
- Compiled the library, copied the resulting file 'libcryptopp.so' to /usr/lib, and ran
'ldconfig /usr/lib/libcryptopp.so'.
With a little more work, I could now take these settings from Eclipse's make file, and
retrofit them into the original Crypto++ GNUMakefile, but I'll save that for another day.
As a backgrounder on shared libraries, I used the
TLDP's
Program Library HowTo as for reference.