People at my office currently use Source Insight (sorry, can’t be bothered to put a link, just look it up in your favorite search engine) to navigate and edit our codebase which is comprised of bazillion lines of code spread across a million files. Recently, upper management heard about this wonderful tool called Eclipse (again, just search for it) that some people use and which just happens to be FREE! Also, we use QNX, and Momentics (which is a modified version of Eclipse) is used for live-debugging of systems runinng QNX, so it made sense to them that their engineers use Eclipse.

So, we got a mail from our manager asking about Eclipse, but that mail didn’t include all these other juicy details, so I just assumed that they were looking for a better editor and recommended Sublime Text 2. I didn’t recommend Emacs, which is my editor of choice, because I’m pretty sure nobody in the office would be comfortable using it. Then my manager told me why they were looking into Eclipse in the first place, but I gave hime a demo of ST2 with my Cscope plugin and he was suitably impressed, so I was tasked with bundling Cscope with ST2 to create a neat little package for everyone to try out.

I made some changes to my cscope plugin to make it show the results of a lookup in a new buffer, so that’s done with. I also wanted to see if I could get SublimeClang to work in order to provide intelligent completions. It worked well enough on my office workstation on Ubuntu 12.04, but getting it to work on Windows proved impossible (for my needs). The office codebase comes with its own compiler (qcc) and QNX-specific includes, so adding a few “-I” and “-D” statements to the ST2 project file got it up and running. At home, I wanted to get it to work with the Gameplay3D codebase, but that uses SSE4 instructions, resulting in it including Visual Studio’s ammintrin.h, which has several undefined datatypes like __m128 and __m256. I assume that these are builtins supported by MS’s VC compiler, which is how the codebase builds, but clang gets flummoxed by them. Then I looked around on the web and discovered that the latest release of clang has support for said intrinsics via its own builtins and typedefs, so building my own version of libclang_x64.dll should do the trick, right?

Wrong. Getting clang to compile static libs in Visual Studio 2010 (or VC10) is easy enough, but the shared libs build option doesn’t FUCKING WORK. The moment I start a build it spits out “unresolved external symbol” linking errors. After spending three hours trying to get the piece of shit to somehow work last night, I gave up, nuked my second installation of windows and loaded up Ubuntu 12.04. Thankfully, Nvidia seems to have cleaned up its driver installation script since the last time I tried to get Nvidia drivers to work with my GTX 460 in linux, because that proved to be relatively hassle-free.

And then, I spent another hour trying to get SublimeClang to work on my desktop. Same Ubuntu version, same ST2 version, git checkout of SublimeClang.. I couldn’t figure out what the hell was going wrong. I tried Python2.6, Python2.7.3, Python3.2, installing the thing from Package Control, installing it from git, trying it in ST3… And then, I realized that I had made one small, tiny mistake.

You see, I was checking out the repo as

git clone https://github.com/quarnster/SublimeClang

while in the README, the plugin author specifically instructs users to clone it with

git clone --recursive https://github.com/quarnster/SublimeClang

which ensures that all git submodules are checked out as well.[/facepalm]

Now that it’s up and running, it’s time to get PyMacs up and running to see if I can adapt this excellent plugin for use with Emacs. Because once you get used to keeping your hands planted on the home row of your keyboard (either in Emacs or in Vim, I’m not biased that way), it’s hard to go back to fluffy editors that want to you press Tab or Escape or - God forbid - click on stuff.