Building on Mac 10.14 Mojave

Both home brew and the Qt download were 5.11 (both 5.11.2 I believe).

I used 5.10 and it didn’t work. Will try with brew and 5.11 again.

I built Slicer with Qt 5.11.2 (downloaded and installed from Qt) and set CMAKE_OSX_DEPLOYMENT_TARGET=10.14

Sadly, it’s not working that way either for me.

image

While starting I get the following warning.

Warning: In /Users/herzc/sources/cpp/Slicer/Libs/MRML/DisplayableManager/vtkMRMLThreeDReformatDisplayableManager.cxx, line 99
vtkMRMLThreeDReformatDisplayableManager (0x7faeea1000e0): Widget outline mode not available

Some more details on my environment:

XCode Version 10.1 (10B61)
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

This error is logged when you use VTK7 or older. We have switched to VTK8 long time ago and just keep VTK7 compatibility to allow building with Qt4 + legacy OpenGL rendering backend.

Can you double-check your VTK version by executing print(vtk.vtkVersion().GetVTKVersion())?

If you don’t get VTK version 8.2.0 then double-check your build scripts to make sure you don’t force Slicer to use VTK 7.

You are right! It’s using VTK version 7.1.0

image

For some reason CMake did not set Slicer_VTK_VERSION_MAJOR to “8” after I set Qt5_DIR.

If I set Slicer_VTK_VERSION_MAJOR to “8” before setting CMAKE_OSX_DEPLOYMENT_TARGET it configures correctly (also asking for Qt version > 5.6).

Will do a fresh build now again.

You need to set Qt5_DIR before configuring your project as described in build instructions. We’ll disable Qt4/Vtk7 build in the master right after releasing 4.10.1 (within days), which will prevent this error.

Ok that’s good to know for the next time! Thanks a lot.

It worked!
image

1 Like

FYI: xcode-select --install doesn’t install the headers. You have to install macOS_SDK_headers_for_macOS_10.14.pkg to get the headers. This should be added to the build instructions for Slicer. Where is that now? This page seems pretty out of date now.

@che85: did you also change the version of Qt you were using? Changing vtk version alone cannot fix the huge buttons problem? I’ve had the huge button problem with two other applications I’m working on, one of them not even using vtk. I think it is a problem with the management of retina (hi-dpi) vs. non-retina displays.

I use only Qt binaries from www.qt.io and get the huge button problem on Mojave if I use any version above 5.9.* which was the last LTS version before 5.12. Maybe the 5.12.1 binary fixes the problem but I haven’t tried. The fact that @pieper had success with Qt > 5.9 suggests that there is something in the build process rather than in the version of Qt itself that causes the problem. Perhaps the deployment target? Binaries from qt.io have a minimum osx version of 10.10. Building Qt for 10.14 might fix the problem. Does anybody have better insights into this problem so that we can come up with clear build instructions?

@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.