Linux

From PLplotWiki
Jump to: navigation, search

Compiling plplot on GNU-Linux

Prerequisites

List of Debian/Ubuntu packages provides a list of packages needed to configure and compile PLplot successfully. The Debian/Ubuntu package names should be a rough guide for the names of required packages for other Linux distributions.

Quick recipe for building and installing PLplot from a tarball

This quick method should be relevant for most Linux users. Assume the path /home/yourname/plplot exists and is empty, and assume you have put the latest released PLplot version string into the "PL_VERSION" environment variable (as of this writing do that using "export PL_VERSION=5.9.5"). Then do the following steps:

  1. cd /home/yourname/plplot
  2. rm -rf plplot-$PL_VERSION build_dir install_directory
  3. tar -zxf plplot-$PL_VERSION.tar.gz
  4. mkdir build_directory
  5. cd build_directory
  6. cmake \ -DCMAKE_INSTALL_PREFIX:PATH=/home/yourname/plplot/install_directory \ ../plplot-$PL_VERSION >& cmake.out
  7. less cmake.out
  8. make VERBOSE=1 >& make.out
  9. less make.out
  10. make VERBOSE=1 install >& make_install.out
  11. less make_install.out

Step (1) changes your directory to the correct starting directory; step(2) removes the stale source, build, and install trees (note be careful with rm -rf since that is a powerful and potentially dangerous command); step (3) unpacks the tarball into the plplot-$PL_VERSION subdirectory of your starting directory; step (4) creates a new subdirectory where the configuration and build steps will be done; step (5) changes to that subdirectory; step (6) configures PLplot using the cmake application and captures the resulting output in the cmake.out file. (n.b. the "../plplot-$PL_VERSION" refers to the top of the source directory tree); step (7) lets you look at that captured output for any error or warning messages; step (8) builds PLplot and captures the resulting output in the make.out file; step (9) lets you look at that captured output for any error or warning messages; step (10) installs PLplot in the /home/yourname/plplot/install_directory specified in step (6) as the install prefix and captures the resulting output in the make_install.out file; and step (11) lets you look at that captured output for any error or warning messages.

To summarize, the various directories are:

  1. the source-tree with top-level directory /home/yourname/plplot/plplot-PL_VERSION
  2. the build-tree directory, /home/yourname/plplot/build_directory
  3. the install-tree directory, /home/yourname/plplot/install_directory

For more details consult the generic Unix instructions for our build system.

Other options

The Python and Java interfaces to PLplot are generated with SWIG so if you want those interfaces you must install SWIG. If SWIG is installed and cmake cannot find it, then you must help cmake out by specifying the directory where swig.swg (an important SWIG file) is located using the CMAKE_INCLUDE_PATH environment variable. For example, one of our users reported success with finding SWIG and generating our Python and Java interfaces for Arch Linux by specifying

CMAKE_INCLUDE_PATH=/usr/share/swig/1.3.27

Normally, though, such extraordinary measures are not required on Linux.

Compiling the PLplot examples

Following the previous quick recipe for building and installing PLplot, here is how to compile the examples and test them:

  1. cd \ /home/yourname/plplot/install_directory/share/plplot$PL_VERSION/examples
  2. make test_noninteractive >& make_test.out
  3. less make_test.out

The test takes a significant amount of time and a large number of plot files (pdf, png, xfig,...) that consume a couple of gigabytes of disk space are generated. For more details consult Testing PLplot.

Troubleshooting

Cairo undefined references

If during the make stage or when making examples or your own programs you see undefined references to pango_layout_get_baseline or cairo_ps_surface_set_eps then it is likely that your version of Cairo is older than required. This has been reported on more conservative distros e.g. CentOS/RedHat. You can turn off Cairo dependancies by using the cmake flag -DDEFAULT_NO_CAIRO_DEVICES=ON