Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
901 stars 98 forks source link

irony server installation #543

Closed kilokon closed 4 years ago

kilokon commented 5 years ago

0

Irony install server yeilds this error every time i try an installation. Clang requirements are all installed. Can i be helped about what I'm missing here.

Can someone please help me out. -- mode: compilation; default-directory: "/tmp/build-irony-server-1.3.1/" -- Compilation started at Sat Jul 6 08:23:45

cmake -DCMAKE_INSTALL_PREFIX\=/home/aviik/.emacs.d/irony/ /home/aviik/.emacs.d/elpa/irony-20190703.1732/server && cmake --build . --use-stderr --config Release --target install -- The C compiler identification is GNU 6.3.0 -- The CXX compiler identification is GNU 6.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at /usr/lib/llvm-9/lib/cmake/clang/ClangTargets.cmake:581 (message): The imported target "clang_shared" references the file "/usr/lib/llvm-9/lib/libclang_shared.so.9" but this file does not exist. Possible reasons include:

"/usr/lib/llvm-9/lib/cmake/clang/ClangTargets.cmake"

but not all the files it references. Call Stack (most recent call first): /usr/lib/cmake/clang-9/ClangConfig.cmake:19 (include) src/CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred! See also "/tmp/build-irony-server-1.3.1/CMakeFiles/CMakeOutput.log".

CMakeOutput.log

Sarcasm commented 4 years ago

What is your OS/distribution? Looks like a packaging issue to me.

kilokon commented 4 years ago

i'm using Debian GNU/Linux 9 (stretch)

Sarcasm commented 4 years ago

I will try to invoke @sten0 then, maybe he can share some expertise as he packaged irony-mode for Debian.

Irony uses find_package(Clang) to detect the official CMake targets exported by the LLVM/Clang project itself. The file is found: /usr/lib/llvm-9/lib/cmake/clang/ClangTargets.cmake But the targets it references aren't found.

From my point of view, it looks like either a packaging issue, or an upstream issue.

sten0 commented 4 years ago

@Sarcasm, I've never seem this particular failure case before during migrations of libclang release candidates, but Debian's CI has caught failures with prereleases; they were resolved when the final llvm/clang release was packaged.

@aviikc, where are you getting your libclang? If you're using Debian packages from experimental you should know that they [won't] work properly on stretch (oldstable)...that's considered "frankenDebian" (I think the article title is "don't break Debian") and will often break [and is completely unsupported]. You would have a better chance of success by doing a formal backport of llvm/clang (local only, because it violates backports policy and can't be uploaded to Debian archives) and installing those packages. I also have to mention that I've never tested installing two different libclang versions from experimental onto sid (or buster). Eg: if you want to target libclang-9-dev, don't install libclang-dev, because that pulls in libclang-8-dev from sid.

Honestly I will be swamped with work for the next two to three weeks, so please ping me then if I seem slow to reply. Sorry I can't be more helpful at the moment...

sten0 commented 4 years ago

P.S. links to packages https://packages.debian.org/search?keywords=libclang&searchon=names&suite=experimental&section=all

sten0 commented 4 years ago

P.P.S. @aviikc, and generally speaking, packages from experimental have the greatest chance of working properly on sid. Failing that, I would recommend that you upgrade to buster (Debian 10) at this time :-) At present the delta between it and sid is still relatively small.

commander-trashdin commented 4 years ago

Having the same issue (on Debian 10). I also have clang-8 installed.

sten0 commented 4 years ago

@thrashdin, with libclang1-10 installed from the experimental suite? I just confirmed the Debian package builds successfully (including self-tests) on unstable/bullseye/sid, using its libclang-8-dev. I will not try building against Clang/LLVM 10 until it is uploaded to unstable/sid.

If you'd like to use irony-mode (official Debian packages) + clang-8 on buster (Debian 10), please send an email to the debian-backports mailing list and CC Sylvestre and myself, because this use case can be officially supported using buster-backports :-) In that email please request a backport of clang-8 and llvm-8. You'll also need to purge your installation of those packages from sid and/or experimental to step back onto the officially-supported-on-Debian path.

sten0 commented 4 years ago

P.S. After clang-8 is in-progress for buster-backports I will need to prepare an updated Debian package for sid, wait five days, and then upload to buster-backports (assuming clang-8 is in buster-backports by then)

sten0 commented 4 years ago

@Sarcasm, On a related note to the two additional lines of documentation discussed at #516, it just occurred to me that it might be worth documenting that irony-mode and irony-server via apt are tied to a specific LLVM/Clang version--that's the downside of system integration, but the upside is it those packages get a lot of validation and QA.

Personally I think it's a rabbit hole to document such intro-to-sysadmin type things (eg: users should use system packages and make their peace with slightly older versions, but the onus is on them to learn how to mix custom sudo make install # installs unsupported llvm/clang to /usr/local and how to fix things when they break), and Debian/Ubuntu users should be using their respective bug trackers...

