Building on Mac 10.14 Mojave

@pieper, @lassoan, @che85, @jcfr, does one of you have write access to the Slicer build instruction page here? It would be nice to add a comment on the need to install the header package (macOS_SDK_headers_for_macOS_10.14.pkg) to build Slicer. xcode-select --install alone still doesn’t install the headers.

Thanks for the reminder.

Here it is: https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#Mac_OSX_10.14_.28Mojave.29

If you create a wiki account, I will make sure it is approved and you should be able to improve further.

I ran into this the other day and filed an issue with a workaround to specify the SDK version. It turns out Apple deprecated /usr/include. I updated the wiki with what I think it the preferred solution for now.

Thanks Steve. I will submit a PR to update the build system, it should be quite straightforward.

1 Like

Hi,

Has anybody tried to install gfortran in MacOS 10.14? I was able to build Slicer no problem thanks to this thread, but now I cant build SALT in my new Macbook pro since Xcode 10 has no gfortran. SPHARM still depends on this compiler.

This tutorial explains in great detail how to install gcc9 (includes gfortran), but I wanted to check in first with you guys in case somebody has tried other ones successfully…

Thanks!
Bea

I have not used gfortran in a long time.

I’d recommend using homebrew. “brew install gcc”

If you meant “gfortran” specifically:

GNU Fortran is part of the GCC formula:

brew install gcc

Hans

Thanks @hjmjohnson
Is gcc part of XCode or it got deprecated, favoring clang instead?

Xcode is only Clang by default (and has been for many years now).

Gcc is not distributed with MacOSX directly. You need to install it using homebrew (or other approaches).

Gotcha. Also, it worked like a charm.
Thanks!

Hi

I seem to be running into a problem building Slicer on Mojave. Slicer builds without any errors but when I try to run it, I get the following error:

dyld: malformed mach-o: load commands size (34376) > 32768

2019-08-19 14:11:49.981 Slicer[92126:1188397] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.

error: [/Users/Priya/Project/Slicer-latest/Slicer-Superbuild-Debug/Slicer-build/bin/Slicer.app/Contents/MacOS/./Slicer] exit abnormally - Report the problem.

Is there any log file created to investigate the problem? Details of build as follows:

Qt version: Tried 5.11 and 5.13 - same problem exists
Mac OS: 10.14.6

Priya

There is a limit on total number and length of paths in a build project (reasons and limits vary on different operating systems and compilers). To avoid such issues we use short path for source and build directories.

Which version of QT should be used?

In the instructions there appear three:
For building Slicer: download and execute qt-unified-mac-x64-online.dmg, install Qt 5.10

  • Install Qt 5.11.2 using Qt Online Installer for macOS
  • Build qt from homebrew
    brew install qt ccmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 -DQt5_DIR=/usr/local//Cellar/qt/5.13.2/lib/cmake/Qt5 ~/slicer/latest/Slicer

You can find out if a specific version is working by getting the version of Qt used in the current Slicer nightly for macOS. Open Slicer and in the python interactor run

qt.qVersion()

This is currently version 5.10.0 on macOS. Then generally anything on the same line of 5.10.x is likely to work while anything newer than 5.10 is something experimental and you will have to try on your own.

I use 5.14.1 from homebrew on my mac builds and it’s fine.

1 Like