CASA toolset 2

Prerequisites

You my have root access to your computer.

IMPORTANT: If you are migrating to 10.11 from 10.10, you must re-install MacPorts. Remove your /opt/casa/ports and /opt/casa/02 directories in order to avoid conflicts with previous versions. You can also skip the changes to .profile if you had those set earlier.

Install Xcode

https://developer.apple.com/xcode/downloads/

Note: Xcode 8.3.3 is not compatible with OSX 10.11.6. Xcode 8.2.1 works, don't know about versions in between this one and 8.3.3. Xcode 9 is for 10.12.

Accept Apple EULA

xcodebuild -license

Install Xcode command line tools

From the terminal:
xcode-select --install

Install Java

Verify that you have Java 1.5 or later installed. This is required for Casa Code to compile. Open up a terminal and type:
java -version
You should get a response like:
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
If you don't, download and install Java from here: https://www.java.com/en/download/mac_download.jsp

This link failed for me. It took me to a site that installed the Java runtime which then gave errors when I tried to run it from the command line (though it worked for browers). I had to search for "Java JDK" and then download "Java SE Development Kit 8" from oracle.com.

Download, Unpack and Install Macports

https://distfiles.macports.org/MacPorts/MacPorts-2.3.4.tar.gz

curl -o MacPorts-2.3.4.tar.gz https://distfiles.macports.org/MacPorts/MacPorts-2.3.4.tar.gz
tar zxf MacPorts-2.3.4.tar.gz
cd MacPorts-2.3.4
./configure --prefix=/opt/casa/02 --with-macports-user=root --with-applications-dir=/opt/casa/02/Applications
make
make install

Configure Environment

Run the following commands as sudoed root. This will make the port command run with the -s flag, which will compile all of the ports from the source.

   
bash-3.2
sudo su -
mkdir /var/root/bin
touch ~/.profile
chmod 700 ~/.profile
Create file /var/root/bin/port and add the following contents.
#!/bin/bash
/opt/casa/02/bin/port -N -s $*
Make the file executable
 chmod 755 /var/root/bin/port
Add the following in the .profile
export PATH=/opt/casa/02/bin:$PATH
# Required for the latest version of Qt4 port
export PATH=/opt/casa/02/libexec/qt4/bin:$PATH
# Port binaries
export PATH=/var/root/bin/:$PATH
Run the following commands.
. ~/.profile
type port
# This should return
# /var/root/bin/port

Fetch Port Overlay

cd /opt/casa
git clone https://open-bitbucket.nrao.edu/scm/casa/casa-macports.git
ln -s /opt/casa/casa-macports/ports /opt/casa/ports
scp <username>@ssh.cv.nrao.edu:~dschieb/patch-531 /opt/casa/ports/graphics/pgplot/files

Configure MacPorts Source

echo 'file:///opt/casa/ports [nosync]' > /opt/casa/02/etc/macports/sources.conf
echo 'rsync://rsync.macports.org/release/ports [default]' >> /opt/casa/02/etc/macports/sources.conf

Verify that the sources.conf looks correct:

bash-3.2# cat /opt/casa/02/etc/macports/sources.conf
file:///opt/casa/ports [nosync]
rsync://rsync.macports.org/release/ports [default]

Update MacPorts

port selfupdate

Install Ports

Note: While it is possible to install some of the ports without root privileges, it is probably for the best to install them all with sudo.

port install gcc5
port install readline
port install python27
port select --set python python27
port install py27-readline
port install boost +python27
port install dbus # Requires sudo
port install dbus-cpp  # Requires sudo
port install qt4-mac
port install qwt61 +qt4
port install pgplot +gcc5
port install cfitsio
port install wcslib +gcc5
port install gsl
port install rpfits +gcc5
port install fftw-3
port install fftw-3-single
port install cairo +quartz +x11
port install xercesc
port install libxslt
port install cmake
port install tk +quartz
port install flex
port install py27-matplotlib +tkinter +gcc5
port install py27-ipython
port select --set ipython py27-ipython
port select --set ipython2 py27-ipython
port install dbus-python27  # Requires sudo
port install swig
port install swig-python
port install py27-scipy +gcc5
port install py27-pyfits
port install libsakura
port install py27-gdbm    # for running tests with robotframework
port install gdb # for debugging, requires sudo
port install gradle # for nightly builds
port install groovy # for nightly builds
port install wget # for documentation
port install git-lfs # for data repository
port install ccache
Configure Git LFS (as root and and as the user)
git config --global filter.lfs.required true
git config --global filter.lfs.clean "git-lfs clean -- %f"
git config --global filter.lfs.smudge "git-lfs smudge -- %f"
git config --global filter.lfs.process "git-lfs filter-process"

GDB Configuration
During the installation you will get this message:

You will need to make sure /System/Library/LaunchDaemons/com.apple.taskgated.plist has the '-p' option, e.g.
            <key>ProgramArguments</key>
            <array>
                    <string>/usr/libexec/taskgated</string>
                    <string>-sp</string>
            </array>
Due to kernel caching, you usually need to restart Mac OS X for this option to effect.

You will have to disable SIP to do the above steps. As an alternative you can do the following:

Create certificate to sign ggdb

Open /Applications/Utilities/Keychain access
In the top menu, go to "Keychain Access" and select Certificate Assistant
Select "Create a certificate"
Select:
    Name: gdb-cert
    Identity Type: Self Signed root
    Certificate Type: Code Signing
Select "Let me override defaults"
Click continue
Click continue on the pop-up
Click continue
In the personal information, select values as you wish and click continue
Click continue
Click continue
Verify that the Key Usage Extension is set to "Code Signing" and click continue
Click continue
Click continue
In the "Specify a Location For The Certificate" screen select System and click continue
Select System in the Keychains pane and right click on the "gdb-cert"
Click on the triangle next to "Trust" to expand the options
In the "When using this certificate select "Always trust"
Click on the red "x" on the left top corner of the window. 
Provide your password
Open a terminal and enter 
"codesign -f -s gdb-cert /opt/casa/02/bin/ggdb"
Restart your machine

Add ports to your path

Include the following line in the .profile file in your home directory
export PATH=/opt/casa/02/libexec/qt4/bin:/opt/casa/02/bin:$PATH

-- DarrellSchiebel - 2016-11-16
Topic revision: r26 - 2017-09-29, PamFord
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback