Installation:Mac

From GeopsyWiki
Jump to navigation Jump to search

Binary package

If it is available for your OS version download the DMG archive and install it.

  • Remove previously installed releases by cleaning
 /Applications/Geopsy.org
 /Library/Geopsy.org
  • Copy
 Applications/Geopsy.org  ==> /Applications
 Library/Geopsy.org       ==> /Library
  • To use the command line tools, modify your .zshrc file like this:
 echo "export PATH=/Applications/Geopsy.org/3.3/Utilities:\$PATH" >> ~/.zshrc

Notes

  • replace "3.3" by the actual branch number
  • .zshrc is a startup script for zsh , an extension of bash found on Catalina. To get the current shell, run:
 echo $SHELL

Source package

Compiling from the source package may be an option if the binary package is not yet available for your OS version. It takes a bit longer and requires several steps. Once a build environment is ready updates are relatively straight forward. Getting Xcode, Qt and compiling FFTW are required only once. When updating from a previous Geopsy release you can skip these steps and go directly to Geopsy package. As a general comment, do not move directories after their installation, prefer a new installation instead.

Defining the branch and the version

The current branch and the current version are defined by the following variables

 export GEOPSY_BRANCH=3.3
 export GEOPSY_VERSION=3.3.6

To preserve these variables in sudo environment, option -E is systematically added to sudo -s.

Xcode

It is the official compiler provided by Apple. It is available free of charge from the App Store if you create an account.

From a terminal, run:

 clang++ --version

You should get something like:

 Apple clang version 12.0.0 (clang-1200.0.32.2) 
 Target: x86_64-apple-darwin19.6.0
 Thread model: posix
 InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

If so, you can skip this step. If not, download Xcode from the App Store. It may take several tens of minutes. Be patient. Do not click on square stop button. The progress is indicated by a growing arc of circle. Upon completion, the progress/stop button is replaced by "Open".

Start Xcode graphical interface to accept the license agreement and finish the installation of some additional components. When ready, quit Xcode and check the availability of clang++ in a terminal.

Qt

This is an interface library that provides portability to virtually all platforms. A binary package for Mac OS can be downloaded from Qt. Go to "Download. Try. Buy.". Under "Downloads for open source users", click on "Go open source". Go to the bottom of the page and click on "Download the Qt Online Installer". Click on "Download" button.

A Qt DMG file should be available in your Download directory. Open the DMG file and launch "qt-unified-mac-x64-...-online". A Qt account is required to proceed with the installation. A new one can created within the installer. Once logged in, accept the Qt Open Source Usage Obligations.

By default Qt is installed in "~/Qt" but other locations can be chosen. This tutorial assumes that Qt is installed in "~/Geopsy/Qt-5.14". Qt provide a lot of components, to get the minimal footprint, select only one Qt version and inside this version, only "macOS" (Qt 5.14.2 for this tutorial). After the license agreement, the installation should start. Do not launch Qt Creator at the end.

In a terminal, add Qt path to your profile:

 echo "export PATH=~/Geopsy/Qt-5.14/5.14.2/clang_64/bin:\$PATH" >> ~/.zshrc

Update your current environment:

 source ~/.zshrc

qmake should be available:

 qmake -v
 QMake version 3.1
 Using Qt version 5.14.2 in /Users/wathelem/Geopsy/Qt-5.14/5.14.2/clang_64/lib

To run Qt graphical applications some files must be copied to a specific system path.

 sudo mkdir -p /Library/Geopsy.org/${GEOPSY_BRANCH}/plugins
 cd ~/Geopsy/Qt-5.14/5.14.2/clang_64/plugins
 sudo cp -r platforms imageformats  /Library/Geopsy.org/${GEOPSY_BRANCH}/plugins

FFTW

Fastest Fourier Transform of the West.

FFTW >= 3.0.1 is required. Version 3.3.5 has been successfully tested.

Download the archive from FFTW.

Unpack it

 cd ~/Geopsy
 tar xvf ~/Downloads/fftw-3.3.5.tar
 cd fftw-3.3.5

