github Linux下开源merkle-Tree构建
github: https://github.com/IAIK/merkle-tree.git
一、Dependencies
1、下载CppUnit
https://sourceforge.net/projects/cppunit/files/cppunit/1.12.1/cppunit-1.12.1.tar.gz/
tar -zvxf cppunit-1.12.1.tar.gz
· cd cppunit-1.12.1
· ./configure LDFLAGS='-ldl'
· make
· sudo make install
· export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
// 测试代码 testApp.cpp
#include <iostream>
#include <cppunit/TestRunner.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
class Test : public CPPUNIT_NS::TestCase
{
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testHelloWorld);
CPPUNIT_TEST_SUITE_END();
public:
void setUp(void) {}
void tearDown(void) {}
protected:
void testHelloWorld(void) { std::cout << "Hello, world!" << std::endl; }
};
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
int main( int argc, char **argv )
{
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
// Add the top suite to the test runner
CPPUNIT_NS::TestRunner runner;
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
runner.run( controller );
return result.wasSuccessful() ? 0 : 1;
}
ldl,make:
g++ testApp .cpp -lcppunit -ldl -o testApp
Then run:
./ testApp
2、下载Valgrind
http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2
· tar -jxvf valgrind-3.12.0.tar.bz2
· cd valgrind-3.12.0
· ./configure
· make
· sudo make install
二、Building the Merkle Tree Library
· git clone https://github.com/IAIK/merkle-tree.git
· cd merkle-tree
· make
· All successful builds create a static library ‘libMerkleTree.a’ in the ‘src’ directory, for linking to other applications.
· cd tests
· export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
· ./merkle-tree-test