From 48c9bbf18f649e6dbe6c05dbfcc65eca1383978b Mon Sep 17 00:00:00 2001 From: Tanmay Tirpankar Date: Mon, 22 Mar 2021 20:08:35 -0600 Subject: [PATCH 1/2] Fixed stubs.c and patch file path with corrected command. --- Gklee/runtime/POSIX/stubs.c | 2 ++ cmake/modules/SetupExterns.cmake | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Gklee/runtime/POSIX/stubs.c b/Gklee/runtime/POSIX/stubs.c index 1de35ed..f9152ad 100755 --- a/Gklee/runtime/POSIX/stubs.c +++ b/Gklee/runtime/POSIX/stubs.c @@ -240,6 +240,7 @@ int strverscmp (__const char *__s1, __const char *__s2) { return strcmp(__s1, __s2); /* XXX no doubt this is bad */ } +/* unsigned int gnu_dev_major(unsigned long long int __dev) __attribute__((weak)); unsigned int gnu_dev_major(unsigned long long int __dev) { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); @@ -256,6 +257,7 @@ unsigned long long int gnu_dev_makedev(unsigned int __major, unsigned int __mino | (((unsigned long long int) (__minor & ~0xff)) << 12) | (((unsigned long long int) (__major & ~0xfff)) << 32)); } +*/ char *canonicalize_file_name (const char *name) __attribute__((weak)); char *canonicalize_file_name (const char *name) { diff --git a/cmake/modules/SetupExterns.cmake b/cmake/modules/SetupExterns.cmake index 1e1e362..733015d 100644 --- a/cmake/modules/SetupExterns.cmake +++ b/cmake/modules/SetupExterns.cmake @@ -8,8 +8,8 @@ find_program(PATCH patch) find_program(BASH bash) set( - PCMD - cd ${LLVM_SRC}/src/LLVM/tools && if [ ! -e clang ]$ then ${DOWNLOAD} http://www.llvm.org/releases/3.2/clang-3.2.src.tar.gz && ${EXTRACT} -zxf clang-3.2.src.tar.gz && mv -f clang-3.2.src clang && rm clang-3.2.src.tar.gz && cd clang && cp ${CMAKE_SOURCE_DIR}/patch/clang.patch ./ && ${PATCH} -p1 -N < clang.patch$ fi && cd ${LLVM_SRC}/src/LLVM/projects && if [ ! -e compiler-rt ]$ then ${DOWNLOAD} http://www.llvm.org/releases/3.2/compiler-rt-3.2.src.tar.gz && ${EXTRACT} -zxf compiler-rt-3.2.src.tar.gz && mv compiler-rt-3.2.src compiler-rt && rm compiler-rt-3.2.src.tar.gz && cd compiler-rt/lib/asan && cp ${LLVM_SRC}/patch/compiler-rt_lib_asan.patch . && ${PATCH} -p1 -N compiler-rt_lib_asan.patch$ fi + PCMD + cd ${LLVM_SRC}/src/LLVM/tools && if [ ! -e clang ]$ then ${DOWNLOAD} http://www.llvm.org/releases/3.2/clang-3.2.src.tar.gz && ${EXTRACT} -zxf clang-3.2.src.tar.gz && mv -f clang-3.2.src clang && rm clang-3.2.src.tar.gz && cd clang && cp ${CMAKE_SOURCE_DIR}/patch/clang.patch ./ && ${PATCH} -p1 -N < clang.patch$ fi && cd ${LLVM_SRC}/src/LLVM/projects && if [ ! -e compiler-rt ]$ then ${DOWNLOAD} http://www.llvm.org/releases/3.2/compiler-rt-3.2.src.tar.gz && ${EXTRACT} -zxf compiler-rt-3.2.src.tar.gz && mv compiler-rt-3.2.src compiler-rt && rm compiler-rt-3.2.src.tar.gz && cd compiler-rt/lib/asan && cp ${LLVM_SRC}/../patch/compiler-rt_lib_asan_linux.patch . && ${PATCH} -p0 -N < compiler-rt_lib_asan_linux.patch$ fi ) string(REPLACE ";" " " PCMD "${PCMD}") ExternalProject_add( @@ -18,8 +18,8 @@ ExternalProject_add( URL http://www.llvm.org/releases/3.2/llvm-3.2.src.tar.gz URL_MD5 71610289bbc819e3e15fdd562809a2d7 PATCH_COMMAND ${BASH} -c ${PCMD} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${GLIBCXX} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${GLIBCXX} -std=c++11 -DCMAKE_EXPORT_COMPILE_COMMANDS=${CMAKE_EXPORT_COMPILE_COMMANDS} -DLLVM_TARGETS_TO_BUILD=X86 ) From 50833ed2d9dd79c9de57513d96c253d7408375cd Mon Sep 17 00:00:00 2001 From: Tanmay Tirpankar Date: Mon, 22 Mar 2021 22:58:21 -0600 Subject: [PATCH 2/2] Created Dockerfile for building docker image --- Dockerfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8d9a8ed --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM ubuntu:18.04 + +MAINTAINER Tanmay + +# Setting Environment variables. +ENV KLEE_HOME_DIR=/home/Gklee +ENV PATH=$KLEE_HOME_DIR/bin:$PATH + +# Updating apt-get distro +RUN apt-get update + +# Installing all dependencies using apt-get +RUN apt-get install -y gcc-4.8 g++-4.8 cmake git wget python vim doxygen zlib1g zlib1g-dev bison flex build-essential + +# Switching alternatives to gcc and g++ to 4.8 +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10 +RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10 + +# Cloning the repository +RUN cd /home && git clone https://github.com/tanmaytirpankar/Gklee.git + +# Fixing gklee-nvcc to use the correct gcc toolchain +RUN cd /home/Gklee && sed -i "s|-Xclang -fgpu-device|-Xclang -fgpu-device -gcc-toolchain /usr/include/c++/4.8.5|g" bin/gklee-nvcc + +# Changing build mode to Release +RUN cd /home/Gklee && sed -i "s|CMAKE_BUILD_TYPE RelWithDebInfo|CMAKE_BUILD_TYPE Release|g" CMakeLists.txt + +# Building +RUN cd /home/Gklee && mkdir build && cd build && cmake .. && make