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.
- 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.
Permalink :: Comments off