Oh, how I love documentation for open source software. In some cases it’ll get you close, or at least close enough to take things the remaining 2% of the way to completion. However, far too often it barely gets you off the ground.
YouCompleteMe is a great code-completion bundle for Vim. When it’s installed and configured and running it’s so amazing that you’ll question many of the reasons you use an IDE for development.
That said, getting the damn thing installed on a 32 bit version of Ubuntu “Trusty” will make you want to climb a tower with a high-power rifle.
What absolutely slays me about this is that the steps to get through the installation should not be mysterious, especially when the folks that respond to “why isn’t this installing” questions indignantly point users to the docs. Some of us actually read installation docs, but if the installation docs do not document our installation issues, we have to find answers elsewhere. Still, “read the docs” is the mantra, and it’s not helpful.
If you’re installing YouCompleteMe on a 32 bit installation of Ubuntu “Trusty” (14.04), you’re going to hit a roadblock when you run the following command from within ~/.vim/bundle/YouCompleteMe:
Specifically, you’re going to be told that there is no 32 bit version of clang 3.6, then you’re going to be told to read the docs about building it. Don’t bother looking for answers for this in the docs. It’ll just make you mad.
Here’s what you need to do:
Add the LLVM PPAs to apt
Go to LLVM’s apt page and scroll down until you get to the Ubuntu section. You will see a number of lines starting with “deb” and there will be no instructions about what to do with them. Re-read my opening rant about documentation for open source software, then return here.
These are “PPAs.” They need to be added to your apt configuration. As of today, here are the lines you need to be concerned with (for Ubuntu “Trusty”):
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty main # 3.5 deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5 main deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5 main # 3.6 deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main
You need to add these lines to the end of your /etc/apt/sources.list file. Any text editor will do the trick (yes, sudo will be required).
Once that’s done, run the following command:
sudo apt-get update
That will update your apt system to recognize the files in the PPAs you just added.
Install the “qualification branch” of LLVM
Back at the LLVM apt page, scroll until you get to the section titled “Install (qualification branch).” Copy/paste the first wget command to retrieve the archive signature (if you haven’t sudo‘d, you may find yourself looking at an empty line in your terminal and no command prompt. If this happens, it’s sudo waiting for your password), then copy/paste the last command that installs all of the LLVM packages. You’ll have to precede this last command with sudo. Why was that omitted? Who knows.
I guess you could do the installation piecemeal by running the second command that only installs clang and lldb and then just add the packages you want, but unless you have disk space constraints it’s probably best to just get all of it. I know for a fact that libclang will be needed in addition to clang, so go from there.
Run the YCM installation with the system libclang
Yeah, the install docs stress that you should not do this. I’m not sure why. Maybe YCM thinks everyone’s system libclang is one that shipped with the Linux distro. Don’t know, doesn’t matter. You want to use the one you just installed.
Change to your ~/.vim/bundle/YouCompleteMe directory and run the following command:
./install.sh --clang-complete --system-libclang
You should see everything build.