How to fix the Unbound module Graphics in an ocaml project

Image
From ~/pr/gitl/ocaml-gol In a constant effort to learn new programming languages, I'm currently trying to use ocaml , a free and open-source general-purpose, multi-paradigm programming language maintained at the Inria . It's basically an extension of Caml with object-oriented features. I'm mostly interested by its functionnal and pattern matching features but the module part of the language can be a bit difficult to understand for someone with little to none ML (Meta Language) background.   The error When trying to use the graphics module to create a graphical window and go just a little further than the simplest helloworld program, here is the result : If the project uses dune : (executable (name ocaml_project) (libraries lwt.unix graphics) ) with this code : let () = Printf.printf "Hello, world!\n";; Lwt_io.printf "Hello, world!\n";; Graphics.open_graph " 800x600";; The first times I built this project running the du

How to use sdl2 on travis-ci

If you're using Continuous Integration to improve your code quality, maybe you're using travis-ci.org to test each commit and report errors.

To build rainbrurph, I need SDL2 libraries and headers, unfortunately, the build fail with the following error message :
E: Unable to locate package libsd2-dev
This message is from apt-get which can't find the package in the repositories.

To know which distribution of GNU/Linux we're using, just look at the Buil system information of the travis-ci log :
Build system information on travis-ci

We're using Ubuntu 12.04. Next, we have to verify the availability of the library at the packages.ubuntu.com website and learn it was added on Trusty (14.04) while travis is running Precise (12.04).

To fix this issue we'll need to use a great feature of Ubuntu : ppa (for Personal Package Archives).  It's a way to populate apt-get directly from launchpad.net users work. After a quick search, I finally found a ppa using sdl2 here.

So we'll add to modify our travis-ci's before_install commands:
before_install:
- sudo add-apt-repository -y ppa:team-xbmc/ppa
- sudo apt-get update -qq
- sudo apt-get install -y  libsdl2-dev
And finally it works.

Comments

Popular posts from this blog

How to make a map of variant in C++