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: 17
Popularity: 0.022843
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 Next › Last »

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

Tyilo commented on 2024-05-17 11:11 (UTC)

The built cling binary doesn't seem to work for me:

ERROR in cling::CIFactory::createCI():
  resource directory /home/tyilo/.cache/paru/clone/cling/src/build/lib/clang/13.0.0 not found!

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ int a = 3;
[cling]$ a + 3
In file included from input_line_5:1:
In file included from /opt/cling/include/cling/Interpreter/RuntimePrintValue.h:19:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/memory:80:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/shared_ptr.h:52:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/iosfwd:42:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/postypes.h:40:
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/cwchar:44:
/usr/include/wchar.h:35:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
         ^~~~~~~~~~
 #0 0x000062409aeab4cb (/usr/bin/cling+0x8d34cb)
 #1 0x000062409aea8ebb (/usr/bin/cling+0x8d0ebb)
 #2 0x00000cde7e165ae0 (/usr/lib/libc.so.6+0x3cae0)
 #3 0x000062409ce0959f clang::DeclContext::removeDecl(clang::Decl*) (/usr/bin/cling+0x283159f)
 #4 0x000062409ad286fc cling::DeclUnloader::VisitNamedDecl(clang::NamedDecl*) (/usr/bin/cling+0x7506fc)
 #5 0x000062409ad2bb1c cling::DeclUnloader::VisitNamespaceDecl(clang::NamespaceDecl*) (/usr/bin/cling+0x753b1c)
 #6 0x000062409ad2b74b cling::DeclUnloader::VisitDeclContext(clang::DeclContext*) (/usr/bin/cling+0x75374b)
 #7 0x000062409ad2b889 cling::DeclUnloader::VisitLinkageSpecDecl(clang::LinkageSpecDecl*) (/usr/bin/cling+0x753889)
 #8 0x000062409adbc8ae cling::TransactionUnloader::unloadDeclarations(cling::Transaction*, cling::DeclUnloader&) (/usr/bin/cling+0x7e48ae)
 #9 0x000062409adbcd2d cling::TransactionUnloader::RevertTransaction(cling::Transaction*) (/usr/bin/cling+0x7e4d2d)
#10 0x000062409ad90f69 cling::Interpreter::unload(cling::Transaction&) (/usr/bin/cling+0x7b8f69)
#11 0x000062409ad868ca cling::IncrementalParser::commitTransaction(llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*>>>&, bool) (/usr/bin/cling+0x7ae8ca)
#12 0x000062409ad89df3 cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) (/usr/bin/cling+0x7b1df3)
#13 0x000062409ad8d952 cling::Interpreter::declare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, cling::Transaction**) (/usr/bin/cling+0x7b5952)
#14 0x000062409adcf5da cling::valuePrinterInternal::printValueInternal[abi:cxx11](cling::Value const&) (/usr/bin/cling+0x7f75da)
#15 0x000062409adc698d cling::Value::print(llvm::raw_ostream&, bool) const (/usr/bin/cling+0x7ee98d)
#16 0x00000cde7e08704a 
#17 0x000062409ad71a07 cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (/usr/bin/cling+0x799a07)
#18 0x000062409ad8eeef cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (/usr/bin/cling+0x7b6eef)
#19 0x000062409ad8f6d6 cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (/usr/bin/cling+0x7b76d6)
#20 0x000062409ad8fa4e cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, cling::Value*, cling::Transaction**, bool) (/usr/bin/cling+0x7b7a4e)
#21 0x000062409ade23a1 cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (/usr/bin/cling+0x80a3a1)
#22 0x000062409aed1992 cling::UserInterface::runInteractively(bool) (/usr/bin/cling+0x8f9992)
#23 0x000062409abf67c9 main (/usr/bin/cling+0x61e7c9)
#24 0x00000cde7e14ec88 (/usr/lib/libc.so.6+0x25c88)
#25 0x00000cde7e14ed4c __libc_start_main (/usr/lib/libc.so.6+0x25d4c)
#26 0x000062409ac8ad55 _start (/usr/bin/cling+0x6b2d55)
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /usr/bin/cling
fish: Job 1, '/usr/bin/cling' terminated by signal SIGSEGV (Address boundary error)

carlosal1015 commented on 2024-05-11 14:47 (UTC)

Nice, thanks for the trick.

archibald869 commented on 2024-05-10 06:55 (UTC) (edited on 2024-05-10 06:56 (UTC) by archibald869)

@carlosal1015: Sorry for the late reply! I prefer to leave the default configuration as it is. If you want to allow redefinition of variables, functions etc., you can enter the following statement in the interactive shell: cling::runtime::gClingOpts->AllowRedefinition = 1;

archibald869 commented on 2024-05-10 06:49 (UTC) (edited on 2024-05-10 06:50 (UTC) by archibald869)

@kaelingre: Many thanks for your helpful preparatory work! I updated the PKGBUILD for v1.0. In the course of this, I also added !debug to the options.

kaelingre commented on 2024-05-06 10:25 (UTC)

It would be useful to disable the debug option by default (i.e. add !debug to the options). The debug package that is produced is huge, 6.4GiB+.

kaelingre commented on 2024-03-24 10:09 (UTC)

I created a PKGBUILD for v1.0. Note that I hard-coded a specific llvm version (cling-llvm13-20240318-01) to build against:

pkgname=cling
pkgver=1.0
pkgrel=1
pkgdesc="Interactive C++ interpreter, built on the top of LLVM and Clang libraries"
arch=("i686" "x86_64")
url="https://root.cern.ch/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-$pkgver.tar.gz::https://github.com/root-project/llvm-project/archive/refs/tags/cling-llvm13-20240318-01.tar.gz"
    "$pkgname-$pkgver.tar.gz::https://github.com/root-project/cling/archive/refs/tags/v$pkgver.tar.gz"
)
sha256sums=(
    "SKIP"
    "SKIP"
)

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-llvm13-20240318-01/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/$pkgname-$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"

    # 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"
}

carlosal1015 commented on 2023-12-26 01:36 (UTC)

There are no tags v1.0 for llvm and clang. Compilation will give errors if bump version to 1.0.