Skip to content
Moloch edited this page Mar 3, 2015 · 5 revisions

Untwister on OSX

Prerequisites

Compiling Untwister

First grab the latest code from github:

git@github.com:altf4/untwister.git

Untwister is built from the command line, you can import the project into Xcode if you want but it's not required. Open the Terminal app and cd into the Untwister repo, and simply run a make command:

➜  untwister git:(master) make
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/GlibcRand.d" -MT"prngs/GlibcRand.d" -o "prngs/GlibcRand.o" "./prngs/GlibcRand.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/Mt19937.d" -MT"prngs/Mt19937.d" -o "prngs/Mt19937.o" "./prngs/Mt19937.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/Ruby.d" -MT"prngs/Ruby.d" -o "prngs/Ruby.o" "./prngs/Ruby.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/LSBState.d" -MT"prngs/LSBState.d" -o "prngs/LSBState.o" "./prngs/LSBState.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/PRNGFactory.d" -MT"prngs/PRNGFactory.d" -o "prngs/PRNGFactory.o" "./prngs/PRNGFactory.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -pthread -MF"main.d" -MT"main.d" -o "main.o" "./main.cpp"
g++ -std=gnu++11 -O3 -pthread ./prngs/LSBState.o ./prngs/GlibcRand.o ./prngs/Mt19937.o ./prngs/Ruby.o ./prngs/PRNGFactory.o ./Untwister.o main.o -o untwister
clang: warning: argument unused during compilation: '-pthread'

You should now have a functional binary, for help see:

./untwister -h

Python Bindings

  • To build the Python bindings first install the Boost Python library using the command brew install boost-python
  • Next simply run make python

Compiling the Unit Tests

Unit tests are only for developers and not required for using Untwister, but they may be useful if you want to ensure everything is running as expected on your system.

  • First install CPPUnit with the command brew install cppunit
  • Next simply run a make tests
➜  untwister git:(master) make tests
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/GlibcRand.d" -MT"prngs/GlibcRand.d" -o "prngs/GlibcRand.o" "./prngs/GlibcRand.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/Mt19937.d" -MT"prngs/Mt19937.d" -o "prngs/Mt19937.o" "./prngs/Mt19937.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/Ruby.d" -MT"prngs/Ruby.d" -o "prngs/Ruby.o" "./prngs/Ruby.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/LSBState.d" -MT"prngs/LSBState.d" -o "prngs/LSBState.o" "./prngs/LSBState.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"prngs/PRNGFactory.d" -MT"prngs/PRNGFactory.d" -o "prngs/PRNGFactory.o" "./prngs/PRNGFactory.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"./tests/TestRuby.d" -MT"./tests/TestRuby.d" -o "./tests/TestRuby.o" "./tests/TestRuby.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"./tests/TestMt19937.d" -MT"./tests/TestMt19937.d" -o "./tests/TestMt19937.o" "./tests/TestMt19937.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"./tests/TestPRNGFactory.d" -MT"./tests/TestPRNGFactory.d" -o "./tests/TestPRNGFactory.o" "./tests/TestPRNGFactory.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"./tests/TestUntwister.d" -MT"./tests/TestUntwister.d" -o "./tests/TestUntwister.o" "./tests/TestUntwister.cpp"
g++ -std=gnu++11 -O3 -g3 -Wall -c -fmessage-length=0 -MMD -fPIC -MF"./tests/runner.d" -MT"./tests/runner.d" -o "./tests/runner.o" "./tests/runner.cpp"
g++ -std=gnu++11 -O3 -pthread ./prngs/LSBState.o ./prngs/GlibcRand.o ./prngs/Mt19937.o ./prngs/Ruby.o ./prngs/PRNGFactory.o ./Untwister.o ./tests/runner.o ./tests/TestRuby.o ./tests/TestMt19937.o ./tests/TestPRNGFactory.o ./tests/TestUntwister.o -o untwister_tests -lcppunit
clang: warning: argument unused during compilation: '-pthread'

You should now have a untwister_tests binary, simply execute this file to run the unit tests:

➜  untwister git:(master) ./untwister_tests 
[*] Executing all unit tests, please wait....................


OK (17 tests)