Releasing/packaging clangd

Hey Hans,

Congrats on the recent LLVM7 release!

It got me thinking about clangd, which has probably reached a level of stability/performance/features where casual users could benefit from it.
I wanted to pick your brain a little bit (feel free to redirect).

Is it true that:

  • the LLVM release scripts build clang-tools-extra including clangd
  • exactly which files go in which packages is up to the distro package maintainer

Do you have recommendations how I proceed to get clangd packaged? Should I contact existing distro package maintainers? Do we have a list?
(If I had to pick one, my top priority would be a debian package)

Any opinion on whether this should be part of an existing package (debian has clang-tools) or a separate clangd package?

cheers, Sam

BTW, Kadir noticed today that clangd is already packaged in clang-tools package and available in the new Ubuntu distributions, see:
https://packages.ubuntu.com/cosmic/amd64/clang-tools-7/filelist

(It’s also there in clang-tools-5 and clang-tools-6)

It’s named /usr/bin/clangd-7, though. Would be nice to have a /usr/bin/clangd symlink pointing to one of the “versioned” binaries

+Sylvestre, who appears to maintain clang/llvm packages for debian.

BTW, Kadir noticed today that clangd is already packaged in clang-tools package and available in the new Ubuntu distributions, see:
https://packages.ubuntu.com/cosmic/amd64/clang-tools-7/filelist

(It’s also there in clang-tools-5 and clang-tools-6)

Oh, good catch! I was looking at the clang-tools package, not clang-tools-N.(I don’t really understand debian packaging, in case it wasn’t obvious!)

It’s named /usr/bin/clangd-7, though. Would be nice to have a /usr/bin/clangd symlink pointing to one of the “versioned” binaries

I guess there’s some packaging magic needed to get that symlink…
Seems to be here: https://salsa.debian.org/pkg-llvm-team/llvm-defaults/blob/5f4f2eb04f1340a8228bda0168534dd63a199be2/debian/rules#L288-290

Sylvestre: Do we have that right? If we want a clangd symlink for the next clang-tools release, should I add one line to “rules” and send you a GitLab merge requsest?

(Sorry for the noise, or if there’s a better venue)
Cheers, Sam

