From 02ff472f2167a6bcc0c179e6f8f814b79e8e5f88 Mon Sep 17 00:00:00 2001 From: Dwight Guth Date: Mon, 3 Jun 2024 11:37:01 -0500 Subject: [PATCH 1/3] add libunwind as dependency --- .github/workflows/Dockerfile | 3 ++- Dockerfile.arch | 2 +- INSTALL.md | 2 ++ bin/llvm-kompile-clang | 2 +- nix/llvm-backend.nix | 5 +++-- package/debian/control.jammy | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile index a65cb083c..86f416f16 100644 --- a/.github/workflows/Dockerfile +++ b/.github/workflows/Dockerfile @@ -27,8 +27,9 @@ RUN apt-get update \ libfmt-dev \ libgmp-dev \ libmpfr-dev \ - libyaml-dev \ libjemalloc-dev \ + libunwind-dev \ + libyaml-dev \ openjdk-${JDK_VERSION}-jdk \ curl \ maven \ diff --git a/Dockerfile.arch b/Dockerfile.arch index 8fc23ffe2..cba7ea72f 100644 --- a/Dockerfile.arch +++ b/Dockerfile.arch @@ -1,7 +1,7 @@ FROM archlinux:base RUN pacman -Syyu --noconfirm && \ - pacman -S --noconfirm base-devel git cmake clang llvm lld flex boost gmp mpfr libyaml jemalloc curl maven pkg-config python3 + pacman -S --noconfirm base-devel git cmake clang llvm lld flex boost gmp mpfr jemalloc libunwind libyaml curl maven pkg-config python3 ARG USER_ID=1000 ARG GROUP_ID=1000 diff --git a/INSTALL.md b/INSTALL.md index 03a2e9803..2cd104195 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -16,6 +16,7 @@ sudo apt install \ libgmp-dev \ libjemalloc-dev \ libmpfr-dev \ + libunwind-dev \ libyaml-dev \ lld-15 \ llvm-15-tools \ @@ -40,6 +41,7 @@ brew install \ git \ gmp \ jemalloc \ + libunwind \ libyaml \ llvm@15 \ maven \ diff --git a/bin/llvm-kompile-clang b/bin/llvm-kompile-clang index ae77caa0c..5034f57a5 100644 --- a/bin/llvm-kompile-clang +++ b/bin/llvm-kompile-clang @@ -243,7 +243,7 @@ elif [ "$main" = "c" ]; then flags+=("-fPIC" "-shared" "$start_whole_archive" "$LIBDIR/libkllvmcruntime.a" "$end_whole_archive") clangpp_args+=("-o" "${output_file}") else - all_libraries=("${libraries[@]}" "-lgmp" "-lgmpxx" "-lmpfr" "-lpthread" "-ldl" "-lffi" "-ljemalloc") + all_libraries=("${libraries[@]}" "-lgmp" "-lgmpxx" "-lmpfr" "-lpthread" "-ldl" "-lffi" "-ljemalloc" "-lunwind") fi if $link; then diff --git a/nix/llvm-backend.nix b/nix/llvm-backend.nix index 12c8a7543..e652439ec 100644 --- a/nix/llvm-backend.nix +++ b/nix/llvm-backend.nix @@ -1,5 +1,5 @@ { lib, src, cmake, flex, fmt, pkg-config, llvm, libllvm, libcxx, stdenv, boost, gmp -, jemalloc, libffi, libiconv, libyaml, mpfr, ncurses, python310, unixtools, +, jemalloc, libffi, libiconv, libunwind, libyaml, mpfr, ncurses, python310, unixtools, # Runtime dependencies: host, # Options: @@ -15,7 +15,7 @@ stdenv.mkDerivation { nativeBuildInputs = [ cmake flex llvm pkg-config ]; buildInputs = [ libyaml ]; propagatedBuildInputs = [ - boost fmt gmp jemalloc libffi mpfr ncurses python-env unixtools.xxd + boost fmt gmp libunwind jemalloc libffi mpfr ncurses python-env unixtools.xxd ] ++ lib.optional stdenv.isDarwin libiconv; dontStrip = true; @@ -40,6 +40,7 @@ stdenv.mkDerivation { --replace '"-liconv"' '"-L${libiconv}/lib" "-liconv"' \ --replace '"-lncurses"' '"-L${ncurses}/lib" "-lncurses"' \ --replace '"-ltinfo"' '"-L${ncurses}/lib" "-ltinfo"' \ + --replace '"-lunwind"' '"-L${libunwind}/lib" "-lunwind"' \ --replace '"-L@BREW_PREFIX@/opt/libffi/lib"' ' ' \ --replace '-L@BREW_PREFIX@/lib' '-L${libcxx}/lib' \ --replace '-I "$(dirname "$0")"/../include/kllvm' \ diff --git a/package/debian/control.jammy b/package/debian/control.jammy index 1a2f89256..2b9c857df 100644 --- a/package/debian/control.jammy +++ b/package/debian/control.jammy @@ -10,7 +10,7 @@ Package: k-llvm-backend Architecture: any Section: devel Priority: optional -Depends: clang-15 , flex , libboost-dev , libffi-dev , libfmt-dev , libgmp-dev , libjemalloc-dev , libmpfr-dev , libyaml-0-2 , lld-15 , llvm-15 , pkg-config +Depends: clang-15 , flex , libboost-dev , libffi-dev , libfmt-dev , libgmp-dev , libjemalloc-dev , libmpfr-dev , libunwind-dev , libyaml-0-2 , lld-15 , llvm-15 , pkg-config Description: K Framework LLVM backend Fast concrete execution backend for programming language semantics implemented using the K Framework. Homepage: https://github.com/runtimeverification/llvm-backend From 27c769664d4fc95bad8e604e129ad465de75d523 Mon Sep 17 00:00:00 2001 From: Dwight Guth Date: Wed, 5 Jun 2024 12:43:24 -0500 Subject: [PATCH 2/3] try to fix nix derivation on mac os --- nix/overlay.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/overlay.nix b/nix/overlay.nix index 45cd538f0..82598a82c 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -12,7 +12,7 @@ let clang = llvmPackages.clangNoLibcxx; llvm-backend = prev.callPackage ./llvm-backend.nix { - inherit (llvmPackages) llvm libllvm libcxx; + inherit (llvmPackages) llvm libllvm libcxx libunwind; stdenv = llvmPackages.stdenv; cmakeBuildType = prev.llvm-backend-build-type; src = prev.llvm-backend-src; From 7629aba2c2079afaad16f53c456364ff974d4af6 Mon Sep 17 00:00:00 2001 From: Dwight Guth Date: Thu, 6 Jun 2024 11:14:17 -0500 Subject: [PATCH 3/3] add some missing cases of dependency --- bin/llvm-kompile-clang | 4 ++-- package/debian/control.jammy | 2 +- package/debian/control.noble | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/llvm-kompile-clang b/bin/llvm-kompile-clang index 5034f57a5..e3464c6b7 100644 --- a/bin/llvm-kompile-clang +++ b/bin/llvm-kompile-clang @@ -217,7 +217,7 @@ if [ "$main" = "static" ]; then elif [[ "$main" =~ "python" ]]; then # Don't link jemalloc when building a python library; it clashes with the # pymalloc implementation that Python expects you to use. - all_libraries=("${libraries[@]}" "-lgmp" "-lgmpxx" "-lmpfr" "-lpthread" "-ldl" "-lffi") + all_libraries=("${libraries[@]}" "-lgmp" "-lgmpxx" "-lmpfr" "-lpthread" "-ldl" "-lffi" "-lunwind") flags+=("-fPIC" "-shared" "-I${INCDIR}" "-fvisibility=hidden") read -r -a python_include_flags <<< "$("${python_cmd}" -m pybind11 --includes)" @@ -239,7 +239,7 @@ elif [ "$main" = "c" ]; then # Avoid jemalloc for similar reasons as Python; we don't know who is loading # this library so don't want to impose it. - all_libraries=("${libraries[@]}" "-lgmp" "-lgmpxx" "-lmpfr" "-lpthread" "-ldl" "-lffi") + all_libraries=("${libraries[@]}" "-lgmp" "-lgmpxx" "-lmpfr" "-lpthread" "-ldl" "-lffi" "-lunwind") flags+=("-fPIC" "-shared" "$start_whole_archive" "$LIBDIR/libkllvmcruntime.a" "$end_whole_archive") clangpp_args+=("-o" "${output_file}") else diff --git a/package/debian/control.jammy b/package/debian/control.jammy index 2b9c857df..85722a376 100644 --- a/package/debian/control.jammy +++ b/package/debian/control.jammy @@ -2,7 +2,7 @@ Source: k-llvm-backend Section: devel Priority: optional Maintainer: Bruce Collie -Build-Depends: clang-15 , cmake , debhelper (>=10) , flex , libboost-dev , libboost-test-dev , libfmt-dev , libgmp-dev , libjemalloc-dev , libmpfr-dev , libyaml-dev , llvm-15-tools , pkg-config , python3 , python3-dev , xxd +Build-Depends: clang-15 , cmake , debhelper (>=10) , flex , libboost-dev , libboost-test-dev , libfmt-dev , libgmp-dev , libjemalloc-dev , libmpfr-dev , libunwind-dev , libyaml-dev , llvm-15-tools , pkg-config , python3 , python3-dev , xxd Standards-Version: 3.9.6 Homepage: https://github.com/runtimeverification/llvm-backend diff --git a/package/debian/control.noble b/package/debian/control.noble index 853eb63fc..dffb822b7 100644 --- a/package/debian/control.noble +++ b/package/debian/control.noble @@ -2,7 +2,7 @@ Source: k-llvm-backend Section: devel Priority: optional Maintainer: Bruce Collie -Build-Depends: clang-17 , cmake , debhelper (>=10) , flex , libboost-dev , libboost-test-dev , libfmt-dev , libgmp-dev , libjemalloc-dev , libmpfr-dev , libyaml-dev , llvm-17-tools , pkg-config , python3 , python3-dev , xxd +Build-Depends: clang-17 , cmake , debhelper (>=10) , flex , libboost-dev , libboost-test-dev , libfmt-dev , libgmp-dev , libjemalloc-dev , libmpfr-dev , libunwind-dev , libyaml-dev , llvm-17-tools , pkg-config , python3 , python3-dev , xxd Standards-Version: 3.9.6 Homepage: https://github.com/runtimeverification/llvm-backend @@ -10,7 +10,7 @@ Package: k-llvm-backend Architecture: any Section: devel Priority: optional -Depends: clang-17 , flex , libboost-dev , libffi-dev , libfmt-dev , libgmp-dev , libjemalloc-dev , libmpfr-dev , libyaml-0-2 , lld-17 , llvm-17 , pkg-config +Depends: clang-17 , flex , libboost-dev , libffi-dev , libfmt-dev , libgmp-dev , libjemalloc-dev , libmpfr-dev , libunwind-dev , libyaml-0-2 , lld-17 , llvm-17 , pkg-config Description: K Framework LLVM backend Fast concrete execution backend for programming language semantics implemented using the K Framework. Homepage: https://github.com/runtimeverification/llvm-backend