Appendix A. Obtaining, building, and installing gnuplot

The easiest way to install gnuplot on your local computer is to download and install a precompiled package. If you’re running Linux, there’s a good chance gnuplot is already installed; if not, you’ll have no difficulty finding an RPM or Debian package on the internet. There are MacPorts packages for Mac OS X and precompiled binaries for Windows as well. In section A.3, we consider some of these options in more detail.

If you’d like to be totally up to date and have access to the newest features, or if you want to start hacking on gnuplot yourself, you’ll have to build from source. Section A.4 in this appendix will help you get started.

A.1. Inspecting compile-time options

You can inspect what compile-time options your version of gnuplot was built with from within a gnuplot session. The pertinent commands are show version and show version long. The first version will tell you little more than the version number, but the second version will also print the compile-time options to the screen. A - prefix indicates an option that is disabled, a + prefix one that is enabled.

Most of this information is primarily relevant if you’re building gnuplot from source yourself (see section A.4) or if you want to report bugs to the gnuplot developers’ mailing list ([email protected]). But even if some feature doesn’t work as expected, it may be worth checking whether your gnuplot executable was built with support for that feature to begin with.

A.2. Release and development versions

Gnuplot versions are generally labeled with a three-part version number indicating major, minor, and bug-fix releases. Bug-fix releases are prepared as needed (roughly twice a year). Minor releases introduce new features but preserve backward compatibility for existing gnuplot command scripts. Major releases may break backward compatibility. The development version of a minor release is indicated by an odd version number, which is incremented to the next even number on promotion to a released version.

Gnuplot is a mature project—for the 5.x.x major release series, minor releases are a few years apart, and the core developer team is very conscientious about not introducing instability into released versions. On the other hand, new and exciting features continue to be added to gnuplot all the time, so there are good reasons for learning how to build gnuplot from source.

A.3. Installing a prebuilt package

Installing a prebuilt package is usually straightforward and mostly dependent on your choice of package manager.

A.3.1. Linux

Usually, the easiest way to install new software on a Linux box is to use the standard administration tool that comes with your local Linux distribution. On RPM-based distributions, you can also download an RPM file explicitly and then install it (as root) using

rpm -i gnuplot-XXX.rpm

where you should replace gnuplot-XXX.rpm with the exact name of the package file you’ve downloaded. RPM files for current gnuplot releases can be found without difficulty on the web.

On Debian-based systems, you can execute the following:

apt-get install gnuplot

But be warned that there are reports that gnuplot for Debian-based systems is often built without the GNU readline library (due to strict interpretations of the differences in the GNU and the gnuplot licenses), so you might want to build gnuplot from source instead.

A.3.2. Mac OS X

The most convenient way to install gnuplot on Mac OS X is to use a package manager, such as Homebrew or MacPorts, which will automatically deal with configuration issues and resolve dependencies.[1] Assuming you already have Homebrew installed, you can install gnuplot by entering the following command in the Terminal:

1

I’d like to thank Mojca Miklavec for help with this section.

brew install gnuplot

If you’re using MacPorts, you type

sudo port install gnuplot

The latter will prompt you for your password, which you need to enter. Once gnuplot has been successfully installed using either method, you can run it by issuing the command gnuplot in the Terminal window.

Be aware that a choice of build options is available when installing gnuplot, in particular with regard to the selection of terminals that will be included. The MacPorts distribution, for example, includes AquaTerm and the cairo-based terminals (including the wxt terminal) by default, but not the qt terminal.

A.3.3. Windows

The easiest way to install gnuplot on Windows is to use the precompiled package available from the download section of the gnuplot website at www.gnuplot.info.[2] At the time of this writing, the most recent version available was gnuplot 5.0.1. Download the file gp501-win64-mingw.exe, and execute it. The package works with the Windows installer, which takes care of things like permissions and menu entries.

2

I’d like to thank Bastian Märkisch for help with this section.

No further installation is required. To run gnuplot, select the entry in the Start menu. A new window will pop up, containing the familiar gnuplot command prompt. The window has some additional menus that provide shortcuts to many of the gnuplot commands.

The bin directory contains additional gnuplot executables, which are intended to emulate Unix pipes and files necessary to run the qt and wxt terminals on Windows. Refer to the README-Windows.txt file for additional details.

A.4. Building from source

If you want to build gnuplot from source, you have two choices: either you can download and build an officially released version of gnuplot, or—if you want to be truly on the cutting edge—you can download and build the latest development version. Released versions of gnuplot can be downloaded as source tarballs from the gnuplot home page at www.gnuplot.info. There, you can also find precompiled binaries for several non-Unix platforms.

A.4.1. Obtaining the development version from CVS

The development version of the gnuplot source tree is kept in CVS at www.source-forge.net. To get a copy of the development version from the repository, follow these steps:

1.  Create a directory on your local drive, and change into it. You can name it any way you like.

2.  Log in to the CVS repository:

cvs
-d:pserver:[email protected]:/cvsroot/gnuplot
login

Press Enter when you’re prompted for a password. (This step is only necessary the first time around.)

3.  Check out the source tree:

cvs
-d:pserver:[email protected]:/cvsroot/gnuplot
checkout gnuplot

You may want to set the environment variable CVSROOT to

