forked from thomasdullien/functionsimsearch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_dependencies.sh
executable file
·78 lines (61 loc) · 1.87 KB
/
build_dependencies.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
source_dir=$(pwd)
echo "WARNING: You will need GCC 7 or newer, GCC 6 does not implement C++17 yet!"
# Install gtest and gflags. It's a bit fidgety, but works:
sudo apt-get install -y wget cmake sudo libgtest-dev libgflags-dev libz-dev libelf-dev cmake g++ python3-pip
sudo apt-get install -y libboost-system-dev libboost-thread-dev libboost-date-time-dev
# Required for the training data generation python script.
pip3 install numpy absl-py
# Build the C++ libraries.
cd /usr/src/gtest
sudo cmake ./CMakeLists.txt
sudo make
sudo cp *.a /usr/lib
# Now get and the other dependencies
cd $source_dir
mkdir third_party
cd third_party
# Download Dyninst.
wget https://github.com/dyninst/dyninst/archive/v9.3.2.tar.gz
tar xvf ./v9.3.2.tar.gz
wget https://github.com/wwkenwong/functionsimsearch/raw/master/libdwarf-20130126.tar.gz
tar xvf ./libdwarf-20130126.tar.gz
mv ./dwarf-20130126/ ./libdwarf/
# Download PicoSHA, pe-parse, SPII and the C++ JSON library.
git clone https://github.com/okdshin/PicoSHA2.git
git clone https://github.com/wwkenwong/pe-parse.git
git clone https://github.com/PetterS/spii.git
mkdir json
mkdir json/src
cd json/src
wget https://github.com/nlohmann/json/releases/download/v3.1.2/json.hpp
cd ../..
cd ./libdwarf/libdwarf/
./configure
make
cd ../../
# Build PE-Parse.
cd pe-parse
sed -i -e 's/-Wno-strict-overflow/-Wno-strict-overflow -Wno-ignored-qualifiers/g' ./cmake/compilation_flags.cmake
cmake ./CMakeLists.txt
make -j
cd ..
# Build SPII.
cd spii
cmake ./CMakeLists.txt
make -j
sudo make install
cd ..
# Build Dyninst
cd dyninst-9.3.2
cmake ./CMakeLists.txt
# Need to limit parallelism because 8-core DynInst builds exhaust 30 Gigs of
# RAM on my test systems.
make -j 4
sudo make install
sudo ldconfig
cd ..
cp /code/functionsimsearch/third_party/pe-parse/pe-parser-library/libpe-parser-library.so /usr/lib
# Finally build functionsimsearch tools
cd ..
make -j