Sunday, August 11, 2013

Building OCaml programs in Cloud9 IDE

Cloud9 IDE is one of several new cloud-based products providing the ability to edit, build, test, and deploy code through a collaborative web application. Cloud9 IDE has one especially powerful feature: each workspace (i.e. project or repo) has a Linux home directory persisted along with the code and other settings, and you get a full bash terminal in this directory with modest but usable resource limits. This means it's possible to install and use a full OCaml toolchain inside, much like my previous effort on Travis CI.

I prepared a script to automate the process of installing OCaml and OPAM inside a Cloud9 IDE workspace. Enter into the terminal in any workspace:
curl -L | bash -ex
eval $(opam config env)
The OCaml toolchain and OPAM are then ready to go. Here's a screenshot of compiling and running 'Hello, world!':

OCaml syntax highlighting was already built-in, interestingly enough. A more elaborate example, where I used the site's GitHub integration to import ForkWork and ran the unit tests, which need OPAM packages like oasis and kaputt.

Some difficulties I encountered:
  • The script builds the OCaml toolchain from source, which takes a solid 15-20 minutes for each new workspace.
  • I couldn't immediately figure out a way to create binary packages due to some coincidental quirks: various OCaml binaries seem to be tied to the absolute installation path specified by their build configuration, while in Cloud9 IDE we can't write outside of the workspace home directory, the path of which is workspace-specific.
  • Meanwhile there's some kind of nix-based package manager going on, but I couldn't find a way to extend it.
  • Native-code camlp4 (make camlp4opt) doesn't successfully compile in the workspace; I'm not sure why, but perhaps it's the RAM ceiling. The c9-ocaml script jumps through some hoops to install the bytecode but not native-code version of camlp4, while installing both versions of the other tools.
Cloud9 IDE seems to have been originally designed for front-end and non-compiled back-end (Node.js, Rails, Django, etc.) development, and some typical IDE features for compiled languages are lacking. Improvement here is hopefully on their roadmap since it's touted by one of their competitors. That stated, the existing feature set is quite comparable to my lightweight Sublime/xterm flow.

I'd also like to see Cloud9 IDE provide an option to provision root access in a VM/cloud instance (as in Travis CI) or LXC container (as in Heroku, and here at DNAnexus), enabling full access to mainstream package repositories like apt. There appears to be an existing option in their premium tier where their back-end can ssh into some machine the user sets up herself, but it would be far more convenient to provide an elastic pool of VMs.


  1. Very interesting, I was about to check various Web IDE to see if any support OCaml. Cloud9 seems like a nice option...

    Does it do some kind of code completion and auto-indenting ?

    Do you know if it is possible to extend through plugin to implement this kind of missing feature ?

  2. Great stuff!! I am glad that you shared very helpful information. Keep up the good work and I am looking forward to visit more of your posts. Many thanks for sharing this content. Quickbooks File Restore

  3. Is this the right tool to help me? The research hasn’t yet shown that stand-alone therapy online or via texting is effective for everyone in every situation. Some sites advertise that they offer therapy, but those claims may be misleading or false. For example, the people behind the apps may not be licensed or qualified to provide therapy.

  4. Your computer you can meet really many single women best married dating sites whose desire to start a family coincides with yours.

  5. We are picky when it comes to hiring writers. Creating a decent college-level paper requires a whole set of research and writing skills as well as plenty of time. While students might not have all of the above, our qualified writers specialize in creating custom academic content within short deadlines.

  6. Hey everyone! I like this post! Our paper writer service thrive in excellence and 100% customer satisfaction through quality services. No need to worry about submitting low-quality essays to your tutor.

  7. We guarantee good results and personal information privacy which is not offered by many custom essay writing companies these days essay writer. Return policies and re-writing is also refurbished upon the client’s request.

  8. Every paper writer online is a professional. There’s experience, educational background, special training, and a natural knack for writing papers. With mostly positive customer reviews and feedback, it’s safe to recommend this service to everyone interested in legit custom compositions.

  9. It takes a lot of time to complete the writing of an essay on your own, you need to pick up good material and for this to shovel a bunch of literature. For which I certainly had no strength or desire. I decided to turn to specialists in such matters paper writer serviceI came across this service quite by accident, and there was no time to choose. And it's good that it is. I found an excellent service that did an excellent job with their task. Now, henceforth, only to them for help.

  10. Hi! On the off chance that you're looking for writing service, where you'll get proficient offer assistance - contact those guys

  11. MBA Assignment Help

    Get MBA Assignment Help at Latrobe University with Punjab Assignment Help at an affordable price and timely delivery. We have Experts on the team.

    MBA Assignment Help