Sunday, January 24, 2010

Recipe 13: Make Pretty Graphs

(This post is one of a series that upadates Chad Fowler's Rails Recipes.)

The main difficulty I encountered with this recipe was figuring out everything that needed to be installed to make it work. One of the difficulties is that upstream configuration choices must be made so that downstream compilations are successful. Here are the steps I found necessary on Ubuntu:

  1. Install jpegsrc. This library is available from www.ijg.org. The instructions tell you that if you want to build from this library, you should execute make install-lib and copy some of the header files to /usr/local/include. I found that copying the files was necessary.

  2. Install libpng. Available from www.libpng.org.

  3. Install ImageMagick from source. It is available at www.imagemagick.org. For this to work, though, it must be configured in a special manner. The necessary configuration command is:
    ./configure --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8
    Then one does a standard sequence of commands:
    • make
    • make check
    • sudo make install
    The advanced ImageMagick Linux installation instructions suggest that you might require the following command:
     sudo ldconfig /usr/local/lib
    This seems to be necessary.

  4. Install the rmagick gem.

  5. Install the gruff gem.

Only one other minor change was needed to make the recipe work. The graph_controller.rb needs the addition of the line

require 'code_statistics'

No comments:

Post a Comment