Safari automatically uncompresses it, if not, use instead

 tar xvfz ~/Downloads/fftw-3.3.5.tar.gz

Configure FFTW with these specific flags:

 SDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
 export CFLAGS="-fPIC -arch x86_64 -isysroot $SDK -mmacosx-version-min=10.13"
 export LDFLAGS="-arch x86_64 -Wl,-syslibroot,$SDK -mmacosx-version-min=10.13"
 ./configure

Then finally, run into compilation (less than a minute):

 make -j 8

Geopsy package

Download the source package (the same as for Linux) or access the Git repository. The first option is detailed in this tutorial.

Unpack the archive

 cd ~/Geopsy
 tar xvf ~/Downloads/geopsypack-src-${GEOPSY_VERSION}.tar

The original archive is compressed but Safari automatically uncompresses it before leaving it in "Downloads". If not, run instead

 tar xvfz ~/Downloads/geopsypack-src-${GEOPSY_VERSION}.tar.gz

A source tree is now ready for the configure step

 cd geopsypack-src-${GEOPSY_VERSION}
 ./configure -builddir ~/Geopsy/build/src-${GEOPSY_VERSION}/Qt-5.14 -bindir /Applications/Geopsy.org/${GEOPSY_BRANCH} \
             -libdir /Library/Geopsy.org/${GEOPSY_BRANCH}/Frameworks -sharedir /Library/Geopsy.org/${GEOPSY_BRANCH}/share \
             -incdir /tmp/Geopsy -I ~/Geopsy/fftw-3.3.5/api -L ~/Geopsy/fftw-3.3.5/.libs \
             -no-pch -march native

Go to the build directory and run make (adjust -j option to the number of available cores):

 cd ~/build/src-${GEOPSY_VERSION}/Qt-5.14
 make -j 8

It takes a little while. You can have a coffee or two. If it stops before the end with an error, write a post on geopsy forum. Once the compilation reaches the end without error, you can install in the destination paths:

 sudo make install

If you do not want to overwrite your currently running Geopsy in /Application and /Library, you can run instead

 sudo make install INSTALL_ROOT=/tmp/geopsypack

Note that the rpath of the generated applications is still pointing to /Library/Geopsy.org/${GEOPSY_BRANCH}/Frameworks. They can run only if the libraries are moved to their correct locations.

That's it! You can try to run your geopsy applications from the Finder under /Applications/Geopsy.org. The installation produces undesirable files directed to /tmp/Geopsy. You can safely remove them.

 sudo rm -rf /tmp/Geopsy

Geopsy plugins

Plugins are installed by make inside /Library/Geopsy.org/${GEOPSY_BRANCH}/Frameworks. To get the same structure as a binary package, you can move them to "plugins".

 sudo find /Library/Geopsy.org/${GEOPSY_BRANCH}/Frameworks -name "*.dylib" -exec mv {} /Library/Geopsy.org/${GEOPSY_BRANCH}/plugins ';'

The final touch

If you want to use graphical applications from a terminal, you can add symbolic links this way.

 sudo -s -E
 rm -rf /Applications/Geopsy.org/${GEOPSY_BRANCH}/Utilities
 mkdir /Applications/Geopsy.org/${GEOPSY_BRANCH}/Utilities
 for APP in $(find /Applications/Geopsy.org/${GEOPSY_BRANCH} -name "*.app"); do
   APP_NAME=$(basename $APP .app)
   ln -s $APP/Contents/MacOS/$APP_NAME /Applications/Geopsy.org/${GEOPSY_BRANCH}/Utilities/$APP_NAME 
 done
 exit

If you want to move all core command line tools into Utilities, you have to run after each "make install":

 sudo find /Applications/Geopsy.org/${GEOPSY_BRANCH} -maxdepth 1 -type f -exec mv {} /Applications/Geopsy.org/${GEOPSY_BRANCH}/Utilities ';'


Define the PATH in the same way as described for binary packages.

