Building YouCompleteMe on Vim 7.4 in Ubuntu Trusty (32 bit)

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.

The problem

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:

./ --clang-complete

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 llvm-toolchain-trusty main
deb-src llvm-toolchain-trusty main
# 3.5 
deb llvm-toolchain-trusty-3.5 main
deb-src llvm-toolchain-trusty-3.5 main
# 3.6 
deb llvm-toolchain-trusty-3.6 main
deb-src 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:

./ --clang-complete --system-libclang

You should see everything build.

Good luck.

This entry was posted in Vim.

5 Responses to Building YouCompleteMe on Vim 7.4 in Ubuntu Trusty (32 bit)

  1. Barrett Strausser says:

    Excellent guide.

    Any experience with the following error

    Your C++ compiler supports C++11, compiling in that mode.
    Using libclang to provide semantic completion for C/C++/ObjC
    Using external libclang: TEMP-NOTFOUND
    CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
    Please set them or make sure they are set and tested correctly in the CMake files:
    linked by target “ycm_core” in directory /home/ubuntu/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm

    I’m on 14.04 but I’m running on an NVIDIA Tegra cuda board so I have an added extra bit of challenge.

  2. Michael says:

    Thank you so so much for your excellent guide.

    I had compiled YCM for almost 10 times earlier this month and read the doc and other information again and again.

    Fortunately, I read your blog, try your method to add the LLVM PPAs to apt and install the “qualification branch” of LLVM and it works!!

    Besides, the command “./ –clang-complete –system-libclang” does not work for me. I follow the Full Installation Guide and use “cmake -G “Unix Makefiles” -DUSE_SYSTEM_LIBCLANG=ON . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp”. That’s amazing!

    Finally I use vim with YCM!

Leave a Reply

Your email address will not be published. Required fields are marked *