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:

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

Prerequirements

  • Xcode command line tools. Install with command:
    xcode-select --install
  • Recommnded (not required): Apple Xcode Development Tools (free) / requires AppleID account to download freely from Mac AppStore. Tip:Check XCode Releases site to verify which version you need https://xcodereleases.com
  • Required: QT4 UI framework from Macports or Homebrew
  • Required: Install gfortran 6.x+ or later

Contents

1a. Install QT4 from Macports

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

The easiest way to install QT4 is via Macports:
#sudo port selfupdate
#sudo port install qt4-mac

QT4 from Macports is installed in directory

/opt/local/libexec/qt4

.
However qt_menu.nib is 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 GNU-Fortran gfortran

To compile BERNESE Fortran programs on macOS the easiest way is to install GNU’s gfortran application with a nice macOS Installer from https://github.com/fxcoudert/gfortran-for-macOS/releases.
Choose your gfortran by considering its macOS version number (note: gfortran 8.2 Mojave also works on macOS 10.13)…

After installation the gfortran application is installed in directory:

/usr/local/gfortran/bin/gfortran

Don’t forget to update your PATH
of your shell environment, e.g in .bashrc:
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11/bin:/usr/local/gfortran/bin/

1c. 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/

2. Launch setup.sh

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

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

***************************************
*        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 with 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 => YOUR_HOSTNAME.local
 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.

3. Exit Configuration Menu and edit 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.

4. Compile the FORTRAN 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

5. Install the online updates

Check BERNESE update page:
Press Enter to continue and try to 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'

To update the source files and all its dependencies just execute the following command:
#perl /Users/gorisk/BERN52/GPS/EXE/makemake.pl -r $C

The output is be:

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:
#perl /Users/gorisk/BERN52/GPS/EXE/cbern.pl COMPLINK

Now quit the configuration menu (enter ‘x’) and recompile the fortran programs with its online updates:
#perl ~/BERN52/GPS/EXE/cbern.pl COMPLINK

This will take some time for compiling the Fortran source code.

6. Compile BERNESE MENU

To avoid getting errors when compiling Menu edit the Qt4-file

~/BERN52/MENU/menu.pro

and after the lines:

QMAKE_LFLAGS += -static-libgcc
#QMAKE_LIBS += -lz

add the following lines:

# For macOS
# -----------------------
macx {
  # Disable macOS Apple Bundle creation: Don't create the "menu_tmp.app"
  # since it's a link to 'menu' inside menu_tmp.app/Contents/MacOS/menu anyway.
  CONFIG-=app_bundle
  # Don't use -static-libgcc on macOS
  QMAKE_LFLAGS -= -static-libgcc
  # Use libzip
  QMAKE_LIBS += -lz
}

Or just remove:

  • a. -static-libgcc by commenting out the line:
    QMAKE_LFLAGS += -static-libgcc
    to:
    # On macOS (Darwin): don't use -static-libgcc
    ##QMAKE_LFLAGS += -static-libgcc
  • b. Append ZIP-library (-lz) to QMAKE_LIBS by commenting out the line as follows:
    QMAKE_LIBS += -lz

To recompile the MENU source code with this new changes,

  • simply execute the command:
    perl ~/BERN52/GPS/EXE/cmenu.pl
  • or launch the configuration again from your $HOME/BERN52/GPS/EXE folder:
    #source ~/.bash_profile
    #perl ~/BERN52/GPS/EXE/configure.pm

    Then choose option: “4 … Compile BERNESE Menu”.
  • It should compile correctly the Menu.

    7. Build errors, anyone ?

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

    If you get the error:

    Undefined symbols: "_compress"...

    then follow the steps in chapter “6. Compile BERNESE MENU” by editing

    $HOME/BERN52/MENU/menu.pro

    If you get the error:

    "-static-libgcc"

    in

    ~/BERN52/MENU/MENUCOMP.log

    then follow the steps in chapter “6. Compile BERNESE MENU” by editing:

    $HOME/BERN52/MENU/menu.pro

    After applying these changes clean the directory ~/BERN52/MENU by executing the commands:
    Don’t execute the configure.pm command for the MENU, or else it will overwrite your $HOME/BERN52/MENU/Makefile file.

    Just recompile the menu source code with command:
    #make
    or execute the perl script:
    #perl ~/BERN52/GPS/EXE/cmenu.pl

    8. Fortran compile errors after applying updates

    If you have applied the updates from the Configure Menu (“option 2”) 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 $HOME/BERN52/GPS/EXE/makemake.pl -r $C

    9. 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!

    Go back to contents

Comments are closed.