Commit 3219b8f3 authored by Dr. Michael Petter's avatar Dr. Michael Petter
Browse files

tested on Ubuntu 20.04 and updated make instructions

parent 2856c867
...@@ -149,7 +149,7 @@ add_llvm_executable(simple_interval_test ...@@ -149,7 +149,7 @@ add_llvm_executable(simple_interval_test
) )
target_link_libraries(simple_interval_test target_link_libraries(simple_interval_test
${LLVM_AVAILABLE_LIBS} PRIVATE ${LLVM_AVAILABLE_LIBS}
) )
add_llvm_executable(normalized_conjunction_test add_llvm_executable(normalized_conjunction_test
...@@ -162,7 +162,7 @@ add_llvm_executable(normalized_conjunction_test ...@@ -162,7 +162,7 @@ add_llvm_executable(normalized_conjunction_test
) )
target_link_libraries(normalized_conjunction_test target_link_libraries(normalized_conjunction_test
${LLVM_AVAILABLE_LIBS} PRIVATE ${LLVM_AVAILABLE_LIBS}
) )
add_llvm_executable(linear_subspace_test add_llvm_executable(linear_subspace_test
...@@ -175,7 +175,7 @@ add_llvm_executable(linear_subspace_test ...@@ -175,7 +175,7 @@ add_llvm_executable(linear_subspace_test
) )
target_link_libraries(linear_subspace_test target_link_libraries(linear_subspace_test
${LLVM_AVAILABLE_LIBS} PRIVATE ${LLVM_AVAILABLE_LIBS}
) )
add_llvm_executable(simple_matrix_test add_llvm_executable(simple_matrix_test
...@@ -185,7 +185,7 @@ add_llvm_executable(simple_matrix_test ...@@ -185,7 +185,7 @@ add_llvm_executable(simple_matrix_test
) )
target_link_libraries(simple_matrix_test target_link_libraries(simple_matrix_test
${LLVM_AVAILABLE_LIBS} PRIVATE ${LLVM_AVAILABLE_LIBS}
) )
add_llvm_executable(sparse_matrix_test add_llvm_executable(sparse_matrix_test
...@@ -195,7 +195,7 @@ add_llvm_executable(sparse_matrix_test ...@@ -195,7 +195,7 @@ add_llvm_executable(sparse_matrix_test
) )
target_link_libraries(sparse_matrix_test target_link_libraries(sparse_matrix_test
${LLVM_AVAILABLE_LIBS} PRIVATE ${LLVM_AVAILABLE_LIBS}
) )
enable_testing() enable_testing()
......
# Program Optimization Lab 2019 # Program Optimization Lab 202X
Implements an LLVM interprocedural analysis pass using abstract interpretation. Implementing an LLVM analysis framework based upon the Seidl Program Optimization Lecture.
## Build ## Build
Get the LLVM source code from [here](http://releases.llvm.org/download.html). Then get clang as well, into `llvm/tools`. Create a build directory somewhere, initialise CMake, and build. For example ### Build against a system-wide installed LLVM
Install the LLVM packages from your distro's package manager, e.g. Ubuntu 20.04:
# From your llvm-9.0.0-src, or whatever the version is now
wget http://releases.llvm.org/9.0.0/llvm-9.0.0.src.tar.xz # install the necessary LLVM packages
tar xf llvm-9.0.0.src.tar.xz sudo apt install cmake clang libclang-10-dev llvm-10-dev
# now continue by building the project
git clone https://versioncontrolseidl.in.tum.de/petter/llvm-abstractinterpretation.git
cd llvm-abstractinterpretation
git checkout origin/equalities
mkdir build
cd build
cmake -G "Unix Makefiles" -DPATH_TO_LLVM=/usr/lib/llvm-10 ..
make
You can do this, however the precompiled LLVM binaries come without symbol names, thus debugging
might be a little harder this way. Alterntively consider the following route:
### Build against custom downloaded LLVM Sources
Get the LLVM source code from [here](https://releases.llvm.org/download.html). Then get clang as well, into `llvm/tools`. Create a build directory somewhere, initialise CMake, and build. For example
# From llvm-10.0.0-src, or whatever the version is now
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/llvm-10.0.0.src.tar.xz
tar xf llvm-10.0.0.src.tar.xz
# now also download clang # now also download clang
cd llvm-9.0.0.src/tools cd llvm-10.0.0.src/tools
wget http://releases.llvm.org/9.0.0/cfe-9.0.0.src.tar.xz wget https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang-10.0.0.src.tar.xz
tar xf cfe-9.0.0.src.tar.xz tar xf clang-10.0.0.src.tar.xz
mv cfe-9.0.0.src clang mv clang-10.0.0.src clang
cd ../.. cd ../..
# now continue by building LLVM # now continue by building LLVM
mkdir llvm_build mkdir llvm_build
cd llvm_build cd llvm_build
cmake ../llvm-?.?.?-src -DLLVM_TARGETS_TO_BUILD=X86 # important: Don't forget to restrict to X86, otherwise prepare for a day of compiling
make -j2 cmake ../llvm-10.0.0-src -DLLVM_TARGETS_TO_BUILD=X86
make -j4
On a 4 core i7-8550U this may take up to 3h.
The parallel make may run out of memory at the end. You can restart it sequentially by issuing another `make -j1`. The parallel make may run out of memory at the end. You can restart it sequentially by issuing another `make -j1`.
Now we can initalise the repository.
cd ..
git clone ssh://git@github.com/PUT/THE/CORRECT/REPOSITORY/IN/HERE.git
cd PUT/THE/CORRECT/REPOSITORY/IN/HERE
python3 init.py
The script should be able to find your LLVM and clang. If it is not, you need to specify them by hand.
At last, let us compile and run the samples.
python3 run.py --make
If there are errors regarding missing header files, you probably need to rebuild llvm. If there are errors regarding missing header files, you probably need to rebuild llvm.
## Useful things ## Author during Bachelor Thesis 2019/20
The `run.py` script contains everything, up to and including the kitchen sink. It can run the samples, build, run the debugger, as well as build and run the tests. Just read its help message to get all the good stuff. I want to highlight the `-n` option, which causes it to just print out the commands it would run. This is great to just copy-paste the relevant ones into your terminal (or IDE). * Tim Gymnich
## Authors Lab Course WS 2019/20 ## Authors Lab Course WS 2019/20
......
Supports Markdown
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