Installing BERNESE 5.2 on macOS

Last updated on:

August 22, 2017: – Added notes to install Qt4.8 from Macports
April 03, 2015: – First post

Introduction

This is a quick guide on how to install BERNESE 5.2 GPS Software on Mac OS X 10.9+ and macOS 10.11 and later).

Prerequirements

1. Compile BERN52/MENU

To compile the MENU we need to install QT4 UI framework. Since we need back-compatibility with QT3, the latest QT5 will not work to install BERNESE MENU.

1a. Install QT4 from Macports (the easiest way)

New: Updated on 2017.08.22

The easiest way to install QT4 is via Macports or Homebrew package manager.
#sudo port selfupdate
#sudo port install qt4-mac

Qt4 is then installed in /opt/local/libexec/qt4

qt_menu.nib is however installed in /opt/local/libexec/qt4/Resources/qt_menu.nib

We just create a link to /opt/local/libexec/qt4/lib/ with command:


sudo ln -s /opt/local/libexec/qt4/lib/Resources/qt_menu.nib /opt/local/libexec/qt4/lib/

1b. Install QT4 from source

If you want to build QT4 from source, you need to download the Open-source version of it.

#sudo mkdir /usr/local/qt4.8.7
#export QTDIR=/usr/local/qt4.8.7/

Download qt4 4.8.7 and compile it:

#wget -N http://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
#tar -zxvf qt-everywhere-opensource-src-4.8.7.tar.gz 
#cd qt-everywhere-opensource-src-4.8.7

Do not use/add “-static” in the ./configure for Mac OS X to compile qt4.8.7 or else you will get a “-lcrt0.o” error

#./configure -release -opensource -qt-zlib -no-gif -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -no-webkit -no-script -nomake examples -nomake demos -nomake docs -nomake translations -prefix /usr/local/qt4.8.7 -platform macx-g++

Then:

#make

Do a make install to install qt4 in /usr/local/qt4.8.7/

#make install

After the compilation, copy the ‘qt_menu.nib’ to QTDIR ( QTDIR=/usr/local/qt4.8.7/ )

#sudo cp -r src/gui/mac/qt_menu.nib $QTDIR

Setup Bash environment before launching the setup script

After you have downloaded the BERNESE UNIX version you must launch the “setup.sh” script from the installer directory (e.g. my installer dir is called “BERNESE-Installer”).

IMPORTANT: Before launching “sh ./setup.sh” command you must tell where the QTDIR is located, this is done by entering the command, or else you will get the error:
The QT library seems not to be installed correctly.

If Qt4 was installed from Macports:
#export QTDIR=/opt/local/libexec/qt4/

If Qt4 was manually compiled:
#export QTDIR=/usr/local/qt4.8.7/

#cd ~/Downloads/BERN52_Installer/
#sh ./setup.sh

The setup script will ask you the location of the installation directory:

Input the Installation Directory [ $HOME/BERN52 ]:

Just type RETURN it should extract all the files in your $HOME/BERN52 directory

Perl program used [ /usr/bin/perl ] :

After that it will give you CONFIGURATION MENU:

=====================================
CONFIGURATION OF THE BERNESE SOFTWARE
=====================================
 0 ... Complete Installation (Steps 1 to 4)
 1 ... Update LOADGPS.setvar
 2 ... Add a new user
 3 ... Compile Bernese menu
 4 ... Compile Fortran programs
 5 ... Install Example Campaigns

X ... Exit
Enter option:

Enter “X” to exit the Configuration menu. We need to setup some config file to allow the installer to finish without errors.

Exit the CONFIGURATION and edit the config file LOADGPS.setvar

By default the file LOADGPS.setvar is loaded by the setup.sh file to include the various installation variables like Installation Dir, Operating System etc.

We create a new one and edit it:

#touch ~/BERN52/GPS/EXE/LOADGPS.setvar
#edit ~/BERN52/GPS/EXE/LOADGPS.setvar

You can copy/paste the following text:

# ~/BERN52/GPS/EXE/LOADGPS.setvar

# ==============================================================================
#
# Name:       $HOME/BERN52/GPS/EXE/LOADGPS.setvar
#
# Created:    Thu Mar  5 11:32:32 2015 by configure.pm
#
# Changes:
#
# ==============================================================================

# Function to add path to $PATH only once
# ---------------------------------------
addtopath () {
  if [ "`echo $PATH | grep $1`" != "$PATH" ]
  then
    export PATH="${PATH}:$1"
  fi
}

# Version of Bernese GNSS Software
# --------------------------------
export VERSION="52"

# Fortran compiler name
# ---------------------
export F_VERS="GNU"

# List of additional compilers
# ----------------------------
export F_VERS_LIST="gfortran"

# Path to software
# ----------------
export C="/Users/gorisk/BERN52"

# Path to Bernese data files
# --------------------------
export X="${C}/GPS"

# Fortran source of subroutines
# -----------------------------
export LG="${C}/LIB/FOR"

