Package Details: cling 1.0-1

Git Clone URL: https://aur.archlinux.org/cling.git (read-only, click to copy)
Package Base: cling
Description: Interactive C++ interpreter, built on the top of LLVM and Clang libraries
Upstream URL: https://root.cern/cling/
Keywords: c c++ cling interpreter llvm
Licenses: custom:Cling Release License
Conflicts: cling
Provides: cling
Submitter: archibald869
Maintainer: archibald869
Last Packager: archibald869
Votes: 19
Popularity: 0.50
First Submitted: 2019-08-28 11:45 (UTC)
Last Updated: 2024-05-10 06:45 (UTC)

Dependencies (9)

Required by (1)

Sources (2)

Latest Comments

1 2 3 4 5 6 Next › Last »

QTaKs commented on 2025-03-02 08:17 (UTC)

@ThePirate42 Can you provide an example of the code where this error occurs?

ThePirate42 commented on 2025-02-23 09:58 (UTC) (edited on 2025-02-23 10:00 (UTC) by ThePirate42)

@QTaKs

After using your PKGBUILD i get the following error:

malloc(): mismatching next->prev_size (unsorted)
Aborted (core dumped)

QTaKs commented on 2025-02-18 16:15 (UTC) (edited on 2025-02-18 16:20 (UTC) by QTaKs)

PKGBUILD:

# Maintainer: archibald869 <archibald869 at web dot de>

pkgname=cling
pkgver=1.2
pkgrel=1
pkgdesc="Interactive C++ interpreter, built on the top of LLVM and Clang libraries"
arch=("i686" "x86_64")
url="https://root.cern/cling/"
license=("custom:Cling Release License")
provides=("cling")
conflicts=("cling")
depends=("libxml2")
makedepends=("git" "cmake" "ninja" "python")
optdepends=(
    "perl: support for scan-build, ccc-analyzer and c++-analyzer"
    "python: support for scan-view and Jupyter"
    "python-pygments: support for opt-viewer"
    "python-yaml: support for opt-viewer"
)
source=(
    "cling-llvm::git+https://github.com/root-project/llvm-project.git#tag=cling-llvm18-20250207-01"
    "cling::git+https://github.com/root-project/cling.git#tag=v$pkgver"
)
sha256sums=(
    "SKIP"
    "SKIP"
)
options=(!lto !debug)

build() {
    mkdir -p "$srcdir/build"
    cd "$srcdir/build"

    cmake \
        -G Ninja \
        -DLLVM_ENABLE_BINDINGS=OFF \
        -DCLING_CXX_PATH="/opt/cling/bin/clang++" \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX="/opt/cling" \
        -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
        -DLLVM_BUILD_LLVM_DYLIB=OFF \
        -DLLVM_ENABLE_RTTI=ON \
        -DLLVM_ENABLE_FFI=ON \
        -DLLVM_BUILD_DOCS=OFF \
        -DLLVM_BUILD_TOOLS=OFF \
        -DLLVM_ENABLE_SPHINX=OFF \
        -DLLVM_ENABLE_DOXYGEN=OFF \
        -DLLVM_EXTERNAL_PROJECTS=cling \
        -DLLVM_EXTERNAL_CLING_SOURCE_DIR="$srcdir/cling" \
        -DLLVM_ENABLE_PROJECTS=clang \
        "$srcdir/cling-llvm/llvm"

    ninja
}

