Using Software Packages in pkgsrc

The NetBSD Packages Collection (pkgsrc) is a third-party software package management system for Unix-like operating systems. Among the over 17,000 packages available in pkgsrc, a few hundred of them have been built on Pleiades and are available in the public directory /nasa/pkgsrc .

A new collection of software packages is released every quarter by the pkgsrc developers. In addition to new packages or updated versions, each release is largely comprised of the same packages (with identical version numbers) as previous releases.

Note: In addition to new packages or updated versions, each release is largely comprised of the same packages (with identical version numbers) as previous releases.

Software Packages Available on NAS Systems

For a list of software programs that are currently available as packages, see Available Software Modules and Packages.

You can also see which pkgsrc modules are currently available by running module avail pkgsrc . For example:

pfe% module avail pkgsrc pkgsrc/2016Q4

All of the source distributions for building the pkgsrc modules are stored in the /nasa/pkgsrc/distfiles directory. If you plan to build software from source, check to see whether the source distribution is already there before downloading the files from the internet.

To view a complete list of all packages and a one-line description of each package, load a pkgsrc module and type the pkg_info command without any additional options. If you are looking for a particular package, you can check whether it is available by using the grep command plus a keyword from the output of the pkg_info command.

TIP: Because some package names contain capital letters, add -i to the grep command to ignore case distinctions.

For example:

pfe% module load pkgsrc/2016Q4 pfe% pkg_info | grep -i cairo cairo-1.14.8 Vector graphics library with cross-device output support cairo-gobject-1.14.8 Vector graphics library with cross-device output support py27-cairo-1.10.0nb4 Python bindings for cairo (python-2.x version)

You can also use the -e option to test the existence of a given package. For example:

pfe% pkg_info -e cairo pfe% cairo-1.14.8

Once you know the package name, you can use additional pkg_info options to find more information about the package. You can specify the full package name, or you can leave out the version number. For example:

pfe% pkg_info -B cairo-1.14.8

or

pfe% pkg_info -B cairo

Some useful options for pkg_info include:

-B shows build information of the package -d shows a long description of the package -L shows the files within the package -N shows what other packages were used to build the package -R shows what other packages require the package

Using Packages

The root directory of a pkgsrc release (for example, /nasa/pkgsrc/sles12/2016Q4 ) contains familiar directories such as bin , sbin , lib , include , man , and info . For most packages, you can find their executables, libraries, or include files in these directories.

Using an Executable

When you load a pkgsrc module, the paths to its bin and sbin directories are prepended to the PATH environment variable, as shown in the following example. Therefore, you do not need to provide full paths to these directories ( /nasa/pkgsrc/sles12/2016Q4/bin , /nasa/pkgsrc/sles12/2016Q4/sbin ) in order to run executables in them.

pfe% module show pkgsrc/2016Q4 ------------------------------------------------------------------- /nasa/modulefiles/pkgsrc/sles12/pkgsrc/2016Q4: module-whatis A collection of software built via NetBSD's pkgsrc prepend-path INFOPATH /nasa/pkgsrc/sles12/2016Q4/info prepend-path MANPATH /nasa/pkgsrc/sles12/2016Q4/man prepend-path PATH /nasa/pkgsrc/sles12/2016Q4/bin:/nasa/pkgsrc/sles12/2016Q4/sbin -------------------------------------------------------------------

WARNING: For pkgsrc/2016Q2 and earlier releases built under SLES 11, the bin and sbin directories are appended to the PATH environment variable.

Linking a Library

Unlike the PATH environment variable, loading a pkgsrc module does not set the LD_LIBRARY_PATH environment variable. The reason for this is to prevent libraries in the pkgsrc directory from overriding those with the same filenames at the system default locations or directories that may have been included in your existing LD_LIBRARY_PATH.

To link a static library (for example, libcairo.a ) in the /nasa/pkgsrc/sles12/2016Q4/lib directory:

-I/nasa/pkgsrc/sles12/2016Q4/include -L/nasa/pkgsrc/sles12/2016Q4/lib -lcairo

To link to a dynamic library (for example, libfftw.so ) in the /nasa/pkgsrc/sles12/2016Q4/lib directory, follow the recommendations in the list below, in order of preference.

Note: Dynamic libraries have the suffix ".so" rather than the suffix ".a ", which is used for static libraries.

Set the LD_RUN_PATH environment variable as shown below prior to the link step. This will get /nasa/pkgsrc/sles12/2016Q4/lib encoded into the executable. Setting LD_RUN_PATH or LD_LIBRARY_PATH is not needed during run time. setenv LD_RUN_PATH /nasa/pkgsrc/sles12/2016Q4/lib -I/nasa/pkgsrc/sles12/2016Q4/include -L/nasa/pkgsrc/sles12/2016Q4/lib -lfftw

encoded into the executable. Setting LD_RUN_PATH or LD_LIBRARY_PATH is not needed during run time. Add the -Wl,-R linker option during the link step. This will also get /nasa/pkgsrc/sles12/2016Q4/lib encoded into the executable. Setting LD_RUN_PATH or LD_LIBRARY_PATH is not needed during run time. Note: The linker option -Wl,-R takes precedence over the LD_RUN_PATH setting. -I/nasa/pkgsrc/sles12/2016Q4/include -L/nasa/pkgsrc/sles12/2016Q4/lib -lfftw -Wl,-R/nasa/pkgsrc/sles12/2016Q4/lib

linker option during the link step. This will also get encoded into the executable. Setting LD_RUN_PATH or LD_LIBRARY_PATH is not needed during run time. Do not set LD_RUN_PATH or use the -Wl,-R linker option during the link step. Since /nasa/pkgsrc/sles12/2016Q4/lib is not encoded into the executable, you must set LD_LIBRARY_PATH during run time. Link time: -I/nasa/pkgsrc/sles12/2016Q4/include -L/nasa/pkgsrc/sles12/2016Q4/lib -lfftw Run time: setenv LD_LIBRARY_PATH "/nasa/pkgsrc/sles12/2016Q4/lib:$LD_LIBRARY_PATH"

For more information about using the setenv command, see

The files of some packages are not installed in the bin, lib, and include directories. For example, the qt4 package is installed in the /nasa/pkgsrc/sles12/2016Q4/qt4 directory, which has its own bin , lib , and include subdirectories. The best way to find the exact location of a file you need from a package is to run the pkg_info command as follows:

pfe% pkg_info -L package_name

Separate modules have been created for some commonly used packages to make them easier to use—you can simply load the modulefile without loading a pkgsrc module. These include:

boost/1.62

python/2.7.12

python3/3.5.2

Separate module for other packages can be created when there is demand from the NAS user community.

For more information about pkgsrc, see https://www.pkgsrc.org.