# Fortran source of include and modules
# -------------------------------------
export I="${C}/INC/FOR"

# Fortran source of programs
# --------------------------
export FG="${C}/PGM/FOR"

# Executables of Bernese Fortran programs
# ---------------------------------------
export XG="${C}/PGM/EXE_${F_VERS}"

# Executable and source of Bernese menu
# -------------------------------------
export XQ="${C}/MENU"

# Scripts for the BPE
# -------------------
export BPE="${C}/BPE"

# Host of the BPE server
# ----------------------
export BPE_SERVER_HOST="bern-gorisk.local"

# Path to user environment
# ------------------------
export U="${HOME}/GPSUSER52"

# Path to temp. user environment
# ------------------------------
export T="${HOME}/GPSTEMP"

# Path to campaign area
# ---------------------
export P="${HOME}/GPSDATA/CAMPAIGN52"

# Path to datapool area
# ---------------------
export D="${HOME}/GPSDATA/DATAPOOL"

# Path to savedisk area
# ---------------------
export S="${HOME}/GPSDATA/SAVEDISK"

# Path to Qt libraries
# --------------------
export QTBERN="/usr/local/qt4.8.7/"

# Operating system group
# ----------------------
export OS="UNIX"

# Operating system name
# ---------------------
export OS_NAME="DARWIN"

# Number of JPL ephemeris
# -----------------------
export JPLEPH="DE405"

# Name of group
# -------------
export CGROUP="USERS"

# Add Bernese paths to $PATH
# --------------------------
addtopath "$X/EXE"
addtopath "$XG"
addtopath "$XQ"

Now that we have created the LOADGPS.setvar file we want to load the whole kaboonga variables by sourcing it out:

#source ~/BERN50/GPS/EXE/LOADGPS.setvar

This command loads the various variables to the BASH shell.

BERNESE MENU Configuration

After trying to launch the compilation of the MENU in the setup installation of BERNESE, an error message appeared of “undefined symbols” in menuutils.cpp > compress etc.

Just go in the directory and invoke the qmake command and edit the file “Makefile”:

#cd ~/BERN50/MENU/
#qmake
#edit Makefile

Now edit file “Makefile” in the directory ~/BERN50/MENU/ and add
-lz at the end of the LIBS line:

LIBS     = $(SUBLIBS) -L/opt/local/lib -L$(QTDIR)/lib -L/opt/local/lib -lICE -lSM -ldl -lqt-mt -lXext -lX11 -lm -lz

or else you will get error about undefined symbols compress if you want to compile the BERNESE-Menu. I’ve found out the zLib library was missing in the LFLAGS for compilation (this may be a bug of Macports qt3-qmake command, not sure).

Update your .bash login config

Now edit your “.bash_profile” or your “.bashrc” and add these lines:

# For BERNESE 5.0
export QTDIR=/opt/local/lib/qt3
source ~/BERN50/GPS/EXE/LOADGPS.setvar

Edit “configure.pm” script

Before launching the “configure.pm” script in ~/BERN50/GPS/EXE there are two issues which needs to be fixed:

An error message will appear with ‘qmake.cache’ not found etc. Just edit:

#edit ~/BERN50/GPS/EXE/configure.pm

and comment out the lines: 933-937 the one with qmake.cache. It should look like this:

#  my $cashFile = "$ENV{QTDIR}/.qmake.cache";
#  if (! -f $cashFile) {
#    die "File $cashFile not found\n".
#        "Please make sure that the QT library has been installed correctly.\n";
#  }

Then edit line 956 to read like from:

system("$qmake -cache $cashFile menu.pro");

to:

 system("$qmake menu.pro");

Launch “configure.pm” to compile the Menu and the Fortran programs

IMPORTANT: Don’t launch setup.sh again or else it will erase the newly modified LOADGPS.setvar and other files with the one from the .tar.gz archives.

Launch the configure.pm script from your Home directories BERN50 folder:

#source ~/.bash_profile
#cd ~/BERN50/GPS/EXE/
#configure.pm

Choose option “3 … Compile BERNESE Menu” or option “4 … Compile Fortran programs”.

It should hopefully compile correctly the menu and the fortran programs! Hurray!!!

If it fails to compile the menu one trick is to go directly to the directory ~/BERN50/MENU and invoke the commands:

#cd ~/BERN50/MENU/
#make clean
#make mocclean
#make

if you get the error:
Undefined symbols:
"_compress", referenced from:
compress(QString const&)in menutils.o
"_uncompress", referenced from:
uncompress(QMemArray const&)in menutils.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [menu] Error 1

then you need to edit the “~/BERN50/MENU/Makefile” and add “-lz” to the LIBS flags (see BERNESE Menu Configuration)

After succesful compilation:

Launch BERNESE MENU

Launch BERNESE 5.0 by typing the following command in the “Terminal.app”:

#G

An X11 Window opens and the BERNESE Menu appears. Enjoy!

Comments are closed.