xeus-cling icon indicating copy to clipboard operation
xeus-cling copied to clipboard

Installing without conda on Debian-based systems

Open dimitry-ishenko opened this issue 4 years ago • 32 comments

UPDATE 2023

For Ubuntu 20.04 and 22.04 use this PPA instead:

https://launchpad.net/~ppa-verse/+archive/ubuntu/cling

See more details in https://github.com/jupyter-xeus/xeus-cling/issues/423#issuecomment-987249343


ORIGINAL POST

In case anyone is interested, I've created Debian packages for Cling and xeus-cling along with patched version of LLVM/Clang libraries, which can be easily installed through @ppa-verse/cling PPA without having to use conda.

I've tested these on Ubuntu 21.04, but I imagine they should also work on any other Debian-based system.

You can install the PPA on your system as follows:

curl https://ppa-verse.github.io/cling/cling.list | \
    sudo tee /etc/apt/sources.list.d/cling.list

curl https://ppa-verse.github.io/cling/KEY.gpg    | \
    sudo gpg --no-default-keyring --keyring /usr/share/keyrings/cling-keyring.gpg --import

sudo apt update

To install Cling run:

sudo apt install cling

To install xeus-cling run:

sudo apt install xeus-cling

Share and enjoy.

dimitry-ishenko avatar Oct 22 '21 15:10 dimitry-ishenko

Wow this is awemsome! Congratz and thanks for the hard work and for sharing this!

JohanMabille avatar Oct 25 '21 07:10 JohanMabille

Thanks for this. It is great!

SylvainCorlay avatar Oct 25 '21 07:10 SylvainCorlay

I would really like to see the xeus parts packaged into core Debian at some point!

SylvainCorlay avatar Oct 25 '21 07:10 SylvainCorlay

I would really like to see the xeus parts packaged into core Debian at some point!

That would require the Cling patches being accepted into LLVM/Clang 9. I can submit a PR and see where it goes. 🤷🏻 Although, Cling is transitioning to Clang-repl, so I am not holding my breath for them being accepted:

https://root.cern/blog/cling-in-llvm/

dimitry-ishenko avatar Oct 25 '21 14:10 dimitry-ishenko

@SylvainCorlay FYI https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/merge_requests/75

dimitry-ishenko avatar Oct 25 '21 15:10 dimitry-ishenko

Thanks @dimitry-ishenko!

Indeed, packaging cling is hard, but core xeus should be easier. Streamlining the packaging of xeus would enable many other kernels (xeus-robot, xeus-lua, xeus-sql).

SylvainCorlay avatar Oct 30 '21 12:10 SylvainCorlay

@SylvainCorlay but xeus is already in Debian:

https://packages.debian.org/sid/libxeus1 https://packages.debian.org/sid/xeus-dev

Or am I misunderstanding you?

dimitry-ishenko avatar Oct 30 '21 18:10 dimitry-ishenko

If you are interested, I can try to package xeus-{robot,lua,sql} and make them available in my PPA for now.

dimitry-ishenko avatar Oct 30 '21 18:10 dimitry-ishenko

@dimitry-ishenko that would be awesome!

JohanMabille avatar Nov 04 '21 09:11 JohanMabille

Thanks for this, I would love to be able to install this on debian without conda but it seems there are some unmet dependencies that can't be installed

The following packages have unmet dependencies: cling : Depends: cling-common (= 0.9.1-2) but it is not going to be installed Depends: libclang-cpp9 (> 2:9~) but it is not going to be installed Depends: libc6 (>= 2.33) but 2.31-13+deb11u2 is to be installed Depends: libllvm9 (> 2:9~) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

and libllvm9 : Depends: libc6 (>= 2.33) but 2.31-13+deb11u2 is to be installed Depends: libffi8ubuntu1 (>= 3.4~20200819) but it is not installable

this is on debian 11 bullseye. Thanks!

BretG137 avatar Dec 06 '21 04:12 BretG137

@BretG137 I am in the process of moving everything to launchpad, so that I can support both LTS and current version of Ubuntu. The PPA can be found here:

https://launchpad.net/~ppa-verse/+archive/ubuntu/cling

It doesn't have xeus-cling at the moment, as I need to fix one dependency. Should be able to do that in the next day or two.

Unfortunately, there is no support for Debian on launchpad... I would also like to add support for Debian, but need to figure out how to do that.

dimitry-ishenko avatar Dec 06 '21 05:12 dimitry-ishenko

@BretG137 all the packages are now in my launchpad PPA called: cling. Debian bullseye seems to be roughly equivalent to Ubuntu LTS 20.04 (aka, focal). So, you can try the following:

# add the PPA
echo "deb [signed-by=/usr/share/keyrings/ppa-verse-keyring.gpg] http://ppa.launchpad.net/ppa-verse/cling/ubuntu focal main" | \
    sudo tee /etc/apt/sources.list.d/cling.list

