Install of SPC

Instructions for Mac OS

SPC is designed to run in /usr/local/bin/

Preparation

SPC requires gfortran and spicelib

gfortran - https://gcc.gnu.org/wiki/GFortranBinaries#MacOS

spicelib - This contains routines created by JPL's NAIF division which does an excellent job of handling flight kernels (known as SPICE). It can be found at http://naif.jpl.nasa.gov/naif/toolkit_FORTRAN.html

toolkit should be placed in /usr/local/src

The actual spicelib.a file should be placed in /usr/local/lib/spicelib.a

Download

Log into your GitHUB account to access the SPC source files. You will want the BLESSED repository/Master. While there are some useful features in some of the branches, they have not been integrated into the main branch of the code and have not undergone the regression testing.

Link to SPC Blessed

Click the green button that says "Code" and select the "Download ZIP option". This will download the entire set of files into a single package. Once you unzip the files, you can move them to a temporary directory.. You will need to compile them and copy the binaries into /usr/local/bin. If you know how to use GitHUB, feel free to clone the repository and work within GitHUB's system.

Compiling

Once you've set up your system to compile with gfortran, you need to complete three steps.

Create object files (whatever.o) for every component in the directory "COMMON".

You do this by running the script AAmake _ _ COMMON_objects.txt.

This was built for csh, so I find that it works well to do:

csh AAmake__COMMON_objects.txt

Build the COMMON.a library.

This combines all of the object files into a single library that is used for most SPC processing.

csh AAmake_COMMON_library.txt

Run the script that compiles all of the SPC binaries.

It is likely to be warnings, but shouldn't have any errors.

mkdir -p BINcsh AACOMPILE.TXT

Installing

To complete the installation, you simply copy the items within the <srcpath>/BIN directory.

cp BIN/* /usr/local/bin/

Once it is installed

Run LITHOS -v to ensure the program runs.

You should be able to run that program from any directory (and not just /usr/local/bin)

Issue with using a PC and VM

If you get an error something like:

LITHOS.f:(.text+0x13568): relocation truncated to fit: R_X86_64_32S against symbol `array_' defined in COMMON section in /tmp/ccvxIrot.o

Then it may be that your system (usually a PC) is not running the system fully as 64bit architecture, but only using 32bits for some memory allocations. SPC needs to use more than 2GB, so you must have more than 32bit addressing.

You may need to add the following: -mcmodel=medium

Thus, the gfortran alias would be

alias ftn '/usr/local/bin/gfortran -O2 -mcmodel=medium -fbounds-check'