[ITK-users] ITK 4.8.1, OS X 10.10 and C++11 Support

Michael Jackson mike.jackson at bluequartz.net
Fri Oct 30 08:54:22 EDT 2015


The issue is that I am probably missing something when configuring ITK. Looking in my CMake configure logs I have this message:

Run Build Command:"/usr/local/bin/ninja" "cmTC_2927f"
[1/2] Building CXX object CMakeFiles/cmTC_2927f.dir/CheckIncludeFile.cxx.o
FAILED: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -mmacosx-version-min=10.7 -o CMakeFiles/cmTC_2927f.dir/CheckIncludeFile.cxx.o -c CheckIncludeFile.cxx
CheckIncludeFile.cxx:1:10: fatal error: 'type_traits' file not found
#include <type_traits>
         ^
1 error generated.
ninja: build stopped: subcommand failed.

If you take that same command line and file to compile but simply add "-std=c++11 -stdlib=libc++” to the command line then the compile succeeds. So this is clearly a “user error”. How do I ensure that when CMake is running all of its detection tests that those flags get added? Otherwise the tests are not really valid for the way I am going to compile the codes. I figured by creating an initial CMakeCache.txt file that those flags would get added to every “test” but I guess that is not the way to accomplish that task.
--
Michael A. Jackson
BlueQuartz Software, LLC
[e]: mike.jackson at bluequartz.net

> On Oct 29, 2015, at 11:37 PM, Matt McCormick <matt.mccormick at kitware.com> wrote:
> 
> Hi Michael,
> 
>>> I am getting the following compile error when I compile my codes against
>>> ITK 4.8.1
>>> 
>>> /Users/Shared/DREAM3D_SDK/InsightToolkit-4.8.1/Modules/Core/Common/
>>> include/itkImageAlgorithm.h:26:12: fatal error: 'tr1/type_traits' file
>>> not found
>>> #  include <tr1/type_traits>
>>> 
>>> I compiled ITK with C++ 11 support by initializing ITK’s CMake cache
>>> with the following values:
>>> 
>>> 
>>> echo "CMAKE_CXX_STANDARD=11" >> $cacheFile
>>> echo "CMAKE_CXX_STANDARD_REQUIRED:BOOL=ON" >> $cacheFile
>>> echo “CMAKE_OSX_DEPLOYMENT_TARGET=10.7" >> $cacheFile
>>> echo "CMAKE_OSX_SYSROOT:Path=$OSX_SDK" >> $cacheFile
>>> echo "CMAKE_CXX_FLAGS:STRING=-stdlib=libc++ -std=c++11 " >> cacheFile
>>> 
>>> ITK seemed to compile and install but I only compiled the libraries and
>>> none of the tests.
>>> 
>>> Has anyone ever had this issue? And what do I need to do to solve it.
> 
> Where the same CMake variables used when building your codes?  All
> these should be consistent throughout all compiled and linked code.
> 
> Hope this helps,
> Matt



More information about the Insight-users mailing list