+Sylvestre, who appears to maintain clang/llvm packages for debian.

    BTW, Kadir noticed today that clangd is already packaged in clang-tools package and available in the new Ubuntu distributions, see:
    Ubuntu – Error

    (It's also there in clang-tools-5 and clang-tools-6)

Oh, good catch! I was looking at the clang-tools package, not clang-tools-N.
(I don't really understand debian packaging, in case it wasn't obvious!)

No worries! :slight_smile:

clang-tools is a meta package. It will point to the "recommended" version of clang
and install the symlink.

    It's named /usr/bin/clangd-7, though. Would be nice to have a /usr/bin/clangd symlink pointing to one of the "versioned" binaries

I guess there's some packaging magic needed to get that symlink...
Seems to be here: debian/rules · 5f4f2eb04f1340a8228bda0168534dd63a199be2 · pkg-llvm / llvm-defaults · GitLab

bravo for finding the exact place :slight_smile:

Sylvestre: Do we have that right? If we want a clangd symlink for the next clang-tools release, should I add one line to "rules" and send you a GitLab merge requsest?

Corret!
I did it for you and uploaded it in Debian experimental already.

Should be also live on https://apt.llvm.org/ in the next few hours!

S

+Sylvestre, who appears to maintain clang/llvm packages for debian.

BTW, Kadir noticed today that clangd is already packaged in clang-tools package and available in the new Ubuntu distributions, see:
https://packages.ubuntu.com/cosmic/amd64/clang-tools-7/filelist

(It’s also there in clang-tools-5 and clang-tools-6)

Oh, good catch! I was looking at the clang-tools package, not clang-tools-N.
(I don’t really understand debian packaging, in case it wasn’t obvious!)
No worries! :slight_smile:

clang-tools is a meta package. It will point to the “recommended” version of clang
and install the symlink.

It’s named /usr/bin/clangd-7, though. Would be nice to have a /usr/bin/clangd symlink pointing to one of the “versioned” binaries

I guess there’s some packaging magic needed to get that symlink…
Seems to be here: https://salsa.debian.org/pkg-llvm-team/llvm-defaults/blob/5f4f2eb04f1340a8228bda0168534dd63a199be2/debian/rules#L288-290
bravo for finding the exact place :slight_smile:

Sylvestre: Do we have that right? If we want a clangd symlink for the next clang-tools release, should I add one line to “rules” and send you a GitLab merge requsest?
Corret!
I did it for you and uploaded it in Debian experimental already.

https://salsa.debian.org/pkg-llvm-team/llvm-defaults/commit/a3e61c84f6ccb55d41b4dec5461cc437d9cb4ba9

Should be also live on https://apt.llvm.org/ in the next few hours!

Thanks so much Sylvestre! I’ll try it out!

All: I think we should aim to announce clangd as stable in LLVM8 relnotes, do a blogpost etc. Seem reasonable?

We’d want to

  • get similar packaging for the most prominent other distro/OSs
  • get our docs and editor integrations polished
  • make sure we at least sanity check when the branch is cut

Hi Sylvestre,

Thanks for doing this, I was also wondering how to get that clangd link setup automatically.

I am using the Ubuntu 16.04 package from apt.llvm.org and don't see the rules file in the clang-tools package being download, and don't get a clangd symlink. Do you know if your change should automatically propagate to those packages, and if not, where should that be done?

Simon

Hello,

Not sure what happens but you can see it here now:
Index of /xenial/pool/main/l/llvm-defaults/

and the symlink is now provided:
$ dpkg -c
clang-tools_8.0-45+0~20181003144457.17~1.gbp3de5db_amd64.deb|grep
clangd
lrwxrwxrwx root/root 0 2018-10-03 16:46 ./usr/bin/clangd ->
../lib/llvm-8/bin/clangd

Hmm indeed I have /usr/bin/clangd when I install the clang-tools-8 packages.

I don't understand though, when I download the package and run the same command as you, I don't see the symlink in the output:

$ apt-get download clang-tools-8
...
$ dpkg -c clang-tools-8_1%3a8\~svn343648-1\~exp1+0\~20181003001500.1814\~1.gbpea43b1_amd64.deb

grep clangd

-rwxr-xr-x root/root 18151016 2018-10-02 23:37 ./usr/lib/llvm-8/bin/clangd
lrwxrwxrwx root/root 0 2018-10-02 23:37 ./usr/bin/clangd-8 -> ../lib/llvm-8/bin/clangd

Any idea why?

On a side note, what will happen when multiple versions of clang-tools will be installed simultaneously? Let's say in the future I install clang-tools-9, then clang-tools-8, will the second overwrite the symlink from the first one? Or will the packages of the older versions be modified to not include the /usr/bin/clangd symlink?

Thanks,

Simon

Not sure what happens but you can see it here now:
Index of /xenial/pool/main/l/llvm-defaults/

and the symlink is now provided:
$ dpkg -c
clang-tools_8.0-45+0~20181003144457.17~1.gbp3de5db_amd64.deb|grep
clangd
lrwxrwxrwx root/root 0 2018-10-03 16:46 ./usr/bin/clangd ->
../lib/llvm-8/bin/clangd

Hmm indeed I have /usr/bin/clangd when I install the clang-tools-8 packages.

I don't understand though, when I download the package and run the same command as you, I don't see the symlink in the output:

$ apt-get download clang-tools-8
...
$ dpkg -c clang-tools-8_1%3a8\~svn343648-1\~exp1+0\~20181003001500.1814\~1.gbpea43b1_amd64.deb | grep clangd
-rwxr-xr-x root/root 18151016 2018-10-02 23:37 ./usr/lib/llvm-8/bin/clangd
lrwxrwxrwx root/root 0 2018-10-02 23:37 ./usr/bin/clangd-8 -> ../lib/llvm-8/bin/clangd

Any idea why?

Yeah, my example is clang-tools
yours is clang-tools-8.

clang-tools is the meta package which will create the symlink. The actual binary is clang-tools-8.

On a side note, what will happen when multiple versions of clang-tools will be installed simultaneously? Let's say in the future I install clang-tools-9, then clang-tools-8, will the second overwrite the symlink from the first one? Or will the packages of the older versions be modified to not
include the /usr/bin/clangd symlink?

On apt.llvm.org, I am always point to trunk (modulo a few days latency).
On Debian & Ubuntu, depends when these distros are shipping.

You can still use old versions by using /usr/lib/llvm-X/bin/clangd

Sylvestre