diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1813a8ef4a..2ce3cc004b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -31,6 +31,8 @@ env: SQLITE_VERSION: 3400100 BITWUZLA_VERSION: main BITWUZLA_COMMIT: 80ef7cd803e1c71b5939c3eb951f1736388f7090 + JSON_VERSION: v3.11.3 + OPTIONAL_VERSION: v3.5.0 jobs: Linux: diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index d21b6002fc..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "json"] - path = json - url = https://github.com/nlohmann/json.git -[submodule "optional"] - path = optional - url = https://github.com/martinmoene/optional-lite.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ce961bad5..9fdcf66504 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -678,8 +678,8 @@ configure_file(${CMAKE_SOURCE_DIR}/include/klee/Config/CompileTimeInfo.h.cmin ################################################################################ include_directories("${CMAKE_BINARY_DIR}/include") include_directories("${CMAKE_SOURCE_DIR}/include") -include_directories("${CMAKE_SOURCE_DIR}/json/include") -include_directories("${CMAKE_SOURCE_DIR}/optional/include") +include_directories("${OPTIONAL_SRC_DIR}/include") +include_directories("${JSON_SRC_DIR}/include") # set(KLEE_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include) ################################################################################ diff --git a/Dockerfile b/Dockerfile index d345ff5c63..ffa874e484 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,8 @@ ENV Z3_VERSION=4.8.15 ENV USE_LIBCXX=1 ENV KLEE_RUNTIME_BUILD="Debug+Asserts" ENV SQLITE_VERSION=3400100 +ENV JSON_VERSION=v3.11.3 +ENV OPTIONAL_VERSION=v3.5.0 LABEL maintainer="KLEE Developers" # TODO remove adding sudo package diff --git a/build.sh b/build.sh index 24f537596b..5be34884e4 100755 --- a/build.sh +++ b/build.sh @@ -40,6 +40,12 @@ SOLVERS=BITWUZLA:Z3:STP ## Google Test Required options GTEST_VERSION=1.11.0 +## json options +JSON_VERSION=v3.11.3 + +## optional options +OPTIONAL_VERSION=v3.5.0 + ## UClibC Required options UCLIBC_VERSION=klee_uclibc_v1.3 # LLVM_VERSION is also required for UClibC @@ -53,4 +59,4 @@ MINISAT_VERSION=master BITWUZLA_VERSION=main BITWUZLA_COMMIT=80ef7cd803e1c71b5939c3eb951f1736388f7090 -BASE="$BASE" KLEE_RUNTIME_BUILD=$KLEE_RUNTIME_BUILD COVERAGE=$COVERAGE ENABLE_DOXYGEN=$ENABLE_DOXYGEN USE_TCMALLOC=$USE_TCMALLOC USE_LIBCXX=$USE_LIBCXX LLVM_VERSION=$LLVM_VERSION ENABLE_OPTIMIZED=$ENABLE_OPTIMIZED ENABLE_DEBUG=$ENABLE_DEBUG DISABLE_ASSERTIONS=$DISABLE_ASSERTIONS REQUIRES_RTTI=$REQUIRES_RTTI SOLVERS=$SOLVERS GTEST_VERSION=$GTEST_VERSION UCLIBC_VERSION=$UCLIBC_VERSION STP_VERSION=$STP_VERSION MINISAT_VERSION=$MINISAT_VERSION Z3_VERSION=$Z3_VERSION BITWUZLA_VERSION=$BITWUZLA_VERSION BITWUZLA_COMMIT=$BITWUZLA_COMMIT SQLITE_VERSION=$SQLITE_VERSION ./scripts/build/build.sh klee --install-system-deps +BASE="$BASE" KLEE_RUNTIME_BUILD=$KLEE_RUNTIME_BUILD COVERAGE=$COVERAGE ENABLE_DOXYGEN=$ENABLE_DOXYGEN USE_TCMALLOC=$USE_TCMALLOC USE_LIBCXX=$USE_LIBCXX LLVM_VERSION=$LLVM_VERSION ENABLE_OPTIMIZED=$ENABLE_OPTIMIZED ENABLE_DEBUG=$ENABLE_DEBUG DISABLE_ASSERTIONS=$DISABLE_ASSERTIONS REQUIRES_RTTI=$REQUIRES_RTTI SOLVERS=$SOLVERS GTEST_VERSION=$GTEST_VERSION UCLIBC_VERSION=$UCLIBC_VERSION STP_VERSION=$STP_VERSION MINISAT_VERSION=$MINISAT_VERSION Z3_VERSION=$Z3_VERSION BITWUZLA_VERSION=$BITWUZLA_VERSION BITWUZLA_COMMIT=$BITWUZLA_COMMIT SQLITE_VERSION=$SQLITE_VERSION JSON_VERSION=$JSON_VERSION OPTIONAL_VERSION=$OPTIONAL_VERSION ./scripts/build/build.sh klee --install-system-deps diff --git a/json b/json deleted file mode 160000 index 6af826d0bd..0000000000 --- a/json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6af826d0bdb55e4b69e3ad817576745335f243ca diff --git a/optional b/optional deleted file mode 160000 index 0723abd03b..0000000000 --- a/optional +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0723abd03b25fb11997fcb6cff6471408fc33072 diff --git a/scripts/build/p-json-linux-ubuntu.inc b/scripts/build/p-json-linux-ubuntu.inc new file mode 100644 index 0000000000..37538f86a1 --- /dev/null +++ b/scripts/build/p-json-linux-ubuntu.inc @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +install_build_dependencies_json() { + source "${DIR}/common-functions" + with_sudo apt update -y + + dependencies=( + ca-certificates + wget + unzip + git + ) + + #Install essential dependencies + with_sudo apt -y --no-install-recommends install "${dependencies[@]}" +} diff --git a/scripts/build/p-json-osx.inc b/scripts/build/p-json-osx.inc new file mode 100644 index 0000000000..4ca06662d8 --- /dev/null +++ b/scripts/build/p-json-osx.inc @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +install_build_dependencies_json() { + # Install essential dependency + # Ignore if already installed + brew install wget || /usr/bin/true +} diff --git a/scripts/build/p-json.inc b/scripts/build/p-json.inc new file mode 100644 index 0000000000..66a1ee6f54 --- /dev/null +++ b/scripts/build/p-json.inc @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +setup_build_variables_json() { + JSON_INSTALL_PATH="${BASE}/json-${JSON_VERSION}" + json_url="https://github.com/nlohmann/json.git" + return 0 +} + +download_json() { + source "${DIR}/common-functions" + # Download json + git_clone_or_update "${json_url}" "${JSON_INSTALL_PATH}" "${JSON_VERSION}" + touch "${JSON_INSTALL_PATH}"/.is_installed +} + +build_json() { + return 0 +} + +install_json() { + return 0 +} + +is_installed_json() { + ( + setup_build_variables_json + [[ -f "${JSON_INSTALL_PATH}"/.is_installed ]] + ) || return 1 +} + +get_build_artifacts_json() { + ( + setup_build_variables_json + echo "${JSON_INSTALL_PATH}" + ) +} + +setup_artifact_variables_json() { + setup_build_variables_json +} + +get_docker_config_id_json() { + ( + setup_build_variables_json + echo "${JSON_VERSION}" + ) +} diff --git a/scripts/build/p-klee.inc b/scripts/build/p-klee.inc index b484cc9281..dd8ba17aff 100644 --- a/scripts/build/p-klee.inc +++ b/scripts/build/p-klee.inc @@ -19,6 +19,8 @@ build_klee() { local CMAKE_ARGUMENTS=( "-DLLVM_DIR=${LLVM_INSTALL}" "-DGTEST_SRC_DIR=${GTEST_INSTALL_PATH}" + "-DJSON_SRC_DIR=${JSON_INSTALL_PATH}" + "-DOPTIONAL_SRC_DIR=${OPTIONAL_INSTALL_PATH}" "-DENABLE_UNIT_TESTS=TRUE" "-DENABLE_SYSTEM_TESTS=TRUE" "-DENABLE_DOXYGEN=${ENABLE_DOXYGEN}" @@ -254,4 +256,4 @@ is_installed_klee() { setup_artifact_variables_klee() { setup_build_variables_klee -} \ No newline at end of file +} diff --git a/scripts/build/p-optional-linux-ubuntu.inc b/scripts/build/p-optional-linux-ubuntu.inc new file mode 100644 index 0000000000..802e1cfac9 --- /dev/null +++ b/scripts/build/p-optional-linux-ubuntu.inc @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +install_build_dependencies_optional() { + source "${DIR}/common-functions" + with_sudo apt update -y + + dependencies=( + ca-certificates + wget + unzip + git + ) + + #Install essential dependencies + with_sudo apt -y --no-install-recommends install "${dependencies[@]}" +} diff --git a/scripts/build/p-optional-osx.inc b/scripts/build/p-optional-osx.inc new file mode 100644 index 0000000000..3031bab898 --- /dev/null +++ b/scripts/build/p-optional-osx.inc @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +install_build_dependencies_optional() { + # Install essential dependency + # Ignore if already installed + brew install wget || /usr/bin/true +} diff --git a/scripts/build/p-optional.inc b/scripts/build/p-optional.inc new file mode 100644 index 0000000000..37b66d1744 --- /dev/null +++ b/scripts/build/p-optional.inc @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +setup_build_variables_optional() { + OPTIONAL_INSTALL_PATH="${BASE}/optional-${OPTIONAL_VERSION}" + optional_url="https://github.com/martinmoene/optional-lite.git" + return 0 +} + +download_optional() { + source "${DIR}/common-functions" + # Download optional + git_clone_or_update "${optional_url}" "${OPTIONAL_INSTALL_PATH}" "${OPTIONAL_VERSION}" + touch "${OPTIONAL_INSTALL_PATH}"/.is_installed +} + +build_optional() { + return 0 +} + +install_optional() { + return 0 +} + +is_installed_optional() { + ( + setup_build_variables_optional + [[ -f "${OPTIONAL_INSTALL_PATH}"/.is_installed ]] + ) || return 1 +} + +get_build_artifacts_optional() { + ( + setup_build_variables_optional + echo "${OPTIONAL_INSTALL_PATH}" + ) +} + +setup_artifact_variables_optional() { + setup_build_variables_optional +} + +get_docker_config_id_optional() { + ( + setup_build_variables_optional + echo "${OPTIONAL_VERSION}" + ) +} diff --git a/scripts/build/v-json.inc b/scripts/build/v-json.inc new file mode 100644 index 0000000000..46335d4c62 --- /dev/null +++ b/scripts/build/v-json.inc @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# shellcheck disable=SC2034 + +# Build information for json +required_variables_json=( + "JSON_VERSION" +) + +# Artifacts json depends on +artifact_dependency_json=("") diff --git a/scripts/build/v-klee.inc b/scripts/build/v-klee.inc index 4b0f1085f1..df0f3b0263 100644 --- a/scripts/build/v-klee.inc +++ b/scripts/build/v-klee.inc @@ -16,7 +16,7 @@ required_variables_check_klee() { # On which artifacts does KLEE depend on artifact_dependency_klee(){ - local dependencies=("llvm" "solvers" "gtest" "sqlite" "cmake") + local dependencies=("llvm" "solvers" "gtest" "sqlite" "cmake" "json" "optional") if [[ "${OS}" != "osx" ]]; then dependencies+=(uclibc) fi @@ -34,7 +34,7 @@ runtime_artifact_dependency_klee(){ if [[ "${OS}" != "osx" ]]; then echo "uclibc" fi - dependencies+=("llvm" "solvers" "gtest" "sqlite") + dependencies+=("llvm" "solvers" "gtest" "sqlite" "json" "optional") [[ "${USE_TCMALLOC:-}" -eq 1 ]] && dependencies+=("tcmalloc") [[ "${USE_LIBCXX:-}" -eq 1 ]] && dependencies+=("libcxx") diff --git a/scripts/build/v-optional.inc b/scripts/build/v-optional.inc new file mode 100644 index 0000000000..dbf9f79ef7 --- /dev/null +++ b/scripts/build/v-optional.inc @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# shellcheck disable=SC2034 + +# Build information for optional +required_variables_optional=( + "OPTIONAL_VERSION" +) + +# Artifacts optional depends on +artifact_dependency_optional=("")