xeus-cling: remove as unmaintained + replace with xeus-cpp

This commit is contained in:
thomasjm
2026-07-05 03:06:22 -07:00
parent f245dd6491
commit 1e45dae2aa
8 changed files with 6 additions and 402 deletions
@@ -1,50 +0,0 @@
From 8bfa594bc37630956f80496106bb1d6070035570 Mon Sep 17 00:00:00 2001
From: thomasjm <tom@codedown.io>
Date: Wed, 2 Aug 2023 18:26:58 -0700
Subject: [PATCH 1/3] Fix bug in extract_filename
---
src/main.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main.cpp b/src/main.cpp
index 2ee19be..57294b4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -61,19 +61,19 @@ bool should_print_version(int argc, char* argv[])
return false;
}
-std::string extract_filename(int argc, char* argv[])
+std::string extract_filename(int *argc, char* argv[])
{
std::string res = "";
- for (int i = 0; i < argc; ++i)
+ for (int i = 0; i < *argc; ++i)
{
- if ((std::string(argv[i]) == "-f") && (i + 1 < argc))
+ if ((std::string(argv[i]) == "-f") && (i + 1 < *argc))
{
res = argv[i + 1];
- for (int j = i; j < argc - 2; ++j)
+ for (int j = i; j < *argc - 2; ++j)
{
argv[j] = argv[j + 2];
}
- argc -= 2;
+ *argc -= 2;
break;
}
}
@@ -128,7 +128,7 @@ int main(int argc, char* argv[])
#endif
signal(SIGINT, stop_handler);
- std::string file_name = extract_filename(argc, argv);
+ std::string file_name = extract_filename(&argc, argv);
interpreter_ptr interpreter = build_interpreter(argc, argv);
--
2.40.1
@@ -1,34 +0,0 @@
From 9e6a14bb20567071883563dafb5dfaf512df6243 Mon Sep 17 00:00:00 2001
From: thomasjm <tom@codedown.io>
Date: Wed, 2 Aug 2023 18:27:16 -0700
Subject: [PATCH 2/3] Don't pass extra includes; configure this with flags
---
src/main.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/main.cpp b/src/main.cpp
index 57294b4..0041a55 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -84,7 +84,7 @@ using interpreter_ptr = std::unique_ptr<xcpp::interpreter>;
interpreter_ptr build_interpreter(int argc, char** argv)
{
- int interpreter_argc = argc + 1;
+ int interpreter_argc = argc;
const char** interpreter_argv = new const char*[interpreter_argc];
interpreter_argv[0] = "xeus-cling";
// Copy all arguments in the new array excepting the process name.
@@ -92,8 +92,6 @@ interpreter_ptr build_interpreter(int argc, char** argv)
{
interpreter_argv[i] = argv[i];
}
- std::string include_dir = std::string(LLVM_DIR) + std::string("/include");
- interpreter_argv[interpreter_argc - 1] = include_dir.c_str();
interpreter_ptr interp_ptr = interpreter_ptr(new xcpp::interpreter(interpreter_argc, interpreter_argv));
delete[] interpreter_argv;
--
2.40.1
@@ -1,85 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 43718f5..d0d8670 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,8 +63,7 @@ if(LLVM_CONFIG)
"--bindir"
"--libdir"
"--includedir"
- "--prefix"
- "--src-root")
+ "--prefix")
execute_process(COMMAND ${CONFIG_COMMAND}
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE CONFIG_OUTPUT)
diff --git a/src/xmagics/executable.cpp b/src/xmagics/executable.cpp
index 391c8c9..aba5e03 100644
--- a/src/xmagics/executable.cpp
+++ b/src/xmagics/executable.cpp
@@ -12,6 +12,7 @@
#include <iterator>
#include <fstream>
#include <memory>
+#include <optional>
#include <string>
#include <vector>
@@ -25,7 +26,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclGroup.h"
#include "clang/AST/RecursiveASTVisitor.h"
-#include "clang/Basic/DebugInfoOptions.h"
+#include "llvm/Frontend/Debug/Options.h"
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/CodeGen/BackendUtil.h"
@@ -115,7 +116,7 @@ namespace xcpp
// Filter out functions added by Cling.
if (auto Identifier = D->getIdentifier())
{
- if (Identifier->getName().startswith("__cling"))
+ if (Identifier->getName().starts_with("__cling"))
{
return true;
}
@@ -153,12 +154,13 @@ namespace xcpp
if (EnableDebugInfo)
{
CodeGenOpts.setDebugInfo(
- clang::codegenoptions::DebugInfoKind::FullDebugInfo);
+ llvm::codegenoptions::DebugInfoKind::FullDebugInfo);
}
std::unique_ptr<clang::CodeGenerator> CG(clang::CreateLLVMCodeGen(
- CI->getDiagnostics(), "object", HeaderSearchOpts,
- CI->getPreprocessorOpts(), CodeGenOpts, *Context));
+ CI->getDiagnostics(), "object",
+ llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>(&CI->getVirtualFileSystem()),
+ HeaderSearchOpts, CI->getPreprocessorOpts(), CodeGenOpts, *Context));
CG->Initialize(AST);
FindTopLevelDecls Visitor(CG.get());
@@ -186,7 +188,9 @@ namespace xcpp
EmitBackendOutput(CI->getDiagnostics(), HeaderSearchOpts,
CodeGenOpts, CI->getTargetOpts(),
CI->getLangOpts(), DataLayout, CG->GetModule(),
- clang::Backend_EmitObj, std::move(OS));
+ clang::Backend_EmitObj,
+ llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>(&CI->getVirtualFileSystem()),
+ std::move(OS));
return true;
}
@@ -222,10 +226,10 @@ namespace xcpp
llvm::StringRef OutputFileStr(OutputFile);
llvm::StringRef ErrorFileStr(ErrorFile);
- llvm::SmallVector<llvm::Optional<llvm::StringRef>, 16> Redirects = {llvm::NoneType::None, OutputFileStr, ErrorFileStr};
+ llvm::SmallVector<std::optional<llvm::StringRef>, 16> Redirects = {std::nullopt, OutputFileStr, ErrorFileStr};
// Finally run the linker.
- int ret = llvm::sys::ExecuteAndWait(Compiler, Args, llvm::NoneType::None,
+ int ret = llvm::sys::ExecuteAndWait(Compiler, Args, std::nullopt,
Redirects);
// Read back output and error streams.
@@ -1,94 +0,0 @@
{
lib,
callPackage,
cling,
fetchurl,
jq,
makeWrapper,
python3,
stdenv,
}:
# Jupyter console:
# nix run --impure --expr 'with import <nixpkgs> {}; jupyter-console.withSingleKernel cpp17-kernel'
# Jupyter notebook:
# nix run --impure --expr 'with import <nixpkgs> {}; jupyter.override { definitions = { cpp17 = cpp17-kernel; }; }'
let
xeus-cling-unwrapped = callPackage ./xeus-cling.nix { };
xeus-cling = xeus-cling-unwrapped.overrideAttrs (oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ makeWrapper ];
# xcpp needs a collection of flags to start up properly, so wrap it by default.
# We'll provide the unwrapped version as a passthru
flags = cling.flags ++ [
"-resource-dir"
"${cling.unwrapped}"
"-L"
"${cling.unwrapped}/lib"
"-l"
"${cling.unwrapped}/lib/cling.so"
];
fixupPhase = ''
runHook preFixup
wrapProgram $out/bin/xcpp --add-flags "$flags"
runHook postFixup
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
# Smoke check: run a test notebook using Papermill by creating a simple kernelspec
mkdir -p kernels/cpp17
export JUPYTER_PATH="$(pwd)"
cat << EOF > kernels/cpp17/kernel.json
{
"argv": ["$out/bin/xcpp", "-std=c++17", "-f", "{connection_file}"],
"language": "cpp17"
}
EOF
${python3.pkgs.papermill}/bin/papermill ${./test.ipynb} out.ipynb
result="$(cat out.ipynb | ${jq}/bin/jq -r '.cells[0].outputs[0].text[0]')"
if [[ "$result" != "Hello world." ]]; then
echo "Kernel test gave '$result'. Expected: 'Hello world.'"
exit 1
fi
runHook postInstallCheck
'';
passthru = (oldAttrs.passthru or { }) // {
unwrapped = xeus-cling-unwrapped;
};
});
mkKernelSpec = std: {
displayName = builtins.replaceStrings [ "c++" ] [ "C++ " ] std;
argv = [
"${xeus-cling}/bin/xcpp"
"-std=${std}"
"-f"
"{connection_file}"
];
language = "cpp";
logo32 = "${xeus-cling-unwrapped}/share/jupyter/kernels/xcpp17/logo-32x32.png";
logo64 = "${xeus-cling-unwrapped}/share/jupyter/kernels/xcpp17/logo-64x64.png";
};
in
{
cpp11-kernel = mkKernelSpec "c++11";
cpp14-kernel = mkKernelSpec "c++14";
cpp17-kernel = mkKernelSpec "c++17";
cpp2a-kernel = mkKernelSpec "c++2a";
inherit xeus-cling;
}
@@ -1,24 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "574ed398-7bfe-4a34-a7dd-9fa85535aed2",
"metadata": {},
"outputs": [],
"source": [
"#include <iostream>\n",
"std::cout << \"Hello world.\";"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "C++ 17",
"language": "cpp",
"name": "cpp17"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -1,112 +0,0 @@
{
lib,
clangStdenv,
cmake,
fetchFromGitHub,
llvmPackages_18,
# Libraries
argparse,
cling,
cppzmq,
libuuid,
ncurses,
openssl,
pugixml,
xeus,
xeus-zmq,
xtl,
zeromq,
zlib,
# Settings
debug ? false,
}:
let
# Nixpkgs moved to argparse 3.x, but we need ~2.9
argparse_2_9 = argparse.overrideAttrs (oldAttrs: {
version = "2.9";
src = fetchFromGitHub {
owner = "p-ranav";
repo = "argparse";
rev = "v2.9";
sha256 = "sha256-vbf4kePi5gfg9ub4aP1cCK1jtiA65bUS9+5Ghgvxt/E=";
};
});
# Nixpkgs moved to xeus 5.2.0, but we need 3.2.0
# https://github.com/jupyter-xeus/xeus-cling/issues/523
xeus_3_2_0 = xeus.overrideAttrs (oldAttrs: {
version = "3.2.0";
src = fetchFromGitHub {
owner = "jupyter-xeus";
repo = "xeus";
tag = "3.2.0";
sha256 = "sha256-D/dJ0SHxTHJw63gHD6FRZS7O2TVZ0voIv2mQASEjLA8=";
};
buildInputs = oldAttrs.buildInputs ++ lib.singleton xtl;
});
in
clangStdenv.mkDerivation (finalAttrs: {
pname = "xeus-cling";
version = "0.15.3";
src = fetchFromGitHub {
owner = "QuantStack";
repo = "xeus-cling";
rev = "${finalAttrs.version}";
hash = "sha256-OfZU+z+p3/a36GntusBfwfFu3ssJW4Fu7SV3SMCoo1I=";
};
patches = [
./0001-Fix-bug-in-extract_filename.patch
./0002-Don-t-pass-extra-includes-configure-this-with-flags.patch
./0003-Remove-unsupported-src-root-flag.patch
];
nativeBuildInputs = [ cmake ];
buildInputs = [
argparse_2_9
cling.unwrapped
cppzmq
libuuid
llvmPackages_18.llvm
ncurses
openssl
pugixml
xeus_3_2_0
xeus-zmq
xtl
zeromq
zlib
];
cmakeBuildType = if debug then "Debug" else "Release";
postPatch = ''
substituteInPlace src/xmagics/executable.cpp \
--replace-fail "getDataLayout" "getDataLayoutString"
substituteInPlace src/xmagics/execution.cpp \
--replace-fail "simplisticCastAs" "castAs"
substituteInPlace src/xmime_internal.hpp \
--replace-fail "code.str()" "code.str().str()"
substituteInPlace CMakeLists.txt \
--replace-fail "cmake_minimum_required(VERSION 3.4.3)" "cmake_minimum_required(VERSION 3.10)"
'';
dontStrip = debug;
meta = {
description = "Jupyter kernel for the C++ programming language";
mainProgram = "xcpp";
homepage = "https://github.com/jupyter-xeus/xeus-cling";
maintainers = with lib.maintainers; [ thomasjm ];
platforms = lib.platforms.unix;
license = lib.licenses.mit;
};
})
+2
View File
@@ -578,6 +578,7 @@ mapAliases {
coreth = throw "'coreth' has been moved to 'avalanchego' by upstream"; # Added 2026-01-15
cosmic-tasks = throw "'cosmic-tasks' has been renamed to/replaced by 'tasks'"; # Converted to throw 2025-10-27
cotton = throw "'cotton' has been removed since it is vulnerable to CVE-2025-62518 and upstream is unmaintained"; # Added 2025-10-26
cpp2a-kernel = cpp20-kernel; # Added 2026-06-30, xeus-cling removed in favour of xeus-cpp
cpp-ipfs-api = throw "'cpp-ipfs-api' has been renamed to/replaced by 'cpp-ipfs-http-client'"; # Converted to throw 2025-10-27
cpr = warnAlias "'cpr' has been renamed to/replaced by 'libcpr'" libcpr; # Added 2025-11-17
cqrlog = throw "'cqrlog' was removed due to lack of maintenance and relying on gtk2"; # Added 2025-12-02
@@ -2409,6 +2410,7 @@ mapAliases {
use the reference implementation 'xdg-terminal-exec' instead.
" xdg-terminal-exec; # Added 2026-01-14
xdragon = throw "'xdragon' has been renamed to/replaced by 'dragon-drop'"; # Converted to throw 2025-10-27
xeus-cling = throw "'xeus-cling' has been removed: it is unmaintained upstream. Use 'xeus-cpp' (a clang-repl/CppInterOp-based successor) instead"; # Added 2026-06-30
xf86-input-cmt = throw "'xf86-input-cmt' has been removed as it was broken and unmaintained upstream"; # Added 2026-05-09
xf86_input_cmt = xf86-input-cmt; # Added 2025-12-12
xf86_input_wacom = xf86-input-wacom; # Added 2025-12-12
+4 -3
View File
@@ -4409,12 +4409,13 @@ with pkgs;
jre = jre8;
};
inherit (callPackage ../applications/editors/jupyter-kernels/xeus-cling { })
inherit (callPackage ../applications/editors/jupyter-kernels/xeus-cpp { })
cpp11-kernel
cpp14-kernel
cpp17-kernel
cpp2a-kernel
xeus-cling
cpp20-kernel
cpp23-kernel
xeus-cpp
;
dhall = haskell.lib.compose.justStaticExecutables haskellPackages.dhall;