# import the key
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/ppa-verse-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 9A571B8F2E9F9D11

sudo apt update

# install cling
sudo apt install cling

# and/or xeus-cling
sudo apt install xeus-cling

I've tried it in a bullseye chroot and was able to install both.

dimitry-ishenko avatar Dec 06 '21 21:12 dimitry-ishenko

@BretG137 all the packages are now in my launchpad PPA called: cling. Debian bullseye seems to be roughly equivalent to Ubuntu LTS 18.04 (aka, focal). So, you can try the following:

# add the PPA
echo "deb [signed-by=/usr/share/keyrings/ppa-verse-keyring.gpg] http://ppa.launchpad.net/ppa-verse/cling/ubuntu focal main" \
    sudo tee /etc/apt/sources.list.d/cling.list

# import the key
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/ppa-verse-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 9A571B8F2E9F9D11

sudo apt update

# install cling
sudo apt install cling

# and/or xeus-cling
sudo apt install xeus-cling

I've tried it in a bullseye chroot and was able to install both.

Thanks for doing this but I wound up installing it through miniconda instead.

BretG137 avatar Dec 12 '21 21:12 BretG137

@BretG137 all the packages are now in my launchpad PPA called: cling. Debian bullseye seems to be roughly equivalent to Ubuntu LTS 18.04 (aka, focal). So, you can try the following:

# add the PPA
echo "deb [signed-by=/usr/share/keyrings/ppa-verse-keyring.gpg] http://ppa.launchpad.net/ppa-verse/cling/ubuntu focal main" \
    sudo tee /etc/apt/sources.list.d/cling.list

# import the key
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/ppa-verse-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 9A571B8F2E9F9D11

sudo apt update

# install cling
sudo apt install cling

# and/or xeus-cling
sudo apt install xeus-cling

I've tried it in a bullseye chroot and was able to install both.

@dimitry-ishenko

  • The first instruction is missing a pipe operator.
  • xeus-cling is not available on 20.04? I could install cling, but not xeus-cling

qlibp avatar May 08 '23 05:05 qlibp

@qlibp thanks I've fixed the instructions. Will try to add 20.04 version of xeus-cling soon.

dimitry-ishenko avatar May 08 '23 14:05 dimitry-ishenko

@dimitry-ishenko Yet another question, can clang compiled xeus-cling load gcc-compiled share lib? If not, is there a way to achieve this? Manually compile cling & xeus-cling with os-provided compiler?

qlibp avatar May 09 '23 04:05 qlibp

@dimitry-ishenko Would you please show us the way to compile cling & xeus-cling from source manually? The cling version provided in ppa supports only c++11. However, the lib I would like to use require an c++14 version.

It would be great if I could build it for my own environment

qlibp avatar May 09 '23 10:05 qlibp

@dimitry-ishenko Yet another question, can clang compiled xeus-cling load gcc-compiled share lib?

I've never tried it, but I believe so. IIRC in cling you can load shared libs with the .L command. I imagine there is a way to do that with xeus-cling as well. You might want to open another issue for this. I just do Debian packaging for xeus-cling.

If not, is there a way to achieve this? Manually compile cling & xeus-cling with os-provided compiler?

Well, both cling and xeus-cling are compiled with the OS provided compiler. Not sure I understand the question

dimitry-ishenko avatar May 09 '23 19:05 dimitry-ishenko

The cling version provided in ppa supports only c++11. However, the lib I would like to use require an c++14 version.

cling 0.9 in my PPA supports whatever Clang 9 does, which is up to and including c++17. I did have issues with using std::filesystem classes though.

Peek 2023-05-09 15-14

dimitry-ishenko avatar May 09 '23 19:05 dimitry-ishenko

Here is a c++17 example:

Peek 2023-05-09 15-24

dimitry-ishenko avatar May 09 '23 19:05 dimitry-ishenko

@dimitry-ishenko Would you please show us the way to compile cling & xeus-cling from source manually?

It's pretty much a matter of running cmake followed by make. That's about it. The only thing is, cling depends on a patched version of LLVM/Clang 9.

Maybe if you tell me what you are trying to accomplish and I will see if I can help you?

dimitry-ishenko avatar May 09 '23 19:05 dimitry-ishenko

@qlibp also check out issue https://github.com/jupyter-xeus/xeus-cling/issues/87 which tells you how to load 3rd party shared libs.

dimitry-ishenko avatar May 09 '23 19:05 dimitry-ishenko

@qlibp there is now Ubuntu 20.04 version of xeus-cling in the PPA. You can give it shot

dimitry-ishenko avatar May 09 '23 22:05 dimitry-ishenko

The cling version provided in ppa supports only c++11. However, the lib I would like to use require an c++14 version.

cling 0.9 in my PPA supports whatever Clang 9 does, which is up to and including c++17. I did have issues with using std::filesystem classes though.

