Page MenuHomePhabricator

OpenMP not working on OSX
Closed, WontfixPublic

Description

When trying to build MITK with OpenMP (needed e.g. for MITK Diffusion) it does not build on OSX High Sierra (compiler: clang). Worked in previous OSX versions but not in the recent one anymore.

Event Timeline

wasserth triaged this task as Normal priority.Feb 14 2018, 10:06 AM
wasserth created this task.
wasserth added a subscriber: kislinsk.

@wasserth Could you provide the error logs?

Error Message: clang: error: unsupported option '-fopenmp'

On High Sierra in clang / LLVM 9.0.0 "-fopenmp" is no longer supported. Manually installing OpenMP does not help, because the flag simply is not supported anymore.
Using gcc-7 would allow using OpenMP, however, the MITK build (target: workbench-release) fails with the following error:

Scanning dependencies of target vtkfreetype
[ 34%] Building C object ThirdParty/freetype/vtkfreetype/CMakeFiles/vtkfreetype.dir/src/base/ftbase.c.o
In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32:0,
                 from /System/Library/Frameworks/Security.framework/Headers/Security.h:43,
                 from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43,
                 from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27,
                 from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23,
                 from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22,
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39,
                 from /Users/jakob/dev/MITK-sb-workbench-gcc/ep/src/VTK/ThirdParty/freetype/vtkfreetype/src/base/ftmac.c:100,
                 from /Users/jakob/dev/MITK-sb-workbench-gcc/ep/src/VTK/ThirdParty/freetype/vtkfreetype/src/base/ftbase.c:38:
/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope
  char bytes[kAuthorizationExternalFormLength];
       ^~~~~
In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:18:0,
                 from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
                 from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
                 from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
                 from /Users/jakob/dev/MITK-sb-workbench-gcc/ep/src/VTK/ThirdParty/freetype/vtkfreetype/src/base/ftmac.c:101,
                 from /Users/jakob/dev/MITK-sb-workbench-gcc/ep/src/VTK/ThirdParty/freetype/vtkfreetype/src/base/ftbase.c:38:
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFont.h:53:40: error: initializer element is not constant
 static const CGFontIndex kCGGlyphMax = kCGFontIndexMax;
                                        ^~~~~~~~~~~~~~~
In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:21:0,
                 from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
                 from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
                 from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
                 from /Users/jakob/dev/MITK-sb-workbench-gcc/ep/src/VTK/ThirdParty/freetype/vtkfreetype/src/base/ftmac.c:101,
                 from /Users/jakob/dev/MITK-sb-workbench-gcc/ep/src/VTK/ThirdParty/freetype/vtkfreetype/src/base/ftbase.c:38:
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:391:15: error: expected identifier or '(' before '^' token
 typedef void (^CGPathApplyBlock)(const CGPathElement * element);
               ^
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:393:53: error: unknown type name 'CGPathApplyBlock'
 CG_EXTERN void CGPathApplyWithBlock(CGPathRef path, CGPathApplyBlock CF_NOESCAPE block)

Installing clang 5.0.1 would allow using OpenMP, however, the MITK build (target: workbench-release) fails with the following error:

CMake Error at Applications/Matcher/CMakeLists.txt:11 (target_compile_features):
  target_compile_features no known features for CXX compiler

  "Clang"

  version 5.0.1.

Is there some kind of intended replacement for clang? What is the go-to way for other tools?

Alternative is to install clang via Homebrew:

brew install llvm

One have to change the C and CXX compiler in CMake to something like /usr/local/opt/llvm/bin/clang and maybe set some more paths. See http://antonmenshov.com/2017/09/09/clang-openmp-setup-in-xcode/.

kislinsk claimed this task.
kislinsk added a project: Auto-closed.

Hi there! 🙂

This task was auto-closed according to our Task Lifecycle Management.
Please follow this link for more information and don't forget that you are encouraged to reasonable re-open tasks to revive them. 🚑

Best wishes,
The MITK devs

kislinsk removed kislinsk as the assignee of this task.May 26 2020, 12:05 PM
kislinsk removed a subscriber: kislinsk.