But maybe it's worth adding a line or two adding some pros and cons:

Sarcasm commented 4 years ago

I started to edit the README to add this, but honestly I'm sure people will read it that carefully, I think I prefer to keep things simple for now.

I still think something is not right with this issue.

sten0 commented 4 years ago

@Sarcasm

I still think something is not right with this issue.

As in something is not right with Debian's experimental llvm-toolchain/libclang release candidate or snapshot, and that it's not just an issue of mixing packages from incompatible Debian suites? Yeah, that's possible! That said, packages from the experimental suite are explicitly declared as not for user consumption...it's for stuff like coordinating large/complex/difficult transitions. If there is a bug there the user needs to be running sid/unstable+experimental, because stable+experimental is expected to be nonfunctional.

Speaking more directly to the error, "/usr/lib/llvm-$VERSION/lib/libclang_shared.so.$VERSION" isn't where the llvm shared libs are installed on Debian, and the build should be using one of /usr/lib/llvm-9/lib/libclang-9.so.1, /usr/lib/llvm-9/lib/libclang.so.1, or /usr/lib/x86_64-linux-gnu/libclang-9.so.1. @Sarcasm, I don't think you need to do anything on your side, unless you made cmake-related changes post irony-mode 1.3.1. Please let me know if you need me to test a build of HEAD.

@aviikc, @thrashdin, and llvm-toolchain and libclang 8 are now in buster-backports, so you now have access to the latest stable upstream release. I've confirmed irony-mode 1.3.1 (latest stable release) functions correctly with it (quick testing, I only found time today) and that package will appear in buster-backports soon (awaiting sponsored upload, plus clearing the NEW queue).

Sarcasm commented 4 years ago

@Sarcasm, I don't think you need to do anything on your side, unless you made cmake-related changes post irony-mode 1.3.1. Please let me know if you need me to test a build of HEAD.

Indeed, I made some important changes on the master branch:

I now use find_package(Clang) when available, and the data returned in this issue looks wrong to me.

In my previous comment https://github.com/Sarcasm/irony-mode/issues/543#issuecomment-509950456, I mentioned the file /usr/lib/llvm-9/lib/cmake/clang/ClangTargets.cmake. I would be curious to see if it mentions the problematic /usr/lib/llvm-9/lib/libclang_shared.so.9.

sten0 commented 4 years ago

@Sarcasm, I don't think you need to do anything on your side, unless you made cmake-related changes post irony-mode 1.3.1. Please let me know if you need me to test a build of HEAD.

Indeed, I made some important changes on the master branch:

I just built c7cca52 on unstable/sid/bullseye/11 with experimental's clang 9, as a Debian package, and all is well there. So llvm upstream or Debian packaging issues can be ruled out. irony-mode_1.3.1+12.gc7cca52-1_amd64-2019-09-11T00:44:07Z.build.txt

I now use find_package(Clang) when available, and the data returned in this issue looks wrong to me.

Agreed.

In my previous comment #543 (comment), I mentioned the file /usr/lib/llvm-9/lib/cmake/clang/ClangTargets.cmake. I would be curious to see if it mentions the problematic /usr/lib/llvm-9/lib/libclang_shared.so.9.

If it does, I couldn't find it. Here's a copy of the file from clang-9_9~+rc3-1~exp3_amd64.deb ClangTargets.cmake.txt

And here's the output of irony-install-server in sid/unstable/debian-11+libclang9-dev (from experimental)+irony HEAD from MELPA: irony-server.build.txt

I then manually tested that with ~/.emacs.d/irony/bin/irony-server parse $appropriate_filetype. That was successful.

If I've missed anything please let me know, but I'm satisfied this is a case of user error (see previous messages).

Sarcasm commented 4 years ago

This is exactly what I wanted to see verified, thank you for this complete answer. I will close this ticket now, as the initial reporter did not provide more information.

sten0 commented 4 years ago

@aviikc, @thrashdin: p.s. if you really need a pre-release experimental llvm/clang 9 or 10 on buster/Debian 10, the correct approach is to build the packages in on buster so that, for example, cmake build dependency resolution functions correctly. eg: build it from git, "dgit", or traditionally from the source package, like this:

dget http://deb.debian.org/debian/pool/main/l/llvm-toolchain-9/llvm-toolchain-9_9~+rc4-1~exp1.dsc
cd llvm-toolchain*
sudo apt install fakeroot build-essential dpkg-dev devscripts
sudo apt-get build-dep
dch --bpo    # make sure the version is prefixed ~bpo10+1 and the suite is buster-backports
dpkg-buildpackage

Of course if it doesn't work or breaks something you get to keep the pieces. ;-)

Sorry if I was harsh/blunt in past correspondences! While it's not a supported configuration, I didn't intend to discourage you from experimenting :-) The untested method above has the additional benefit of smooth upgrades to bullseye llvm/clang, due to how version are sorted https://manpages.debian.org/buster/dpkg-dev/deb-version.7.en.html