-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cling, xeus-cling: vendor llvm #283989
cling, xeus-cling: vendor llvm #283989
Conversation
5ec4e99
to
09636ac
Compare
FYI there seems to be a small patchset which allows using LLVM 17 with xeus-cling: jupyter-xeus/xeus-cling@main...lackhole:xeus-cling:llvm-16 |
I guess this won't work unless Cling is based on LLVM 16... |
Result of 2 packages built:
|
A few thoughts here, it's been a few years so I don't remember everything perfectly:
In short, I don't think it'll be easy to get rid of LLVM 9. It might be worth getting in touch with the Cling team to see if a new release might be coming soon. |
it builds -- do you have any suggestions on a good way to test? note that the current darwin build is generating errors when run (missing incudes) and this PR seems to get further but generates different errors (finds includes but has unresolved symbols). linux can include iostream and write to cout. that's the extent i've tested.
there is a maintenance burden. LLVM9 is different enough from newer LLVMs that the toolchain requires a bunch of special cases for everything to work. there are some darwin bugs with the current toolchains i'm working on and not having to support older toolchains will make the changes and the code simpler. there is a cost to just leaving things as is.
given cling is the only package using LLVM9 it already is requiring Hydra to build a whole other LLVM.
a new version was released in December. |
chmod -R u+w include | ||
git apply ${./fix-llvm-include.patch} | ||
''; | ||
version = "0.9"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be 1.0
to pick up the latest support. We may need to ping the Cling team to get them to cut a Git release with a tag.
Oh, really? They didn't tag it on GitHub. That would change things. I went digging around and found this: https://github.com/vgvassilev/cling/blob/v1.0/docs/ReleaseNotes.md. It indicates you can build Cling with LLVM 13. Somewhat confusingly, the build instructions on this page mention a LLVM branch called
A good start would be to run the full sample Jupyter notebook provided by |
They did tag the release, it was just oddly announced in vgvassilev's repo. Also, the official instruction is always to build in-tree with their own fork of LLVM, and building with |
I was messing around yesterday and put together the derivation below. i got it to build and hello world worked but was pulling header files from my system so still needed work (only tested on x64 linux) default.nix{ lib , stdenv , cmake , fetchFromGitHub , ninja , python3 , ncurses , zlib }: let clingRepo = "cling"; llvmRepo = "llvm-project"; in stdenv.mkDerivation (finalAttrs: { pname = "cling2"; version = "1.0"; srcs = let owner = "root-project"; in [ (fetchFromGitHub { inherit owner; repo = clingRepo; rev = "refs/tags/v${finalAttrs.version}"; hash = "sha256-Ye8EINzt+dyNvUIRydACXzb/xEPLm0YSkz08Xxw3xp4="; name = clingRepo; }) (fetchFromGitHub { inherit owner; repo = llvmRepo; #rev = "refs/tags/cling-llvm16-20231130-01"; #hash = "sha256-h/cstR1z6SLooVcNUvT2FsY53bBsZbU81Wwi9AUZbOIr"; rev = "refs/tags/cling-llvm13-20231016-01"; hash = "sha256-Unw5RzYcVYJsViaM9t+QhuBXzTY/r6qo9TDzwZkFi5c="; name = llvmRepo; }) ]; sourceRoot = "."; postUnpack = '' chmod u+w -R . ''; strictDeps = true; nativeBuildInputs = [ cmake ninja python3 ]; buildInputs = [ ncurses zlib ]; cmakeDir = "../${llvmRepo}/llvm"; cmakeFlags = [ "-DLLVM_BUILD_TOOLS=OFF" "-DLLVM_ENABLE_PROJECTS=clang" "-DLLVM_EXTERNAL_CLING_SOURCE_DIR=../${clingRepo}" "-DLLVM_EXTERNAL_PROJECTS=cling" "-DLLVM_TARGETS_TO_BUILD=host;NVPTX" ]; meta = with lib; { description = "The Interactive C++ Interpreter"; homepage = "https://root.cern/cling/"; license = with licenses; [ lgpl21 ncsa ]; maintainers = with maintainers; [ thomasjm ]; platforms = platforms.unix; }; })
using the latest cling rev on main and the the latest cling-llvm16 from the llvm fork will build in the above derivation and hello world works. I saw @wegank working on this PR and was hoping it would solve all our problems.
thanks! |
Oh, great! Would you like to create a PR? I'll close mine in favour of yours. |
Usually when there's uncertainty about how to build I've pinged some Cling people. Historically this has been @vgvassilev or @Axel-Naumann -- any chance one of you could help us pick which version of LLVM to use with Cling these days? Like I mentioned, if we have to choose between a vendored LLVM and using one that Nixpkgs contains anyway, we usually prefer the latter. |
Ah I see. Well, we've gotten by with unpatched LLVM 9 so far |
it's not very far along. I can make it a WIP but your PR seems like it is further along. i haven't tried to integrate with xeus-cling. |
We should use cling v1.0 and llvm13. In principle we can use vanilla llvm but we need our clang because it contains patches that make cling work. |
Thanks @vgvassilev! Could you tell me where to find the necessary version of Clang? In the past I've used the tagged commits from the repo at http://root.cern/git/clang.git. But this lacks a Also, would it be possible to create a GitHub release for the new Cling 1.0 on https://github.com/root-project/cling ? |
We have switched to the llvm monorepo: https://github.com/root-project/llvm-project/ the tag that goes with v1.0 is cling-llvm13. @hahnjo, we might need to create an alias for this tag
Done. |
I'm wondering what the progress on this is, I see the linux targets pass but not the darwin ones. |
The darwin ones should build fine, they were failing on ofborg due to timeout. |
The Linux one is not working yet, it builds but still has some include path issues to resolve. |
That's great.
Well, we should get those fixed then heh. I'm hoping we can get this merged since it's one of the things I would like to see before LLVM 19 is released. From the looks of it, LLVM 19 will be coming out in July but no rush. |
Okay, turned out to be easier than I thought to fix the flags up. #284865 is ready for review now. |
Superseded by #284865. |
Description of changes
This PR attempts to build Cling with root's LLVM fork, as the packages involved are the last blockers for the removal of LLVM 8-11 in Nixpkgs (see #283954). The refactor basically follows https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=cling.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.