DynamoRIO安装
git clone https://github.com/DynamoRIO/dynamorio.git
可用的git版本 ad03a4ac7517b8cc3f21a2aa6e68b1a52cae74e4
,新版本的接口有一些不太一致,如果不需要接口兼容的话使用最新版就可以,我这里是需要旧版本的,所以进行了回溯(
git reset --hard ad03a4ac7517b8cc3f21a2aa6e68b1a52cae74e4
)
安装教程github首页找不到,其实在wiki里后几页(现在好像又搬地方了,最近dynamorio的文档有人在一直更新,不过我这里的备份也还是可用的)
https://github.com/DynamoRIO/dynamorio/wiki/How-To-Build
dynamorio对cmake有版本要求,要求3.7版本以上的,我用ubuntu的apt安装的cmake版本比较低,所以只能自己去安装了。我使用的版本为3.7.2。(cmake-3.7.2-Linux-x86_64.sh)
参考:https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line
附上cmake的安装方案之一(可选)
$ sudo mkdir /opt/cmake
$ sudo sh cmake-3.7.2-Linux-x86_64.sh --prefix=/opt/cmake
# 确认文件存在后再链接
$ sudo ln -s /opt/cmake/cmake-3.7.2-Linux-x86_64/bin/cmake /usr/local/bin/cmake
$ cmake -version
cmake version 3.7.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
dynamorio安装
# Install dependencies for Ubuntu 15+. Adjust this command as appropriate for
# other distributions (in particular, use "cmake3" for Ubuntu Trusty).
$ sudo apt-get install cmake g++ g++-multilib doxygen git zlib1g-dev
# Get sources.
$ git clone https://github.com/DynamoRIO/dynamorio.git
下面是我加的一行命令,回溯版本,也可以不回溯
$ # git reset --hard ad03a4ac7517b8cc3f21a2aa6e68b1a52cae74e4
# Make a separate build directory. Building in the source directory is not
# supported.
$ cd dynamorio && mkdir build && cd build
# Generate makefiles with CMake. Pass in the path to your source directory.
$ cmake ..
# Build.
$ make -j
# Run echo under DR to see if it works. If you configured for a debug or 32-bit
# build, your path will be different. For example, a 32-bit debug build would
# put drrun in ./bin32/ and need -debug flag to run debug build.
$ ./bin64/drrun echo hello world
hello world
DynamoRIO我也是用gcc-7编译的,一开始用gcc 4.8.5就出问题了,原因是gcc 4.8.5编译的时候应该默认没有c++11?