Pi Python Vim YouCompleteMe Plugin – Broken

Short version : YouCompleteMe vim bundle will not compile on a Raspberry Pi at the time of this writing.

However, there is a way around this problem. I did not realize, until hours into this, that there is a debian package vim-youcompleteme – good news.

apt-get install vim-youcompleteme

Another issue appears at this point (too often the case). This package uses vim-addon-manager to manage this package. I use vundle, but I can compromise. Unfortunately, vim-addon-manager is broken with my version of ruby ( I have a few installed with rvm ). One more workaround to for the system installed ruby to be used :

/usr/bin/ruby /usr/bin/vam install youcompleteme

And now, finally, it is working. I hope this post saves someone a bit of pain…

————-

Read on for other details.

Working on a project with a new Raspberry Pi 2. Python is the chosen development language for now. Goal was to get vim set up and optimized for Python. Much has changed since I was regularly using vim a few years back. Most importantly vundle a vim package manager. You can read about all of that elsewhere, the purpose of this post is to clarify the steps necessary to get YouCompleteMe to compile and install successfully on the pi.

I just upgraded to jessie (from wheezy) and had to fix several things. But issues specific to this problem are listed below.

Problem 1 : Installed vim package was not compiled with python support. On starting vim there is an error message that includes “requires python 2.x support”. Easy solution for that one, install vim-nox which does include python support :

sudo apt-get install vim-nox

Problem 2 : You need to compile / install YouCompleteMe, as per the README.md

Compiling YCM **with** semantic support for C-family languages:

cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer

Compiling YCM **without** semantic support for C-family languages:

cd ~/.vim/bundle/YouCompleteMe
./install.py

That requires several dependencies be installed on you system to continue. Including :

sudo apt-get install build-essential cmake
sudo apt-get install python-dev

But that is not the end of the story. You also need to include a flag for the system libclang on the pi, and that is in the README.md – but you really have to read it completely (as you should). You do need to make sure your libclang is newer than version 3.3. If you do, this works :

cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer --system-libclang

You can, of course avoid that if you really do not need C-family language support and as above.

Problem 3 : This is still not over. Compiling as above generates a crazy internal compiler error and crashes. What is up with that? Turns out this whole process does not play well with limited memory situations. The solution given is to force the compiler to only run one compile job at a time by setting YCM_CORES to 1 :

YCM_CORES=1 /install.py --clang-completer --system-libclang

This took a long time to compile using only one core – and went well up to 93% complete – and crashed again. This part of the problem is not currently solved – as far as I can tell. But if you read the beginning of this post – there is a way around the compiler issue.

Formatting a USB Drive in OSX

Purchased a Seagate FreeAgent 750GB USB drive today.  Now that the AirPort Extreme Base Station firmware has been upgraded to allow an attached USB drive to work with Time Machine, I thought it would be a good time to give it a try.

Plugged in the drive, fired up Drive Utility to “erase” or reformat the drive.  Errors on each and every try.  Errors such as :

“Volume Erase failed with the error:  The underlying task reported failure on exit”

and

“Disk Erase failed with the error.  File system formatter failed ”

Some googling around finally revealed the solution here.  The trick, as it turns out, is to

“Go into Partition and if you want 1 partition, just leave it at 1. However, click the Options… button underneath that Volume Scheme and select either GUID Partition Table or Apple Partition depending on if you have an Intel or PowerPC. The default (at least on mine) was set to Master Boot Record which is for Windows. I created one big partition using GUID (in my case) and then was able to go back and “Erase” it to make it Journaled and its working fine now.”

Brilliant!  Time Machine is now backing up to a drive connected to my AirPort Extreme Base Station.

Tags: