Gilles' sysadmin & dev blog for Earth Science

Installing BERNESE 5.2 on macOS

Introduction

This is a quick guide on how to install BERNESE 5.2 GPS Software on macOS 10.11 and later).

Last updated on:

December 10, 2019: – Rewrote Macports QT4 installation, added more errors and fixes
August 22, 2017: – Added notes to install Qt4.8 from Macports
April 03, 2015: – First post

Prerequirements

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

1a. Install QT4 from Macports (recommended)

The easiest way to install QT4 is via Macports or Homebrew package manager.

#sudo port selfupdate
#sudo port install qt4-mac

Qt4 from Macports is 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. 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 “BERN52_Install”).

IMPORTANT: Before executing the “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, set QTDIR as follows:

export QTDIR=/opt/local/libexec/qt4/

If Qt4 was manually compiled set QTDIR as follows:

export QTDIR=/usr/local/qt4.8.7/

Launch the setup.sh

#cd ~/BERN52_Install/
#sh ./setup.sh

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

#sh setup.sh 

***************************************
*        Bernese GNSS Software        *
*             Installation            *
*  (UNIX/Linux or Mac OS X platform)  *
***************************************

Full path where the BERN52 software tree will be installed
[ /Users/gorisk ]:

The software will be installed in /Users/gorisk/BERN52

Press the return key to continue or Ctrl-C to abort

Just type RETURN and the installer extracts all the *.tgz files in your $HOME/BERN52 directory.
Then continue the setup script …

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

After that it will display the CONFIGURATION MENU:

Enter “1” to update the ‘LOADGPS.setvar’ file.

Current Values:
--------------
    VARIABLE DESCRIPTION           VARIABLE NAME      VARIABLE VALUE
 1: Path to software               C               => /Users/gorisk/BERN52
 2: Path to Qt libraries           QTBERN          => /opt/local/libexec/qt4/
 3: Operating system group         OS              => UNIX
 4: Operating system name          OS_NAME         => DARWIN
 5: Fortran compiler name          F_VERS          => GNU
 6: List of additional compilers   F_VERS_LIST     => 
 7: Host of the BPE server         BPE_SERVER_HOST => bern-gorisk-bkup2.ecgs.welter
 8: Path to user environment       U               => ${HOME}/GPSUSER52
 9: Path to temp. user environment T               => ${HOME}/GPSTEMP
10: Path to campaign area          P               => ${HOME}/GPSDATA/CAMPAIGN52
11: Path to datapool area          D               => ${HOME}/GPSDATA/DATAPOOL
12: Path to savedisk area          S               => ${HOME}/GPSDATA/SAVEDISK

Accept the values (y/n): y

**********************************************************************
* /Users/gorisk/BERN52/GPS/EXE/LOADGPS.setvar
* has been updated.
**********************************************************************

Press Enter to continue  

We need to setup the config file LOADGPS.setvar 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.

Note that I used for QTBERN the Macports path of QT4:
export QTBERN=”/opt/local/libexec/qt4/”

in $HOME/BERN52/GPS/EXE/LOADGPS.setvar

Now that the installer has created the LOADGPS.setvar in file we want to load these BERNESE variables by sourcing it out:

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

This command loads the various variables to your shell.

Compile the programs

First we want to try to compile the (FORTRAN) programs by selecting the point 5 in the configuration menu.

Note: Don’t install the online updates first!
First compile the (fortran) programs before installing the online updates! Installing the online updates before compiling the programs gives you a lot of errors.

==========================================
CONFIGURATION OF THE BERNESE GNSS SOFTWARE
==========================================
 0 ... Complete installation (Steps 1 to 5)
 1 ... Update LOADGPS.setvar
 2 ... Install online updates
 3 ... Add a new user environment
 4 ... Compile the menu
 5 ... Compile the programs
 6 ... Install the example campaign
 7 ...   ---

 x ... Exit

Enter option: 5

Running the compilation of the Fortran programs.
This can take a while...
It depends on the computer performance.

All compilation output is redirected into file
/Users/gorisk/BERN52/GPS/EXE/COMPLINK.log

Press Enter to continue and try to install the online updates
(first compile the programs before installing the online updates !!!)

2. Let’s install the online updates

==========================================
CONFIGURATION OF THE BERNESE GNSS SOFTWARE
==========================================
0 ... Complete installation (Steps 1 to 5)
1 ... Update LOADGPS.setvar
2 ... Install online updates
3 ... Add a new user environment
4 ... Compile the menu
5 ... Compile the programs
6 ... Install the example campaign
7 ...   ---

x ... Exit

Enter option: 2

Updated files will be extracted to:
/Users/gorisk/BERN52

If you made changes in the Bernese source code, you can specify
an alternative directory and merge the updated files manually
into your version to keep your changes.

