forked from googleprojectzero/functionsimsearch
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build_dependencies.sh
executable file
·67 lines (56 loc) · 1.91 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
#!/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
# Download PicoSHA, pe-parse, SPII and the C++ JSON library.
git clone https://github.com/okdshin/PicoSHA2.git
git clone https://github.com/trailofbits/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 ../..
# Build PE-Parse.
cd pe-parse
git checkout fece2ae3de1624ddb4001dca753c8a3e9898c0f8
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 ..
# Replace the broken old link to libdwarf with an alternative
# Build Dyninst
cd dyninst-9.3.2
sed -i 's#http://www\.paradyn\.org/libdwarf/libdwarf-20130126\.tar\.gz#https://src\.fedoraproject\.org/repo/pkgs/libdwarf/libdwarf-20130126\.tar\.gz/ded74a5e90edb5a12aac3c29d260c5db/libdwarf-20130126\.tar\.gz#g' cmake/packages.cmake
cmake ./CMakeLists.txt
# Need to limit parallelism because 8-core DynInst builds exhaust 30 Gigs of
# RAM on my test systems.
make -j 16
sudo make install
sudo ldconfig
cd ..
# Finally build functionsimsearch tools
cd ..
make -j