Going further

Was it successful? If you want to participate in this project, your binaries can be packed in a DMG archive and distributed to other users. Contact us for details.

Building a DMG file

Clean and make sure that the Framework directory contain only the right files

 sudo -s -E
 rm -rf /Library/Geopsy.org/${GEOPSY_BRANCH}/Frameworks
 cd ~/build/src-${GEOPSY_VERSION}/Qt-5.14
 make install

Qt libraries must be added to a self-consistent package. We copy only the required libraries to /Library. Everything must run under 'root'.

 for LIB in Core DBus Gui Widgets Network Qml Svg Xml PrintSupport; do
   cp -RPp ~/Geopsy/Qt-5.14/5.14.2/clang_64/lib/Qt${LIB}.framework /Library/Geopsy.org/${GEOPSY_BRANCH}/Frameworks
 done
 rm -f /Library/Geopsy.org/${GEOPSY_BRANCH}/Frameworks/*.a
 cp ~/Geopsy/geopsypack-src-${GEOPSY_VERSION}/LICENSE.* /Library/Geopsy.org/${GEOPSY_BRANCH}
 cp ~/Geopsy/geopsypack-src-${GEOPSY_VERSION}/INSTALL.MAC /Library/Geopsy.org/${GEOPSY_BRANCH}
 exit

The original Qt directory can be moved or deleted, the applications will continue to work.

Create the DMG file

 rm -rf /tmp/GeopsyVolume
 mkdir -p /tmp/GeopsyVolume/Applications/Geopsy.org/${GEOPSY_BRANCH}
 mkdir -p /tmp/GeopsyVolume/Library/Geopsy.org/${GEOPSY_BRANCH}
 cp -RPp /Library/Geopsy.org/${GEOPSY_BRANCH}/* /tmp/GeopsyVolume/Library/Geopsy.org/${GEOPSY_BRANCH}
 cp -RPp /Applications/Geopsy.org/${GEOPSY_BRANCH}/* /tmp/GeopsyVolume/Applications/Geopsy.org/${GEOPSY_BRANCH}
 cp -RPp /Library/Geopsy.org/${GEOPSY_BRANCH}/LICENSE.* /tmp/GeopsyVolume/Library/Geopsy.org/${GEOPSY_BRANCH}
 cp -RPp /Library/Geopsy.org/${GEOPSY_BRANCH}/INSTALL.MAC /tmp/GeopsyVolume/Library/Geopsy.org/${GEOPSY_BRANCH}/INSTALL
 cp -RPp /Library/Geopsy.org/${GEOPSY_BRANCH}/LICENSE.* /tmp/GeopsyVolume/
 cp -RPp /Library/Geopsy.org/${GEOPSY_BRANCH}/INSTALL.MAC /tmp/GeopsyVolume/INSTALL
 hdiutil create -volname geopsypack-mac-catalina-${GEOPSY_VERSION} -srcfolder /tmp/GeopsyVolume -ov -format UDZO geopsypack-mac-catalina-${GEOPSY_VERSION}.dmg
 rm -rf /tmp/GeopsyVolume

Trouble shooting

Qt 5.15.1, geopsypack 3.3

  • For applications started from the command line, the top menu bar does not respond correctly. Fix it by activating another application and return to geopsy application. It should be fixed.
  • Errors are encountered while compiling geopsypack-3.3.2 with Qt-5.15. geopsypack-3.3.3-preview fixes some issues but not all.
  • Errors are encountered while compiling geopsypack-3.3.3-preview (git) with Qt-5.15.

Qt 5.15.2, geopsypack 3.3.6

  • Successful compilation for Big Sur on Intel

Big Sur and M1 architecture

  • Noticed that configure option "-march native" is generating error. Try configure without this option.
  • A successful compilation has been reported for geopsypack 3.3.6 and Qt 5.15.2 under Big Sur M1 when the option "-march native" is not used when configuring geopsypack.

Qt from Homebrew

[ waiting feedback ]