From 384d3e75fae69cca9776e06a70c5081970c58d27 Mon Sep 17 00:00:00 2001 From: jeaye Date: Thu, 11 Jan 2024 14:43:02 -0800 Subject: [PATCH] Fix compilation issues with cling --- README.md | 38 ++++++++++++++++++++++---------------- bin/build-cling | 8 ++++++-- bin/configure | 4 ++-- vcpkg.json | 1 - 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index d4282b424..eacb7d571 100644 --- a/README.md +++ b/README.md @@ -23,22 +23,28 @@ There are pre-compiled binaries for Ubuntu 22.04, which are built to follow the For Debian-based distros, this should be all you need: ```bash -$ sudo apt-get install -y curl git zip build-essential entr libssl-dev libdouble-conversion-dev pkg-config ninja-build python3-pip cmake debhelper devscripts gnupg zlib1g-dev +sudo apt-get install -y curl git zip build-essential entr libssl-dev libdouble-conversion-dev pkg-config ninja-build python3-pip cmake debhelper devscripts gnupg zlib1g-dev entr +``` + +For Arch: + +```bash +sudo pacman -S clang pkg-config cmake ninja make python3 libffi jemalloc entr ``` For macOS, try this: ```bash -$ brew install curl git zip entr openssl double-conversion pkg-config ninja python cmake gnupg zlib +brew install curl git zip entr openssl double-conversion pkg-config ninja python cmake gnupg zlib ``` Clone the repo as follows: ```bash -$ git clone --recurse-submodules https://github.com/jank-lang/jank.git +git clone --recurse-submodules https://github.com/jank-lang/jank.git # If you didn't recurse submodules when cloning, you'll need to run this. -$ git submodule update --recursive --init +git submodule update --recursive --init ``` ### Compiling Cling @@ -46,11 +52,11 @@ Note that you must compile Cling/Clang/LLVM. This can take an hour or two, depending on your machine. Building jank itself should take less than a minute. ``` -$ mkdir -p build -$ cd build -$ ../bin/build-cling -$ cd - -$ export CC=$PWD/build/cling-build/bin/clang; export CXX=$PWD/build/cling-build/bin/clang++; +mkdir -p build +cd build +../bin/build-cling +cd - +export CC=$PWD/build/cling-build/bin/clang; export CXX=$PWD/build/cling-build/bin/clang++; ``` At this point, you're ready to build jank. @@ -62,19 +68,19 @@ At this point, you're ready to build jank. A typical release build just needs the following: ```bash -$ ./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Release -Djank_cling_build_dir=build/cling-build -$ ./bin/compile +./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Release -Djank_cling_build_dir=build/cling-build +./bin/compile ``` #### Debug To make a debug build, specify the build type when configuring. ```bash -$ ./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Debug -Djank_cling_build_dir=build/cling-build -Djank_tests=on -$ ./bin/compile +./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Debug -Djank_cling_build_dir=build/cling-build -Djank_tests=on +./bin/compile # When developing, continuously run the tests locally. -$ ./bin/watch ./bin/test +./bin/watch ./bin/test ``` ### Packaging @@ -83,8 +89,8 @@ Note that this includes a lot of header files, which are necessary for jank's JIT compilation. ```bash -$ ./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Release -Djank_cling_build_dir=build/cling-build -$ ./bin/install +./bin/configure -GNinja -DCMAKE_BUILD_TYPE=Release -Djank_cling_build_dir=build/cling-build +./bin/install ``` ## Sponsors diff --git a/bin/build-cling b/bin/build-cling index c40dc90bd..8ee6ea786 100755 --- a/bin/build-cling +++ b/bin/build-cling @@ -40,7 +40,7 @@ srcdir="${PWD}" cling_url="https://github.com/root-project/cling.git" cling_branch="master" llvm_url="https://github.com/root-project/llvm-project.git" -llvm_branch="cling-llvm13" +llvm_branch="cling-llvm13-20230802-01" # $1 == Repo URL # $2 == Repo branch @@ -52,12 +52,16 @@ function prepare() { if [[ ! -d "${srcdir}/llvm" ]]; then - shallow_clone "${llvm_url}" "${llvm_branch}" "${srcdir}"/llvm + #shallow_clone "${llvm_url}" "${llvm_branch}" "${srcdir}"/llvm + git clone -b "${llvm_branch}" --shallow-submodules --single-branch "${llvm_url}" "${srcdir}"/llvm fi if [[ ! -d "${srcdir}/cling" ]]; then git clone -b "${cling_branch}" --shallow-submodules --single-branch "${cling_url}" "${srcdir}"/cling + pushd "${srcdir}"/cling >/dev/null + git checkout 798c5659789923fe63b7a7edfa99b5af9300311f + popd >/dev/null fi } diff --git a/bin/configure b/bin/configure index 25df1b70a..4d44bcb26 100755 --- a/bin/configure +++ b/bin/configure @@ -4,8 +4,8 @@ set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" build_dir="${here}/../build" -/bin/rm -rf "${build_dir}"/{CMakeCache.txt,CMakeFiles} -/bin/mkdir -p "${build_dir}" +rm -rf "${build_dir}"/{CMakeCache.txt,CMakeFiles} +mkdir -p "${build_dir}" # Assume clang, but allow overriding. export CC="${CC:-clang}" diff --git a/vcpkg.json b/vcpkg.json index 1736e959c..b80cec3ad 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -11,7 +11,6 @@ "fmt", "folly", "immer", - "libguarded", "libzippp", "magic-enum", "readline"