Extract the files to /Users/gorisk/BERN52 (y/n): y
x BPE/
x BPE/bpe_util.pm
x BPE/RUNBPE.pm
x GPS/
x GPS/SCRIPT/
....
....
****************************
Source code update completed.
****************************

To ensure that the Makefile containing all dependencies of the source files is up-to-date you should run:
'$X/EXE/makemake.pl -r $C'

I just executed:

#cd /Users/gorisk/BERN52/GPS/EXE
#perl makemake.pl -r $C

makemake.pl started at: Fri Dec 20 14:34:36 2019 (1334Z)

'/Users/gorisk/BERN52/LIB/OBJ_GNU/Makefile'
'/Users/gorisk/BERN52/LIB/OBJ_GNUc/Makefile'

Then recompile the software using ${X}/EXE/configure.pm, or
run the Perl script:

#${X}/EXE/cbern.pl COMPLINK

or

#cd /Users/gorisk/BERN52/GPS/EXE
#perl cbern.pl COMPLINK

Now quit the configuration menu (enter ‘x’) and recompile the fortran programs with its online updates:

#${X}/EXE/cbern.pl COMPLINK

This will take some time for compiling the programs.

3. Compile BERNESE MENU

Update: 2019.12.20

Before we continue to compile the menu, we should edit the menu.pro file:

~/BERN52/MENU/menu.pro

to avoid getting menu compilation errors:

1.In

$HOME/BERN52/MENU/menu.pro

just comment the line:

QMAKE_LFLAGS += -static-libgcc

to:

# On Darwin: don't use -static-libgcc
##QMAKE_LFLAGS += -static-libgcc

2. comment out the line as follows:

QMAKE_LIBS += -lz

Launch the configure.pm script from your $HOME/BERN52/GPS/EXE folder:

#source ~/.bash_profile
#cd ~/BERN52/GPS/EXE/
#perl configure.pm
Choose option "4 ... Compile BERNESE Menu".

It should hopefully compile correctly the menu and the FORTRAN programs!

Build errors, anyone ?

If you get build errors for the Menu, check the build-log file in ~/BERN52/MENU/MENUCOMP.log.

If you get the error

Undefined symbols: "_compress"...

then follow the steps in chapter “3. Compile BERNESE MENU” and edit

$HOME/BERN52/MENU/menu.pro

Alternatively you can edit directly the Makefile:

$HOME/BERN52/MENU/Makefile

and add

"-lz"

at the end of the LIBS flags.

But you should first clean the directory ~/BERN52/MENU and invoke the commands:

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

If you get the error

"-static-libgcc"

in ~/BERN52/MENU/MENUCOMP.log then then again follow the steps in Chapter “3. Compile BERNESE MENU” by editing

$HOME/BERN52/MENU/menu.pro

or remove “-static-libgcc” from LFLAGS in

$HOME/BERN52/MENU/Makefile

My $HOME/BERN52/MENU/Makefile looks like this (on MacOS X 10.11)

#LFLAGS = -headerpad_max_install_names -static-libgcc -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.11
LFLAGS  = -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.11

My $HOME/BERN52/MENU/Makefile looks like this (on macOS 10.13)

#LFLAGS = -headerpad_max_install_names -static-libgcc -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.13
LFLAGS  = -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.13

LIBS  = $(SUBLIBS) -F/opt/local/libexec/qt4/Library/Frameworks -F/opt/local/libexec/qt4/lib  -F/opt/local/libexec/qt4/Library/Frameworks -F/opt/local/libexec/qt4/lib -L/opt/local/libexec/qt4/lib -framework Qt3Support -F/opt/local/Library/Frameworks -framework QtSql -framework QtCore -framework QtXml -framework QtGui -framework QtNetwork -lz

After applying these changes just recompile the menu source code with the 'make' command (don't execute the configure.pm command for the MENU, or else it will overwrite again your $HOME/BERN52/MENU/Makefile file). 
cd ~/BERN52/MENU/
#make clean
#make mocclean
#make

After successful menu compilation in $HOME/BERN52/MENU, try to compile the P

#cd ~/BERN52/GPS/EXE/
#perl configure.pm

Fortran compile errors after applying updates

If you have applied the updates with “option 2” from the and you get a program compilation error, then you need first to update the dependencies.

According to the README/Updates.txt file:

“…to activate those changes, you need a Fortran compiler (specified with the environment variable “F_VERS”) and the Make utiltiy.
To ensure that the Makefile containing all dependencies of the source files is up-to-date you should run ‘$X/EXE/makemake.pl -r $C’ previously.”

So just execute the following command to update the dependencies:

'perl $X/EXE/makemake.pl -r $C'

or

'perl $HOME/BERN52/EXE/makemake.pl -r $C'

After succesful compilation

Launch BERNESE MENU

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

#G

A X11 Window pops up and the BERNESE Menu appears. Enjoy!