:pserver:[email protected]:/cvsroot/gnuplot

(How you do this depends on the shell you’re using.) If CVSROOT is set, you don’t need to repeat the cvs-directory as part of the CVS command line using the -d option.

The checkout command creates a directory called gnuplot in the current directory. We’ll examine its contents next.

A.4.2. Layout of the source tree

Whether you downloaded and unpacked a tarball of a released version or checked out the current development version from CVS, you should now have a directory called gnuplot (or similar) on your local drive. Inside this directory, you’ll find the following (I’m listing only the most important files and directories):

  • config/— Files required by the automake/autoconf utility, which is used to configure the build process to the local environment.
  • demo/— A large set of gnuplot demos and the data files required by them.
  • docs/— Source files for the gnuplot reference documentation. Documentation for gnuplot is maintained in a markup language that’s specific to gnuplot. Help files in common formats (HTML, TeX, GNU Info, and so on) are built from the master file (called gnuplot.doc), as is the gnuplot online help feature. You can find an explanation of the markup format in the README file in the docs/directory.
  • src/— The source tree.
  • Copyright— The gnuplot copyright and license.
  • INSTALL— Gnuplot build and installation instructions. Very detailed.
  • INSTALL.gnu— Documentation for the GNU autoconf/configure utility.
  • NEWS— Overview of new features, changes, and fixes in the current version of gnuplot.
  • README— The overall gnuplot Readme file.
  • RELEASE_NOTES— A rather detailed overview concerning the new features in the current version, bugs and limitations, and important configuration options.

A.4.3. Building and installing

Specific build instructions are platform dependent. Because of the great variability of Unix platforms, the instructions for building on Unix are the most complex.

Unix

Building gnuplot from source on Unix requires that the standard Unix development tools are installed. In addition to a C compiler and make, this also includes the auto-conf/automake utility, which is used during the configuration step to probe many aspects of the local build environment and to create a localized Makefile. Building is then a rather painless process using make.

Configuring

When building from source, it’s necessary to set up your build script first. To do so, change into the gnuplot directory and execute ./prepare. This creates a script called configure. (This step is only required when building the development version of gnuplot; the release versions already include a usable configure script.)

In either case, execute ./configure in the gnuplot directory. The configure script takes a large number of command-line options. You can obtain a complete list using

./configure --help

Many of these options are described in detail in the INSTALL file. Here, I mention just the ones that you’ll most likely want to tinker with. For the majority of options, the defaults are fine:

  • --prefix=PREFIX—This controls where the gnuplot executable, library, and documentation files will be installed. The default is /usr/local. If you don’t have root permission on your box, or if you’d like to maintain a local version of the development version, you may want to provide a different path here. There are many more options that control the installation location of executable, library, and documentation files independently. Check the INSTALL file for details.
  • --with-readline—Gnuplot comes with its own minimal version of a readline library (which provides command-line editing capabilities, command completion, and a history feature). You can select this version using --with-readline or using --with-readline=builtin (this is the default). If instead you’d like to use the more powerful GNU readline library, use --with-readline=gnu, or --with-readline=DIR, where DIR is the path to a (nonstandard) directory containing the GNU readline library. Note that the GNU readline library is released under a different license than the rest of gnuplot.
  • --with-wx=DIR—The location of wx-config, the wxWidgets configuration program. This is important if you want to include support for the wxt terminal.
  • --with-qt—This determines whether gnuplot will be built with support for the qt terminal, and which version of qt to use. If you select --with-qt=no, the qt terminal won’t be supported; other possible values for this option are qt4 and qt5.

The configuration step produces a long list of output describing the local environment that will be used during the build process. It’s worth skimming this output: if the configuration utility doesn’t seem to find libraries that you know are available, you may have to change some of the defaults using additional command-line options described in the INSTALL file. Libraries required for some of the terminals are occasionally not found, which means you need to override the search paths by tweaking the corresponding command-line options to configure.

Also be aware that you’ll need the devel packages for many of the required libraries if you want to build gnuplot from source, not just the release packages. In particular, the packages required for the wxt, cairo, and pango libraries may not be installed on your local system by default.

Building and installing

If the configuration step has completed successfully, building gnuplot is very simple: execute make from within the gnuplot directory. Compilation (on a reasonably current system) takes only a few minutes.

If the compilation was successful, execute make install to install the gnuplot binary, its documentation, and any required auxiliary files into the specified locations. You may want to follow this with make distclean to remove many of the temporary files left over from the build process.

Windows

Gnuplot can be built on Windows using a variety of compilers. A major challenge when building on Windows is resolving the dependencies on external libraries. Check the INSTALL file for more information.

Mac OS X

To build gnuplot on Mac OS X, you should have the Xcode development environment installed: the build process is then essentially the same as for other Unix platforms. You may also want to have AquaTerm installed, which you can obtain through a package manager or directly from SourceForge (http://aquaterm.sourceforge.net).

To include support for cairo and wxt, you must have the cairo and pango libraries installed already. See the INSTALL file for details.

Also, there have been reports of problems with the readline library that ships with Mac OS X. You may want to fall back to gnuplot’s own (minimalistic) version of the readline library: ./configure --with-readline=builtin; or replace the default library with the GNU readline version before building.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.245.1