Peek 2023-05-09 15-14

@dimitry-ishenko Thanks for your demonstration. It's my bad. I even don't know how to enable cling to use c++14!

Hint, just type in __cplusplus, cling will return the c++ standard it's using.

Also, another question, if we use std=c++14, I guess we could still load c++11-compiled share libs?

qlibp avatar May 10 '23 00:05 qlibp

@dimitry-ishenko Would you please show us the way to compile cling & xeus-cling from source manually?

It's pretty much a matter of running cmake followed by make. That's about it. The only thing is, cling depends on a patched version of LLVM/Clang 9.

Maybe if you tell me what you are trying to accomplish and I will see if I can help you?

@dimitry-ishenko In my situation, I would like to use cling + xeus-cling to set up my ROS env(a robotics eco-system). And most of their packages are delivered through apt(i.e. debian pacakge) relying on os-packed gcc compiler. I'm not pretty sure if those gcc-compiled packages can be loaded with the clang-compiled cling(correct me if I misunderstand how cling & xeus-cling is built, i saw you use the llvm toolchain so i assume that all these stuffs are built with clang). I will try it out today and see if this could work out.

If the gcc-compiled debian packages can't be loaded by clang-compiled cling, then I guess i need to use the os-packed gcc toolchain to built cling & xeus-cling in order to enable my workflow

qlibp avatar May 10 '23 00:05 qlibp

@qlibp there is now Ubuntu 20.04 version of xeus-cling in the PPA. You can give it shot

@dimitry-ishenko

Q1: it's weird that when I apt-get install xeus-cling, it told me that unable to locate package xeus-cling though i could see it in the weblink. A1: OK, searching around the apt-cache, I figure out the correct package name apt-get install xeus-cling-dev but not apt-get install xeus-cling

Q2: But I could not find out the xcpp kernel executable? A2: apt-get install xcpp

qlibp avatar May 10 '23 01:05 qlibp

Also, another question, if we use std=c++14, I guess we could still load c++11-compiled share libs?

@qlibp AFAIK there is no ABI changes between c++11 and c++14, so you should be fine.

Q1: it's weird that when I apt-get install xeus-cling, it told me that unable to locate package xeus-cling though i could see it in the weblink. A1: OK, searching around the apt-cache, I figure out the correct package name apt-get install xeus-cling-dev but not apt-get install xeus-cling

Q2: But I could not find out the xcpp kernel executable? A2: apt-get install xcpp

That's right you just need to install xcpp to use the kernel in jupyter.

dimitry-ishenko avatar May 10 '23 03:05 dimitry-ishenko

In my situation, I would like to use cling + xeus-cling to set up my ROS env(a robotics eco-system). And most of their packages are delivered through apt(i.e. debian pacakge) relying on os-packed gcc compiler. I'm not pretty sure if those gcc-compiled packages can be loaded with the clang-compiled cling(correct me if I misunderstand how cling & xeus-cling is built, i saw you use the llvm toolchain so i assume that all these stuffs are built with clang). I will try it out today and see if this could work out.

@qlibp both cling and xeus-cling (which simply uses libcling under the hood) are compiled using gcc that comes with Ubuntu. cling does use LLVM/Clang 9 to interpret your c++ code, but you should still be able to link with other shared libs installed in the system.

dimitry-ishenko avatar May 10 '23 04:05 dimitry-ishenko

In my situation, I would like to use cling + xeus-cling to set up my ROS env(a robotics eco-system). And most of their packages are delivered through apt(i.e. debian pacakge) relying on os-packed gcc compiler. I'm not pretty sure if those gcc-compiled packages can be loaded with the clang-compiled cling(correct me if I misunderstand how cling & xeus-cling is built, i saw you use the llvm toolchain so i assume that all these stuffs are built with clang). I will try it out today and see if this could work out.

@qlibp both cling and xeus-cling (which simply uses libcling under the hood) are compiled using gcc that comes with Ubuntu. cling does use LLVM/Clang 9 to interpret your c++ code, but you should still be able to link with other shared libs installed in the system.

Cool, thanks for correcting me! So down to earth, cling&xeus-cling and all their dependencies(including llvm/Clang libs) are compiled with gcc?

So, down to earth, the c++ code is translated into some middle level language by llvm and finally follows the gcc abi to translate it into the binary?

qlibp avatar May 10 '23 05:05 qlibp

@qlibp

Cool, thanks for correcting me! So down to earth, cling&xeus-cling and all their dependencies(including llvm/Clang libs) are compiled with gcc?

Correct.

So, down to earth, the c++ code is translated into some middle level language by llvm and finally follows the gcc abi to translate it into the binary?

Also correct. Watch me link against a GUI library called Qt and create a blank window straight from cling:

Peek 2023-05-10 10-44

dimitry-ishenko avatar May 10 '23 14:05 dimitry-ishenko