-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathREADME.linux
110 lines (89 loc) · 3.42 KB
/
README.linux
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Building staticly for linux.
============================
The following explains how to build statically on Ubuntu
17.10. Totally static builds are no longer supported on Linux because
pthread does not work. So we need to make sure that everything is
compiled statically, but we will still have a dependency on glibc and
pthread.
A complete discussion of the issue cam be found here
http://insanecoding.blogspot.com/2012/07/creating-portable-linux-binaries.html
At the end we should have a binary which is mostly static:
⟫ ldd ./aff4imager
linux-vdso.so.1 => (0x00007ffef1bee000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6b64840000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6b64460000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6b64ec7000)
# It is best to maintain a special prefix with static libraries so
# they do not pollute the system. Since static libraries are not
# shipped any more, we need to build all dependencies from
# source. This only needs to be done once as we keep linking this
# directory in future.
export PREFIX=/home/scudette/build/static/
export CXXFLAGS="-I$PREFIX/include"
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig/"
apt-get install libtool-bin libboost-dev
apt-get source uuid-dev
cd util-linux-2.30.1
./configure --prefix=$PREFIX --enable-static LDFLAGS="-L$PREFIX/lib -static -static-libstdc++ -static-libgcc" \
--enable-libuuid --disable-all-programs --disable-python --disable-bash-completion
make install -j4
cd..
apt-get source zlib1g
cd zlib-1.2.11.dfsg/
./configure --prefix=$PREFIX --static
make install
cd ..
apt-get source libraptor2-dev
cd raptor2-2.0.13/
./configure --prefix=$PREFIX --enable-static --without-www LDFLAGS="-L$PREFIX/lib -static -static-libstdc++" --enable-serializers="turtle ntriples" --enable-parsers="turtle ntriples"
make -j4 install
cd ..
apt-get source libpcre3
cd pcre3-8.39/
./configure --prefix=$PREFIX --enable-static LDFLAGS="-L$PREFIX/lib -static -static-libstdc++"
make -j4 install
cd ..
apt-get source libpcre++-dev
cd libpcre++-0.9.5/
./autogen.sh
cp /usr/bin/libtool ./libtool
./configure --prefix=$PREFIX --enable-static LDFLAGS="-L$PREFIX/lib -static -static-libstdc++"
make -j4 install
cd ..
apt-get source libyaml-cpp-dev
cd yaml-cpp-0.5.2/
cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX . && make all install
cd ..
apt-get source libsnappy-dev
cd snappy-1.1.6/
./autogen.sh
./configure --prefix=$PREFIX --enable-static --without-gflags LDFLAGS="-L$PREFIX/lib -static -static-libstdc++"
make -j4 install
cd ..
apt-get source liburiparser-dev
cd uriparser-0.8.4/
./configure --prefix=$PREFIX --enable-static --without-gflags LDFLAGS="-L$PREFIX/lib -static -static-libstdc++" --disable-test --disable-doc
make -j4 install
cd ..
apt-get source libspdlog-dev
cd spdlog-0.11.0/
cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX . && make all install
cd ..
export LZ4_VERSION=1.8.3
curl -L https://github.com/lz4/lz4/archive/v${LZ4_VERSION}.tar.gz -o lz4-${LZ4_VERSION}.tar.gz
tar xvzf lz4-${LZ4_VERSION}.tar.gz
cd lz4-${LZ4_VERSION}/lib
make -j4 install
cd ..
git clone https://github.com/Velocidex/aff4.git
cd aff4
./autogen.sh
./configure --prefix=$PREFIX --enable-static LDFLAGS="-L$PREFIX/lib -L$PREFIX/libexec" --enable-static-binaries
make -j4 install
cd ..
Building the unit tests.
========================
git clone https://github.com/google/googletest.git
cd googletest/
cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DBUILD_SHARED_LIBS=ON . && make all install
cd ..