Archive for July, 2010

Muggles

Hey, I didn’t know that “muggle” was in the Jargon File… Apparently it has been there for quite a while too (since version 4.2.2, which came out in 2000). Never noticed it… maybe I should read up on it some more.

:: Comments off

Dependency hell, how I missed thee.

[semi-rant]

It’s one of those days again. I am trying to install fish on my iBook G3. The laptop is ancient, but it runs Tiger and MacPorts and has the latest XCode, so there really should be no problem. Yet there is. The MacPorts version of fish seems to think it needs all kinds of graphical libraries… cairo, libtiff, freetype, and much more, none of which I need for a command line shell. Needless to say, at some point installation chokes on one of these libraries or another. Is there a way to tell MacPorts that I just want the text mode version? Who knows? It’s easy to use when everything goes right, not so much when things go wrong.

So, I figured I’d download the fish source, and compile it “by hand”. That might have worked elsewhere, but not here. I don’t even get to the compilation stage, because ./configure complains that there is no libiconv present, and this is a requirement to build fish, so it stops unceremonially. Problem is, I have four different versions of libiconv sitting on the blasted machine. Four! Three via MacPorts, one I compiled and installed manually. And it somehow can’t find any of them?!

This kind of dependency hell happens all the time, and is the main reason why I am interested in trying GoboLinux. It’s just not fun anymore when you have to wait for hours while the system attempts to fetch, build and install a gazillion dependencies and then chokes somewhere, with no obvious reason as to why it did so, or what can be done about it. I’m not sure if Gobo fixes all these issues, but if it can alleviate them even just a bit, it’s worth it.

(To be fair, fish does install without problems, using MacPorts, on my MacBook Dual Core. But with other packages, I have just as many problems on that machine, if not more. Plus, you get the nice “oh, you have x86_64 libraries installed, but I only accept i386/universal/whatever” (or some variant thereof) error messages.)

I would love a system where these things “just work” and where you don’t have to dive into all the gory details of a library you’re not even remotely interested in, but that somehow indirectly is required to install the software you do want. I mean, this *is* a Mac right?!

:: Comments off

vi, again

I’m in the process of reorganizing a few things here. Development-related things. One of the changes I want to make is to make more use of vi for editing.

I’ve been using (several variants of) vi since the mid-90s (in addition to other editors), but by some definition you could say that I’ve never really used it. What I’ve been doing is trying to make it work like most mainstream editors, with a few commands thrown in. You know, moving through text using the cursor keys, selecting things by holding Shift, etc. Vim makes this particularly easy. But by doing so, I’ve never really experienced the real power of vi.

Some people argue that this is not optimal, to say the least:

Turns out, this is just a completely wrong way to use vi or vim. Using vi/vim properly, you don’t use it modally. You are always in normal mode, and only enter insert mode for short bursts of typing text, after which you press <Esc> to go to normal mode.

So it may be worth exploring that. Fortunately vi clones are available for pretty much every operating system, so if I want to I can use it on Windows, Mac OS X and Linux. The learning curve may be steep, but it’s probably worth it.

What I do wonder is, is there any reason to use a different version than vim? There are other clones; nvi, elvis, to name a few, but it seems like those haven’t been updated in years. Vim seems to be the 800-pound gorilla of vi implementations, and it’s not hard to see why, given its abundance of features, and the fact that it’s being actively developed.

:: Comments off

Building Io on Mac OS X

Io has a new build system. Questions aside whether it’s an improvement or not, I did find that it wasn’t completely obvious to use. Eventually I did get it to work; I’ll describe the process here.

  • Make sure you have a recent version of git installed. I had 1.5.x or so and it failed to clone the Io repository correctly, quitting halfway with vague errors. 1.7.1 works fine; older versions might too, but if you encounter problems during checkout, you should probably upgrade.
  • Also, should you be using Mac OS X 10.4 still (as I do on my G3s), then make sure you have the most recent XCode installed. For Tiger, this is XCode 2.5, which can be downloaded from the Apple site. (Login required, so no link.) (Of course, even if you’re using 10.5 or 10.6, it’s still a good idea to have the latest XCode.)
  • To use the new build system, you’re also going to need cmake (which can be fetched from MacPorts, for example).
  • Check out the latest version from the github repository. Just do a git clone; alternatively you could fetch the 2010.06.06 tag from the downloads page, but this contains the previous build system, for which most of these instructions don’t apply. (Note that this tag might still come in handy if the new build system doesn’t work for you…)
  • Once cloned, you should have a directory called io. Edit io/addons/CMakeLists.txt in your favorite editor. You’ll see a whole bunch of lines like this: add_subdirectory(Foo). These are the addons that will be (attempted to be) built. Comment all of them out.
  • Now run ./build.sh. Since all the addons are disabled, this should build the Io VM only. It *should* complete with no errors on OS X 10.5 and higher. On 10.4, there’s a good chance that gcc will choke since it doesn’t know what an “ulong” is. If that happens, edit io/libs/coroutine/source/power-ucontext.h and add a typedef near the top, like this. (There may be better ways to do this, but for now it will allow us to proceed.) Run ./build.sh again after the code change.
  • If all went well, now run sudo ./build.sh install, which should install the Io VM. Run io from the command line to see if it works. (The build date will still be listed as “20090105″, by the way.)
  • If everything works, you can now add and install addons, one by one (or multiple at once if you’re feeling adventurous). Some of them require third-party libraries to be installed (e.g. zlib, libevent, etc.) As far as I can tell, you’re pretty much on your own to figure out which libraries are needed, although there might be some clues in the source. If you use MacPorts, this is a good time to do a sudo port selfupdate, then install the required libraries before you try to install the addons. To try and install one, go to io/addons/CMakeLists.txt again, uncomment the addon of your choice, and rerun ./build.sh. If all goes well, there will be no error message and in the output you should see the addon mentioned (for example, when building the Python addon, you should see “IoPython” listed in the output). If things build properly, don’t forget to do a sudo ./build.sh install again.
  • Update 2011-01-11: If you specify an addon which cannot be built, the entire build will not fail; rather, the failing addon will be skipped more or less gracefully, and sometimes a helpful message is displayed. For example, to build the Regex addon, you’ll need libpcre; I didn’t have it installed on this machine, and near the top of the build output I saw “checking for module ‘libpcre’” and “package ‘libpcre’ not found”. Also, notice that in some cases, addons depend on other addons. In the case of Regex, it needed Range to be installed, so I uncommented that as well in CMakeLists.txt.
  • If an addon doesn’t build correctly, you can take a look at the files in io/build/addons/name-of-addon, or io/addons/name-of-addon, which may provide some clues as to what is needed, in addition to the output of make.

That’s it! It’s a bit of work, admittedly… although I’ve seen worse. (As usual, I find that installing some of the addons is a pain, not because of Io or the build system, but because of dependency hell, version conflicts, MacPorts issues, etc. I guess it can’t be helped.)

Hope this will be of use to someone… anyone… Also, if you know more about the build system, and have tips or corrections, feel free to leave a comment below.

:: Comments off