Commit b6af7c84 authored by Alastair Robertson's avatar Alastair Robertson

Dockerise build

parent b07c7d05
......@@ -36,22 +36,28 @@ The following builtin functions are also available:
# Building
## Requirements
The latest versions of BCC and Google Test will be downloaded on the first build. To update them later, the commands `make bcc-update` and `make gtest-update` can be run.
## Using Docker
`./build.sh`
## Standard build process
### Requirements
- A C++ compiler
- CMake
- Flex
- Bison
- LLVM
- LLVM development packages
## Compilation
### Compilation
Compile using CMake, optionally substituting "Release" for "Debug" as CMAKE\_BUILD\_TYPE:
```
git clone https://github.com/ajor/bpftrace
cd bpftrace
mkdir build
cd build
mkdir -p bpftrace/build
cd bpftrace/build
cmake -DCMAKE_BUILD_TYPE=Debug ../
make
```
The latest versions of BCC and Google Test will be downloaded on the first build. To update them later, the commands `make bcc-update` and `make gtest-update` can be run.
#!/bin/sh
pushd docker
docker build -t bpftrace-builder -f Dockerfile.ubuntu .
popd
docker run --rm -u $(id -u):$(id -g) -v $(pwd):/bpftrace bpftrace-builder
FROM ubuntu
RUN apt-get update && apt-get install -y \
bison \
cmake \
flex \
g++ \
git \
libelf-dev \
llvm-dev \
zlib1g-dev
# Fix Ubuntu LLVM CMake bug (https://github.com/iovisor/bcc/issues/492)
RUN apt-get install -y llvm-3.8-dev libclang-3.8-dev && \
mkdir -p /usr/lib/llvm-3.8/share/llvm && \
ln -s /usr/share/llvm-3.8/cmake /usr/lib/llvm-3.8/share/llvm/cmake && \
sed -i -e '/get_filename_component(LLVM_INSTALL_PREFIX/ {s|^|#|}' -e '/^# Compute the installation prefix/i set(LLVM_INSTALL_PREFIX "/usr/lib/llvm-3.8")' /usr/lib/llvm-3.8/share/llvm/cmake/LLVMConfig.cmake && \
sed -i '/_IMPORT_CHECK_TARGETS Polly/ {s|^|#|}' /usr/lib/llvm-3.8/share/llvm/cmake/LLVMExports-relwithdebinfo.cmake && \
sed -i '/_IMPORT_CHECK_TARGETS sancov/ {s|^|#|}' /usr/lib/llvm-3.8/share/llvm/cmake/LLVMExports-relwithdebinfo.cmake && \
ln -s /usr/lib/x86_64-linux-gnu/libLLVM-3.8.so.1 /usr/lib/llvm-3.8/lib/
COPY build.sh /build.sh
ENTRYPOINT ["bash", "/build.sh"]
set -e
cd /bpftrace
mkdir -p build-docker
cd build-docker
cmake -DCMAKE_BUILD_TYPE=Debug ../
make
......@@ -236,7 +236,7 @@ int CodegenLLVM::compile()
}
TargetOptions opt;
auto RM = Optional<Reloc::Model>();
auto RM = Reloc::Model();
TargetMachine *targetMachine = target->createTargetMachine(targetTriple, "generic", "", opt, RM);
module_->setDataLayout(targetMachine->createDataLayout());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment