Menu

Building_PLplot

2014 (2)
Phil Rosenberg Alan W. Irwin

All PLplot builds are done with our CMake-based build system which gives good results on Linux, Mac OS X, and traditional Unices, and on Windows (Cygwin, MinGW, MinGW/MSYS, and MSVC). After reading this section you should consult specifics for various platforms for more details. Also, after a build and install is completed you should follow up by testing PLplot.

Building PLplot with our CMake-based build system

To get the most out of our build system, it is important to consult the CMake documentation. That documentation is quite thorough but tends to be a bit scattered so we have collected what we think are the best general CMake documentation links for your convenience.

After consulting that documentation, install the appropriate package of CMake for your system platform. Note, you must use at least version 2.8.9 of CMake for your PLplot configuration, but our build system works with the latest version (3.0.2) of CMake as well.

Build Location

We recommend that, whatever platform you use, you build your libraries in a Linux style directory structure. CMake will install your libraries in this type of structure. Typically this will be in a folder called usr/ or usr/local/, but in can be any other name. You can set your install directory by using the CMake option CMAKE_INSTALL_PREFIX. Typically you would put source code for PLplot (and other libraries) in a src subdirectory of your install directory, e.g. usr/src/plplot-x.y.z. When you build and install PLplot it will create subdirectories, lib, bin, share within the installation directory if needed, then place apropriate content in these locations. You should add the bin directory to your path environment variable.

Things work best if all libraries, including dependencies of PLplot share the same install directory. Things can work even if this is not the case, but it generally makes life easier if all libraries are installed together. One notable exception is wxWidgets on windows (PLplot can be built with wxWidgets support). wxWidgets on Windows does not easily allow installation in the typical Linux directory structure. Instead you should install it wherever you feel and set the WXWIN environment variable to point the the source directory.

Suitable Install Paths

Every effort is made to ensure spaces in the install path cause no problems for PLplot. However, problems do occur with paths that include a space followed by a hyphen " -". These paths can get interpretted as flags instead of paths. We therefore suggest that your installation folder does not include this pattern. One case where this is quite likely to occur is when using OneDrive for Business. The default OneDrive for Business folder is "OneDrive - Your Business Name". So if you build in this directory then you will hit problems. One workaround my be to create a symlink to your installation folder to avoid the path with the unsupported pattern. Note that this problem will occur if you install PLplot in a path with the space-hyphen pattern or if any of the dependencies are installed in a path with the space-hyphen pattern.

Generic Unix instructions for our build system

(Optional) set environment variables to help cmake find system components that are installed in non-standard locations

Here is one particular example (which must be executed before the cmake invocation discussed below).

export CMAKE_INCLUDE_PATH=/home/software/shapelib/install/include
export CMAKE_LIBRARY_PATH=/home/software/shapelib/install/lib
export PKG_CONFIG_PATH=/home/software/libLASi/install/lib/pkgconfig

For this particular example, CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH helps cmake to find the headers and library for shapelib in a non-standard install location, and PKG_CONFIG_PATH helps cmake to use the pkg-config command internally to find a libLASi pkg-config module file that is installed in a non-standard location. Use colon separation if more than one non-standard install location needs to be specified with CMAKE_INCLUDE_PATH , CMAKE_LIBRARY_PATH, and/or PKG_CONFIG_PATH. Also, although not used in the specific example above, the colon-separated environment variable PATH helps cmake find executables that are installed in non-standard locations.

(Optional) set environment variables to specify the compilers and compiler flags

Here is one particular example (which must be executed before the cmake invocation discussed below).

export CC="gcc -O2"
export CXX="g++ -O2"
export FC="gfortran -O2"

If you don't set the environment variables above, then by default no compiler options (i.e., no optimization and no debugging symbols) are used for gcc-related compilers for our build system which makes for fast builds, but slow execution.

cmake invocation

Here is one typical example.

mkdir build_dir
cd build_dir
cmake -DCMAKE_INSTALL_PREFIX=/my/prefix \
../plplot.git >& cmake.out

(CMake is capable of generating builds within the source tree, but we have emphasized a build with a separate build tree here because of its fundamental advantage that the source tree remains clean with no generated files in it.)

Check the cmake.out file for any configuration issues, especially WARNING messages which signal that a component of PLplot has been removed because required system components for that component have not been found.

There are a large number of CMake options for PLplot which can be set for cmake to personalize your build. Use the ccmake front end to cmake to obtain documentation of all these options. In the above case we have specified a particular install prefix "/my/prefix".

Note in the above example an initially empty build directory (arbitrarily) named build_dir is used to insure a clean start, and ../plplot.git is the (arbitrary) name of the top-level directory of a freshly cloned git repository. If instead you use a freshly unpacked PLplot source distribution tarball "../plplot.git" will need to be replaced by "../plplot-5.10.0" (for our latest release at time of writing).

To start a fresh build, simply execute

cd build_dir
rm -rf \*

before invoking cmake. Of course, that "rm" command is an extremely dangerous command (since it removes everything in the current directory and all subdirectories), but you should be okay so long as you cd to the correct directory before executing the "rm" command.

Build and install

make VERBOSE=1 >& make.out
make VERBOSE=1 install >& make_install.out

Check make.out and make_install.out for any errors. Follow up by testing PLplot.

Useful problem reports

If you encounter a problem with the above, then it is important to report the problem with sufficient details (typically to either the plplot-general or plplot-devel mailing lists) so that those familiar with PLplot builds can help you. This section lists the details that are typically required in a useful problem report.

  • Include all environment variables that were set in your report. (The easiest way to do this on Unix is to invoke the command
    printenv > printenv.out
    and include printenv.out in your report.)

  • State the cmake command that was used in your report.

  • Include the cmake output (captured as cmake.out above) in your report

  • State the PLplot version that was used (e.g., commit ID if you are following the git master branch or release version number if you are using a release tarball) in your report.

  • Include the CMake cache file, CMakeCache.txt, in your report.

  • Include the verbose results of your build (captured as make.out above) in your report.

  • Include the verbose results of your install (captured as make_install.out above) in your report.

The content of this page is available under the GNU Free Documentation License 1.2.


Related

Wiki: Home
Wiki: Specifics_for_various_platforms

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.