Using Software Packages in pkgsrc

Article ID: 493
Last updated: 04 Dec, 2025

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 NAS x86_64 systems 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.

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:

pkgsrc/2022Q1-rome pkgsrc/2023Q3

are currently available on NAS systems with x86_64 architecture running TOSS 4.

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 on a NAS x86_64 system, 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:

% module load pkgsrc/2023Q3
% pkg_info | grep -i cairo
cairo-1.16.0nb9         Vector graphics library with cross-device output support
cairo-gobject-1.16.0nb7 Vector graphics library with cross-device output support
py311-cairo-1.24.0      Python bindings for cairo

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

% pkg_info -e cairo
cairo-1.16.0nb4

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:

% pkg_info -B cairo-1.16.0nb9

or

% 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/toss4/2023Q3) 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 in order to run executables in them.

% module show pkgsrc/2023Q3
-------------------------------------------------------------------
/nasa/modulefiles/pkgsrc/toss4/pkgsrc/2023Q3:

system           /bin/logger -p local2.info -t envmodule username display pkgsrc/2023Q3 
module-whatis    A collection of software built via NetBSD's pkgsrc 
prepend-path    INFOPATH /nasa/pkgsrc/toss4/2023Q3/info
prepend-path    MANPATH /nasa/pkgsrc/toss4/2023Q3/man
prepend-path    PATH /nasa/pkgsrc/toss4/2023Q3/bin:/nasa/pkgsrc/toss4/2023Q3/sbin
setenv          PKGSRC_BASE /nasa/pkgsrc/toss4/2023Q3 
-------------------------------------------------------------------

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/toss4/2023Q3/lib directory:

-I/nasa/pkgsrc/toss4/2023Q3/include
-L/nasa/pkgsrc/toss4/2023Q3/lib -lcairo

To link to a dynamic library (for example, libfftw.so) in the /nasa/pkgsrc/toss4/2023Q3/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/toss4/2023Q3/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/toss4/2023Q3/lib
    -I/nasa/pkgsrc/toss4/2023Q3/include
    -L/nasa/pkgsrc/toss4/2023Q3/lib -lfftw
  • Add the -Wl,-R linker option during the link step. This will also get /nasa/pkgsrc/toss4/2023Q3/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/toss4/2023Q32/include
    -L/nasa/pkgsrc/toss4/2023Q3/lib -lfftw 
    -Wl,-R/nasa/pkgsrc/toss4/2023Q3/lib 
  • Do not set LD_RUN_PATH or use the -Wl,-R linker option during the link step. Since /nasa/pkgsrc/toss4/2023Q3/lib is not encoded into the executable, you must set LD_LIBRARY_PATH during run time.

    Link time:

    -I/nasa/pkgsrc/toss4/2023Q3/include
    -L/nasa/pkgsrc/toss4/2023Q3/lib -lfftw 
    Run time:
    setenv LD_LIBRARY_PATH "/nasa/pkgsrc/toss4/2023Q3/lib:$LD_LIBRARY_PATH"

For more information about using the setenv command, see man setenv.

The files of some packages are not installed in the bin, lib, and include directories. For example, the grace package is installed in the /nasa/pkgsrc/toss4/2023Q3/grace 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.

On the NAS x86_64 nodes running TOSS 4, the following modules from pkgsrc have been made available:

  • boost/1.78
  • boost/1.83
  • gcc/6.5
  • gcc/7.5
  • gcc/8.4
  • gcc/9.3
  • gcc/10.3
  • gcc/13.2
  • python3/3.9.12
  • python3/3.11.5
  • octave/6.4
  • octave/8.3

Separate modules 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.

Also read

Contact Us

General User Assistance

Security

  • Report security issues 24x7x365
  • Toll-free: 1-877-NASA-SEC (1-877-627-2732)
  • E-mail: soc@nasa.gov

User Documentation

High-End Computing Capability (HECC) Portfolio Office

NASA High-End Computing Program

Tell Us About It

Our goal is furnish all the information you need to efficiently and effectively use the HECC resources needed for your NASA computational projects.

We welcome your input on features and topics that you would like to see included on this website.

Please send us email with your wish list and other feedback.