I downloaded crypto++ 5.6.2 (the zip file) and built it using just make
(I have gcc 4.8.1). It seemed to work and gave me a libcryptopp.a
file.
Now, to test the setup, I tried to compile the test.cpp
file that was provided with the download (link here: http://www.cryptopp.com/docs/ref/test_8cpp_source.html).
First, I compiled it with
g++ -Wall -std=c++11 -g -Iinclude -I/c/libraries/cryptopp562 -c test.cpp -o obj/test.o
which gave a lot of warnings (deprecations and unused variables mostly) but worked and I got the test.o
file.
Now, to link it, I used
g++ obj/test.o -o bin/test -L/c/libraries/cryptopp562 -lcryptopp
But this gave a lot of undefined reference
errors and failed.
For example
D:\.../test.cpp:119: undefined reference to `RegisterFactories()'
But when you look at the test.cpp
file (http://www.cryptopp.com/docs/ref/test_8cpp_source.html), there is only the declaration to RegisterFactories()
, but no definition. Does this mean, it needs to find it from the library? (A local declaration shouldn't be needed in this case, no?)
Ok, so what do I have to do to get the whole library to work? Use gmake
to build it? Or use an older gcc
? Or maybe my compile/link commands are incorrect?
Setting up crypto++
The instructions to setup Crypto++ under Linux are on the wiki at Build and Install the Library.
... to test the setup, I tried to compile the
test.cpp
...
If you want to build the test suite, then you run make cryptest.exe
.
If you want to run the test suite after building it, you run ./cryptest.exe v
.
undefined reference to RegisterFactories()
There are 9 source files that are used in the test suite. They are:
... what do I have to do to get the whole library to work?
make cryptest.exe
and ./cryptest.exe v
usually work fine :)
I usually run make static dynamic cryptest.exe
to build both the static archive and the shared object.
You can also run individual test with tv
command. For example, ./cryptest.exe tv sha1
will run SHA-1 related tests. tv
is "test vectors", and they are located in the `TestVectors" directory of the sources.
Related, if you want the test suite to run after installation, then you will need the DataDir Patch.
Its a patch supplied by the community. Its not part of the Crypto++ library (though it should probably be part of the library).