alexmurray / ccls-snap

ccls in a snap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update to 0.20240202 (snap 112) fails to run with libclang-cpp ld error

whitty opened this issue · comments

Hi,

First, thanks for providing this snap, I've been using it happily for some time. I follow stable and today was updated to build 112 aka 0.20240202

ccls  0.20240202  112  latest/stable  alexmurray✪  classic

Thereafter ccls is failing to start with a libraries issue.

$ which ccls
/snap/bin/ccls
$ ccls --help
/snap/ccls/112/usr/bin/ccls: error while loading shared libraries: libclang-cpp.so.15: cannot open shared object file: No such file or directory

I'm primarily running this on 20.04, but have verified this also occurs on 22.04.

Let me know if there's any more information I can give you. I'm going to try to revert to the previous version I can see (90) to see if I can get myself going.

Thanks for reporting this issue and apologies if it's messed up your workflow. I'm just away from my computer at the moment but hopefully will be back online in an hour or so and will take a proper look.

I was able to reproduce the issue and have just pushed a fix for it - the snap will automatically rebuild and get published to the edge channel within an hour or two - if you could please try refreshing to this when it is available and let me know if it fixes this for you that would be great. Thanks.

Thanks for you quick response - I had just tried to have a snoop around with --shell to see what was going on, but got a surprise at how the environment is (or in this case - is not) managed in a --classic snap.

The loading environment sounds a little terrifying from reading a bit of the documentation

https://snapcraft.io/docs/classic-confinement#heading--runtime

It also says "Don't set LD_LIBRARY_PATH" which has me even more concerned.

I'd have to conjecture that there's some path hard-coding going on inside the binaries - possibly due to:

      - -DCMAKE_INSTALL_PREFIX=/usr
      - -DCMAKE_PREFIX_PATH=/usr/lib/llvm-15
      - -DLLVM_INCLUDE_DIR=/usr/lib/llvm-15/include

This stuff does my head in a little, it seems like (at runtime) the paths should be roughly /snap/ccls/current/usr/lib/... or $SNAP/usr/lib/... - but I believe I've come up against similar issues trying (and never succeeding) to package some other libraries with embedded paths.

Its possible it might work (on 22.04) if I installed those expected libraries in the expected location in the host system. Those libraries probably don't exist in 20.04.

Excellent point re setting of LD_LIBRARY_PATH - so instead we can actually just get snapcraft to set the RPATH in the ccls binary for us to find the libs - have just enabled that now so, again, in say 1 hour this should hopefully be resolved - let me know if it works for you.

Thanks - ld error seems to be resolved with build 117

Thanks for the confirmation - I've just promoted this revision to stable.