binary_path(){
    FILE_PATH="$1"
    OLD_STRING="$2"
    NEW_STRING="$3"
    TMP_FILE_PATH="$4"

    if (( ${#NEW_STRING} > ${#OLD_STRING} )); then
        echo "Error: New string is longer than old string. Cannot patch."
        return 1
    fi
    printf "%s" "$NEW_STRING" > "$TMP_FILE_PATH"
    while (( ${#NEW_STRING} < ${#OLD_STRING} )); do
        NEW_STRING+="0";
        printf '\0' >> "$TMP_FILE_PATH"
    done
    SEEK=$(strings -t d "$FILE_PATH" | grep "$OLD_STRING" | head -n 1 | cut -d ' ' -f 1)
    if [ ! -z "$SEEK" ]; then
        dd if="$TMP_FILE_PATH" of="$FILE_PATH" obs=1 seek="$SEEK" conv=notrunc
    fi
}


package() {
    cd "$srcdir/build"

    DESTDIR="$pkgdir" ninja install

    install -d "$pkgdir/usr/bin"
    ln -s "/opt/cling/bin/cling" "$pkgdir/usr/bin/cling"

    install -Dm644 "$srcdir/cling/LICENSE.TXT" \
        "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

    # include CMake target import file so that other packages are able to use
    # `find_package(Cling REQUIRED)`
    install -Dm644 "$srcdir/build/tools/cling/lib/cmake/cling/ClingTargets.cmake" \
        "$pkgdir/opt/cling/lib/cmake/cling"

    # adjust cling target locations
    sed -Ei 's#(IMPORTED_LOCATION_RELEASE) ".*/([^/]*)"#\1 "/opt/cling/lib/\2"#g' \
        "$pkgdir/opt/cling/lib/cmake/cling/ClingTargets.cmake"
    sed -Ei 's#(INTERFACE_COMPILE_DEFINITIONS "LLVM_PATH=).*#\1\\"/opt/cling\\""#g' \
        "$pkgdir/opt/cling/lib/cmake/cling/ClingTargets.cmake"

    # omit man page for clang's scan-build
    rm -f "$pkgdir/opt/cling/share/man/man1/scan-build.1"

    # remove empty directories
    rmdir -p --ignore-fail-on-non-empty "$pkgdir/opt/cling/share/man/man1"
    rmdir -p --ignore-fail-on-non-empty "$pkgdir/opt/cling/include/cling/cint"

    echo "//////////////"
    echo "Patching binaries"
    TMP_FILE_PATH="$srcdir"/tmpfile

    FILES=( "$pkgdir/opt/cling/bin/cling" "$pkgdir/opt/cling/lib/libcling.so.18.1" "$pkgdir/opt/cling/lib/libclingJupyter.so.18.1" "$pkgdir/opt/cling/lib/libclingInterpreter.a" )

    for FILE in "${FILES[@]}"
    do
        OLD_PATH=" \"/opt/cling/include:$srcdir/cling/include:$srcdir/cling-llvm/llvm/../clang/include:$srcdir/build/tools/clang/include:$srcdir/cling-llvm/llvm/include:$srcdir/build/include\""
        NEW_PATH=" \"/opt/cling/include:/opt/cling/include:/opt/cling/include:/opt/cling/include:/opt/cling/include:/opt/cling/include\""
        binary_path "$FILE" "$OLD_PATH" "$NEW_PATH" "$TMP_FILE_PATH"

        OLD_PATH="/opt/cling/include:$srcdir/cling/include:$srcdir/cling-llvm/llvm/../clang/include:$srcdir/build/tools/clang/include:$srcdir/cling-llvm/llvm/include:$srcdir/build/include"
        NEW_PATH="/opt/cling/include:/opt/cling/include:/opt/cling/include:/opt/cling/include:/opt/cling/include:/opt/cling/include"
        binary_path "$FILE" "$OLD_PATH" "$NEW_PATH" "$TMP_FILE_PATH"

        OLD_PATH="$srcdir/build"
        NEW_PATH="/opt/cling"
        binary_path "$FILE" "$OLD_PATH" "$NEW_PATH" "$TMP_FILE_PATH"

    done
    echo "//////////////"
}

QTaKs commented on 2025-02-18 16:11 (UTC) (edited on 2025-02-18 16:29 (UTC) by QTaKs)

Made a working PKGBUILD, though at the cost of patching binary files. What I did:

  • Used a newer version of llvm-project

  • Added LLVM_ENABLE_BINDINGS=OFF, because ocaml did not let me finish the build.

  • Added CLING_CXX_PATH="/opt/cling/bin/clang++", because without it there were complaints about not being able to find header files when starting cling: ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths!

Invoking:
  LC_ALL=C ccache -O3 -DNDEBUG -xc++ -E -v /dev/null 2>&1 | sed -n -e ‘/^.include/,${’ -e ‘/^ \/.*++/p’ -e ‘}’ 
Results were: 
With exit code 0 
  • Added binary patching to change all hardcoded paths that contain $srcdir to /opt/cling

But I still haven't managed to fix the errors:

cling JIT session error: Symbols not found: [ __emutls_v._ZSt15__once_callable, __emutls_v._ZSt11__once_call ]
IncrementalExecutor::executeFunction: symbol '__emutls_v._ZSt11__once_call' unresolved while linking [cling interface function]!
IncrementalExecutor::executeFunction: symbol '__emutls_v._ZSt15__once_callable' unresolved while linking [cling interface function]!

Apparently you still can't use std::call_once in cling

kaelingre commented on 2025-01-15 16:39 (UTC)

Adding 1+1 works perfectly fine for me using the below PKGBUILD. I get though different errors for different code, e.g. when omitting semicolons to have an expression automatically printed. They are related to missing members in the global namespace (so no problem with missing header files).

archibald869 commented on 2025-01-12 11:06 (UTC) (edited on 2025-01-12 12:08 (UTC) by archibald869)

First of all, sorry for my late response!

@kaelingre: Thank you very much for your effort! I tried your PKGBUILD for v1.2, but I still get a similar error behavior:

ERROR in cling::CIFactory::createCI():
  resource directory /[...]/src/build/lib/clang/18 not found!

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ 1+1
In file included from input_line_4:1:
In file included from /opt/cling/include/cling/Interpreter/RuntimePrintValue.h:20:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../include/c++/14.2.1/filesystem:51:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../include/c++/14.2.1/bits/fs_fwd.h:35:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../include/c++/14.2.1/system_error:42:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../include/c++/14.2.1/iosfwd:42:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../include/c++/14.2.1/bits/postypes.h:40:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../include/c++/14.2.1/cwchar:44:
/usr/include/wchar.h:35:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
         ^~~~~~~~~~
(int) 2
[cling]$

kaelingre commented on 2025-01-03 08:43 (UTC)

Here's a PKGBUILD for v1.2 with LLVM18:

# Maintainer: archibald869 <archibald869 at web dot de>

pkgname=cling
pkgver=1.2
pkgrel=1
pkgdesc="Interactive C++ interpreter, built on the top of LLVM and Clang libraries"
arch=("i686" "x86_64")
url="https://root.cern/cling/"
license=("custom:Cling Release License")
provides=("cling")
conflicts=("cling")
depends=("libxml2")
makedepends=("git" "cmake" "ninja" "python")
optdepends=(
    "perl: support for scan-build, ccc-analyzer and c++-analyzer"
    "python: support for scan-view and Jupyter"
    "python-pygments: support for opt-viewer"
    "python-yaml: support for opt-viewer"
)
source=(
    "cling-llvm::git+https://github.com/root-project/llvm-project.git#tag=cling-llvm18-20240821-01"
    "cling::git+https://github.com/root-project/cling.git#tag=v$pkgver"
)
sha256sums=(
    "SKIP"
    "SKIP"
)
options=(!lto !debug)


build() {
    mkdir -p "$srcdir/build"
    cd "$srcdir/build"

    cmake \
        -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX="/opt/cling" \
        -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
        -DLLVM_BUILD_LLVM_DYLIB=OFF \
        -DLLVM_ENABLE_RTTI=ON \
        -DLLVM_ENABLE_FFI=ON \
        -DLLVM_BUILD_DOCS=OFF \
        -DLLVM_BUILD_TOOLS=OFF \
        -DLLVM_ENABLE_SPHINX=OFF \
        -DLLVM_ENABLE_DOXYGEN=OFF \
        -DLLVM_EXTERNAL_PROJECTS=cling \
        -DLLVM_EXTERNAL_CLING_SOURCE_DIR="$srcdir/cling" \
        -DLLVM_ENABLE_PROJECTS=clang \
        "$srcdir/cling-llvm/llvm"

    ninja
}

package() {
    cd "$srcdir/build"

    DESTDIR="$pkgdir" ninja install

    install -d "$pkgdir/usr/bin"
    ln -s "/opt/cling/bin/cling" "$pkgdir/usr/bin/cling"

    install -Dm644 "$srcdir/cling/LICENSE.TXT" \
        "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

    # include CMake target import file so that other packages are able to use
    # `find_package(Cling REQUIRED)`
    install -Dm644 "$srcdir/build/tools/cling/lib/cmake/cling/ClingTargets.cmake" \
        "$pkgdir/opt/cling/lib/cmake/cling"

    # adjust cling target locations
    sed -Ei 's#(IMPORTED_LOCATION_RELEASE) ".*/([^/]*)"#\1 "/opt/cling/lib/\2"#g' \
        "$pkgdir/opt/cling/lib/cmake/cling/ClingTargets.cmake"
    sed -Ei 's#(INTERFACE_COMPILE_DEFINITIONS "LLVM_PATH=).*#\1\\"/opt/cling\\""#g' \
        "$pkgdir/opt/cling/lib/cmake/cling/ClingTargets.cmake"

    # omit man page for clang's scan-build
    rm -f "$pkgdir/opt/cling/share/man/man1/scan-build.1"

    # remove empty directories
    rmdir -p --ignore-fail-on-non-empty "$pkgdir/opt/cling/share/man/man1"
    rmdir -p --ignore-fail-on-non-empty "$pkgdir/opt/cling/include/cling/cint"
}

kaelingre commented on 2024-09-02 15:42 (UTC) (edited on 2024-09-02 15:44 (UTC) by kaelingre)

The below bug seems fixed in version 1.1 (with LLVM16 this time...). Please use this PKGBUILD:

# Maintainer: archibald869 <archibald869 at web dot de>

pkgname=cling
pkgver=1.1
pkgrel=1
pkgdesc="Interactive C++ interpreter, built on top of LLVM and Clang libraries"
arch=("i686" "x86_64")
url="https://root.cern/cling/"
license=("custom:Cling Release License")
provides=("cling")
conflicts=("cling")
depends=("libxml2")
makedepends=("git" "cmake" "ninja" "python")
optdepends=(
    "perl: support for scan-build, ccc-analyzer and c++-analyzer"
    "python: support for scan-view and Jupyter"
    "python-pygments: support for opt-viewer"
    "python-yaml: support for opt-viewer"
)
source=(
    "cling-llvm.tar.gz::https://github.com/root-project/llvm-project/archive/refs/tags/cling-llvm16-20240621-02.tar.gz"
    "cling.tar.gz::https://github.com/root-project/cling/archive/refs/tags/v${pkgver}.tar.gz"
)
sha512sums=(
    "06d3faaec9bb205dd43f9abfac92437a7fdb8759c455f254a2ed6780223df38fb7bce567a75fa10c36d9dc0d737214d69d50141d33c23e6bb8e9972ec0343c6f"
    "23f5ef64c94ef5e6aa2004800c017d9b5f909c4764863327ae97110e4818e6e2cff64426025ea952400ec8a1e5159a248363ae09ef23a524439ffaf72132fac3"
)
options=(!lto !debug)

build() {
    mkdir -p "$srcdir/build"
    cd "$srcdir/build"

    cmake \
        -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX="/opt/cling" \
        -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \
        -DLLVM_BUILD_LLVM_DYLIB=OFF \
        -DLLVM_ENABLE_RTTI=ON \
        -DLLVM_ENABLE_FFI=ON \
        -DLLVM_BUILD_DOCS=OFF \
        -DLLVM_BUILD_TOOLS=OFF \
        -DLLVM_ENABLE_SPHINX=OFF \
        -DLLVM_ENABLE_DOXYGEN=OFF \
        -DLLVM_EXTERNAL_PROJECTS=cling \
        -DLLVM_EXTERNAL_CLING_SOURCE_DIR="$srcdir/cling-$pkgver" \
        -DLLVM_ENABLE_PROJECTS=clang \
        "$srcdir/llvm-project-cling-llvm16-20240621-02/llvm"

    ninja
}

package() {
    cd "$srcdir/build"

    DESTDIR="$pkgdir" ninja install

    install -d "$pkgdir/usr/bin"
    ln -s "/opt/cling/bin/cling" "$pkgdir/usr/bin/cling"

    install -Dm644 "$srcdir/cling-$pkgver/LICENSE.TXT" \
        "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

    # include CMake target import file so that other packages are able to use
    # `find_package(Cling REQUIRED)`
    install -Dm644 "$srcdir/build/tools/cling/lib/cmake/cling/ClingTargets.cmake" \
        "$pkgdir/opt/cling/lib/cmake/cling"

    # adjust cling target locations
    sed -Ei 's#(IMPORTED_LOCATION_RELEASE) ".*/([^/]*)"#\1 "/opt/cling/lib/\2"#g' \
        "$pkgdir/opt/cling/lib/cmake/cling/ClingTargets.cmake"
    sed -Ei 's#(INTERFACE_COMPILE_DEFINITIONS "LLVM_PATH=).*#\1\\"/opt/cling\\""#g' \
        "$pkgdir/opt/cling/lib/cmake/cling/ClingTargets.cmake"

    # omit man page for clang's scan-build
    rm -f "$pkgdir/opt/cling/share/man/man1/scan-build.1"

    # remove empty directories
    rmdir -p --ignore-fail-on-non-empty "$pkgdir/opt/cling/share/man/man1"
    rmdir -p --ignore-fail-on-non-empty "$pkgdir/opt/cling/include/cling/cint"
}

kaelingre commented on 2024-07-29 11:20 (UTC) (edited on 2024-07-29 14:29 (UTC) by kaelingre)

@Tyilo and @ThePirate42: I get the same problem. It seems that the resource directory is not correctly set during installation:

resource directory /home/tyilo/.cache/paru/clone/cling/src/build/lib/clang/13.0.0 not found!

The missing files (e.g. stddef.h) are though correctly installed into /opt/cling/lib/clang/13.0.0/include. I haven't quite figured out how to fix it yet.

ThePirate42 commented on 2024-06-29 16:01 (UTC)

I have the same problem:

https://pastebin.com/DU9212iq