I am trying hard since a while already to compile VTK 8.2.0 with CMake 3.16.0, Qt 5.9.1 and MacPorts gcc7 7.4.0_3 on MacOS Mojave, i.e. with MacOSX10.14.sdk (Xcode), but I can’t get it to work. I had the same problems already with MacOS High Sierra and gcc 4.9.
I get it configured and generated by cmake successfully, but it always fails with a compilation (see log below). This is very annoying for us as it currently prevents us from using VTK. Any ideas or any hints on how to compile and use VTK on MacOS? Any help or hints are appreciated!
I took these steps so far:
VTK-8.2.0.tar.gz is unpacked into:
/Users/Shared/Development/VTK-8.2.0/source
CMake build directory is configured as:
/Users/Shared/Development/VTK-8.2.0/build
In CMake, I first specified these native compilers:
CMAKE_C_COMPILER: /opt/local/bin/gcc-mp-7
CMAKE_CXX_COMPILER: /opt/local/bin/g+±mp-7
Then, I configured these variables:
CMAKE_PREFIX_PATH=/Users/Shared/Qt5.9.1/5.9.1/clang_64
BUILD_TESTING=TRUE
CMAKE_BUILD_TYPE=Release
CMAKE_INSTALL_PREFIX=/Users/Shared/Development/VTK-8.2.0/install
CMAKE_OSX_ARCHITECTURES=x86_64
CMAKE_OSX_DEPLOYMENT_TARGET=10.9
CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
VTK_Group_Qt=TRUE
Then after pressing “Configure” a couple of times until no entry was red anymore, I press “Generate” and then call “make” in the path /Users/Shared/Development/VTK-8.2.0/build in a Terminal.
This compiles successfully until about 45% and then aborts with an error (see log below).
Note that the problem might be related to:
Parallel VTK 8.2 failed to build with gcc-8 on MacOS 10.14
http://vtk.1045678.n5.nabble.com/Build-error-VTK-6-2-Mac-OS-X-10-10-4-GCC-4-9-td5732749.html
Has anyone any ideas?
=== Build log:
...
[ 44%] Building C object ThirdParty/zlib/vtkzlib/CMakeFiles/vtkzlib.dir/zutil.c.o
[ 45%] Linking C shared library ../../../lib/libvtkzlib-8.2.dylib
[ 45%] Built target vtkzlib
[ 45%] Building C object ThirdParty/freetype/vtkfreetype/CMakeFiles/vtkfreetype.dir/src/base/ftbase.c.o
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32:0,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:42,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:29,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:23,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftmac.c:100,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftbase.c:38:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope
char bytes[kAuthorizationExternalFormLength];
^~~~~
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:18:0,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftmac.c:101,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftbase.c:38:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/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 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:21:0,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftmac.c:101,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftbase.c:38:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:391:15: error: expected identifier or '(' before '^' token
typedef void (^CGPathApplyBlock)(const CGPathElement * element);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/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)
^~~~~~~~~~~~~~~~
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:14:0,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h:15,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h:16,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:23,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftmac.c:101,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftbase.c:38:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h:103:15: error: expected identifier or '(' before '^' token
typedef bool (^CGPDFArrayApplierBlock)(size_t index,
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h:113:5: error: unknown type name 'CGPDFArrayApplierBlock'; did you mean 'CFArrayApplierFunction'?
CGPDFArrayApplierBlock cg_nullable block, void * __nullable info)
^~~~~~~~~~~~~~~~~~~~~~
CFArrayApplierFunction
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h:15:0,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h:16,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:23,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftmac.c:101,
from /Users/Shared/Development/VTK-8.2.0/source/ThirdParty/freetype/vtkfreetype/src/base/ftbase.c:38:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:116:15: error: expected identifier or '(' before '^' token
typedef bool (^CGPDFDictionaryApplierBlock)(const char * key,
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:126:5: error: unknown type name 'CGPDFDictionaryApplierBlock'; did you mean 'CGPDFDictionaryApplierFunction'?
CGPDFDictionaryApplierBlock cg_nullable block, void * __nullable info)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
CGPDFDictionaryApplierFunction
make[2]: *** [ThirdParty/freetype/vtkfreetype/CMakeFiles/vtkfreetype.dir/src/base/ftbase.c.o] Error 1
make[1]: *** [ThirdParty/freetype/vtkfreetype/CMakeFiles/vtkfreetype.dir/all] Error 2
make: *** [all] Error 2