Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
112 lines (89 sloc) 3.45 KB
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 ..
git clone https://github.com/google/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 ..
# To build linpmem
git clone https://github.com/google/rekall.git
cd rekall/tools/pmem
./bootstrap
./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 ..
You can’t perform that action at this time.