Skip to content

Installation Solution: MB System programs that use X11 Motif OpenGL

Hayley Drennon edited this page Jul 25, 2024 · 3 revisions


MacOs Example Using MacPorts to Install Prerequisite packages:
#
The use of MacPorts to install the MB-System prerequisite packages is recommended on Apple Mac computers, particularly because this approach enables cleanly building with a complete X11 + Motif + OpenGL infrastructure separate from the libraries and header files associated with the XQuartz package. One usually still installs XQuartz and uses it as the X11 display server, but confining the MB-System compiliation and linking to headers and libraries within the MacPorts structure avoids several issues.
#
This example is relevant for MacOs 10.13 High Sierra to the current MacOs 13 Ventura on both Intel and ARM (Apple Silicon) architecture computers.
#
Install Xcode and the Xcode command line tools, which includes the LLVM compiler suite.

xcode-select --install

#
Install the XQuartz X11 server from www.xquartz.org
XQuartz 2.8.5 or later is required for all MB-System installations.
#
Install MacPorts using the appropriate downloadable installer package from:
www.macports.org/install.php
#
After MacPorts installation, first make sure the default port packages are current by running selfupdate and then install the MB-System prerequisites. GGC12 is required for compiling the OTPS fortran code since it provides gfortran. However, no symlink to gfortran is created by GCC, and must be done manually. Also, no symlink to GMT exists and must be created too. If you get a warning of ‘port command not found’, update your Paths by executing: export PATH=$PATH:/opt/local/bin

sudo port -v selfupdate
sudo port install gmt6 proj6 fftw-3 xorg mesa libGLU openmotif gcc12
sudo ln -s /opt/local/bin/gfortran-mp-12 /opt/local/bin/gfortran
sudo ln -s /opt/local/bin/gmt6 /opt/local/bin/gmt


#
Also make sure that a current version of Python3 is available. First list the available Python3 versions, install the most recent, and then set port to link that version to python3:

port search python
sudo port install python311
sudo port select --set python3 python311


Also install the most recent Python imaging library Pillow sudo port install py311-Pillow
#
Download the MB-System source package from the repository at GitHub:
github.com/dwcaress/MB-System
There are often beta releases that are more recent than the current stable release. For instance, to download 5.7.9.beta52 go to:

https://github.com/dwcaress/MB-System/archive/refs/tags/5.7.9beta52.tar.gz


#
Unpack the MB-System distribution tarball, and then cd into the top directory of the resulting structure. This will typically be named something like “MB-System-5.7.9”. At that location, execute the configure script, named “configure”, with the options necessary for your context. The XCode compiler tools do not look for header files or libraries in the locations used by MacPorts, and so it is necessary to specify these locations for several of the prerequisite packages.
#
This command should successfully enable building the current MB-System (5.7.9 or later) on any Mac computer with the prerequisites installed through MacPorts. This has been tested with computers running High Sierra, Big Sur, Monterey and Ventura.

./configure \
    --prefix=/usr/local \
    --disable-static \
    --enable-shared \
    --enable-hardening \
    --enable-test \
    --with-proj-lib=/opt/local/lib/proj8/lib \
    --with-proj-include=/opt/local/lib/proj8/include \
    --with-gmt-config=/opt/local/lib/gmt6/bin \
    --with-fftw-lib=/opt/local/lib \
    --with-fftw-include=/opt/local/include \
    --with-x11-lib=/opt/local/lib \
    --with-x11-include=/opt/local/include \
    --with-motif-lib=/opt/local/lib \
    --with-motif-include=/opt/local/include \
    --with-opengl-include=/opt/local/include \
    --with-opengl-lib=/opt/local/lib \
    --with-otps-dir=/usr/local/src/otps


#
Once the makefiles have been generated by configure, build and install MB-System using:

make
make check
sudo make install


#
The MB-System codebase includes some experimental components, such as OpenCV based photomosaicing (enabled with –enable-opencv) and a realtime Terrain Relative Navigation infrastructure and toolset (–enable-mtrn and –enable-mbtnav). An additional prerequisite for the photomosaicing is OpenCV, which can be installed by:

sudo port install gmt6 proj6 fftw-3 xorg mesa libGLU openmotif opencv4


This configure command should enable building the entire MB-System package, including these experimental tools.

./configure \
    --prefix=/usr/local \
    --disable-static \
    --enable-shared \
    --enable-hardening \
    --enable-test \
    --with-proj-lib=/opt/local/lib/proj6/lib \
    --with-proj-include=/opt/local/lib/proj6/include \
    --with-gmt-config=/opt/local/lib/gmt6/bin \
    --with-fftw-lib=/opt/local/lib \
    --with-fftw-include=/opt/local/include \
    --with-x11-lib=/opt/local/lib \
    --with-x11-include=/opt/local/include \
    --with-motif-lib=/opt/local/lib \
    --with-motif-include=/opt/local/include \
    --with-opengl-include=/opt/local/include \
    --with-opengl-lib=/opt/local/lib \
    --enable-mbtrn \
    --enable-mbtnav \
    --enable-opencv \
    --with-opencv-include=/opt/local/include/opencv4 \
    --with-opencv-lib=/opt/local/lib/opencv4 \
    --with-otps-dir=/usr/local/src/otps


#
In order for GMT to successfully execute the MB-System modules, the location of the shared libraries containing the dynamically loaded modules must be known to GMT. This can be accomplished by using the GMT module gmtset. This step must be done in your home directory.

cd
gmt gmtset GMT_CUSTOM_LIBS /usr/local/lib/mbsystem.so


#
The parallel processing modules mbm_multiprocess, mbm_multidatalist, and mbm_multicopy require the perl module Parallel::ForkManager. This can be added to your local perl installation using the command line utility cpan:

cpan LWP::Simple
cpan Parallel::ForkManager


#
#——————————————————————————

Clone this wiki locally