Skip to content

GDL on OSX

Giloo edited this page Dec 31, 2022 · 31 revisions

Way 0

GDL is available from:

  • Homebrew thanks @fxcoudert
  • Macports: known as gnudatalanguage, version 1.0.0-rc3 thanks @tenomoto -- version for M1 available
  • Fink, thanks @Seb

But watch carefully, those distributions may be well out-of-date by now, as GDL is continuously improving (see what happened on our Github repo since)

So the easiest now is, since #1457, to just download the unstable weekly DMG and use it.

Or the stable one, see Releases

or Way 1

  1. de-activate any conda (miniconda, anaconda) related env.
  2. install Homebrew using the one-liner command
  3. Using Brew, install the required libraries (cmake, g++ ...).
  4. Download the gdl code, and run gdl/scripts/build_gdl.sh several times:
  • build_gdl.sh prep will install the required libraries.
  • build_gdl.sh configure will prepare the make file for compilation in next step.
  • build_gdl.sh build will build gdl in build
  • build_gdl.sh install.

This is the simplest way.

GDL is built with wxWidgets graphic interface, but the X11 graphic windows are still there and can be called by a switch in the gdl command, see output of gdl -h

This script is very frequently tested on OSX 10.14.6 and 11.3. Brew may have side effects (updates are frequent and quite long, may have conflict if machine with multi-users, projects asking for login/pass). Usually just reading the messages, using 'brew doctor', passing when login/pass should be enough.

A summary working on up-to-date 10.14.6 & 11.3, assuming : Xcode up-to-date, you are sudo for Brew :

brew install git
brew install cmake
git clone https://github.com/gnudatalanguage/gdl
cd gdl
bash scripts/build_gdl.sh prep
bash scripts/build_gdl.sh configure
bash scripts/build_gdl.sh build

FYI, the current version version of CLang (the C/C++ compiler used in the script by default) is now broken in up-to-date OSX 10.14.6

or Way 2

  • rebuild GDL using fresh libraries from your favorite brew/fink... , the GDL current sources, and cmake. Make sure you read "Compilation notes" below, some things are tricky.

notes

  • GDL uses plplot. plplot NEEDS to be compiled with option DYNDRIVERS=ON . This is not what Brew or other installers provide. You need to recompile and install plplot. The script build_gdl.sh of 'Way 1' does it, applying patches in gdl/scripts/deps/macos .

  • You may need to MAKE GDL AN APP. It is often recommended that a program be put in a app, see this topic . At the moment, GDL does not build as a nice app. But if you use a widget that needs to type some text in text areas or comboboxes, etc, you MUST call gdl as an app. The simplest form of an App is just a serie of directories: ./gdl/Contents/MacOS/gdl where gdl is a link to the installed gdl : ln -s ./gdl/Contents/MacOS/gdl /somewhere/local/bin/gdl In other words, calling gdl as /somewhere/local/bin/gdl will not pass keyboard events to widgets, callg gdl as ./gdl/Contents/MacOS/gdl will. Contributions welcome to get a real App !

  • Recent changes in GDL have permitted an 'unified' version compilable indifferently under linux, mac OSX and Windows. It uses wxWidgets for graphics and widgets, on Mac OSX forget X11, welcome wxmac! (but the X11 windows are still available, see how in gdl -h)

compilation notes

  • Depending of OSX version, default Clang may or not come with OpenMP. If OpenMP is not around, we need to deactivated it :
cmake . [others flags] -DOPENMP=OFF

but, having OpenMP, Eigen and compiling GDL in Release (-O3) mode are the only way to have a GDL on par with IDL for speed.

  • Readline. Editline is not fully compliant with Readline but it wrongly made symbolic links with readline headers files. Very dangerous. You must install a clean Readline lib. around (the one provided by Brew is OK) then cleanly link to it :
cmake . [others flags] -DREADLINEDIR=/usr/local/opt/readline/
  • An example working (tested) on OSX 10.11, 10.12 & 10.14 (with Readline provided by Brew, and Cmake >= 3.0) :
git clone https://github.com/gnudatalanguage/gdl
cd gdl
mkdir build
cd build
cmake .. -DREADLINEDIR=/usr/local/opt/readline/ -DOPENMP=OFF -DGEOTIFF=OFF -DHDF=OFF  -DUDUNITS2=OFF -DGRIB=OFF -DGLPK=OFF 
make -j 4

But in the above, you can remove -DGEOTIFF=OFF -DHDF=OFF -DUDUNITS2=OFF -DGRIB=OFF -DGLPK=OFF provided you have installed the corresponding library. Each time you add a library and call cmake to recompile: it is mandatory to clean the cache before running again cmake (rm -f CMakeCache.txt)

Git issues

Since an upgrade of OSX, my git pull was not OK any more (and the ssh -X too ... stupid system). A effective solution for Git was : git config --global url.https://github.com/.insteadOf git://github.com/ (from stackoverflow

Clone this wiki locally