How to compile gnuplot on MAC os X 10.9 (Mavericks)

Introduction

This document describes how to compile gnuplot on Mac OS X 10.9 (Mavericks) including Gif and Jpeg support.

gnuplot homepage is http://www.gnuplot.info/

Prerequisites

The following packages I used to compile  gnuplot-4.6.4 are the following :

– fontconfig-2.11.0

– freetype-2.5.2

– jpeg-9a

– libgd-2.1.0

– libpng-1.6.9

– pkg-config-0.28

– readline-6.2

– zlib-1.2.8

N.B. Indicated versions correspond to the latest at the time I compiled it but you may use other version.

Compiling the prerequisites

The first time I tried to compile gnuplot, I had the following error:

Compiling Readline

– Create a folder that you will use to store this library (for instance /Users/<Your login name>/local) and copy readline tarball in it
(except /usr/local that hosts the Max OS X version)
– Extract the tarball in the folder you just created
$ cd /Users/<Your login name>/local
$ tar zxvf readline-6.2.tar.gz
– Modify shlib Makefile
$ cd readline-6.2
$ vi shlib/Makefile
Modify variable from “SHOBJ_LDFLAGS = -dynamic” to “SHOBJ_LDFLAGS = -dynamiclib”
$ cd ..

– Compile and install the library
$ ./configure  –prefix=/Users/<Your login name>/local
$ make
$ make install

Compiling Pkg-config
– Copy the package in a temporary folder and extract the tarball

– Compile and install the package
$ ./configure –with-internal-glib
$ make
$ sudo make install
Compiling fontconfig, freetype, jpeg, libpng and zlib

For each package:

– Copy the package in a temporary folder and extract the tarball

– Compile and install the package
$ ./configure
$ make
$ sudo make install
Compiling Libgd:
– Copy the package in a temporary folder and extract the tarball

– Compile and install the package
$ ./configure –with-png=/usr/local –with-zlib=/usr/local –with-freetype=/usr/local –with-jpeg=/usr/local
$ make
$ sudo make install

Compiling gnuplot 4.6

– Copy the package in a temporary folder and extract the tarball

– Compile and install the package
$ ./configure –with-readline=/Users/<Your login name>/local –with-gd=/usr/local
$ make
$ sudo make install
You must install Xquartz in order to display graphs in x11 terminal (X Window System is no longer provided with Mac OS X).

Error you may encounter

The first time I tried to compile gnuplot, I had the following error:

…..
Undefined symbols for architecture x86_64:
“___sincos_stret”, referenced from:
…..
I finally found that it was because Xcode didn’t have the 10.9 SDK (I was using Mac OS X 10.8 before).
I upgraded Xcode from 5.0 to 5.0.2 and checked that Mas OS X 10.9 SDK was installed.
I was then able to compile gnuplot.

How to compile gnuplot on MAC os X 10.9 (Mavericks)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.