[ITK-users] ITK 4.8 build problem

Tim Allman dr.tim.allman at gmail.com
Wed Jul 22 10:14:15 EDT 2015


I am trying to build ITK-4.8.0 on OSX using Xcode 6.2 and CMake 
3.3.0-rc4. What I need to do is build it with CMAKE_CXX_FLAGS = 
-stdlib=libstdc++ so as to use the GNU C++ library. The problem is that 
during the initial CMake configuration it is assumed that libc++ will be 
used and this leads to the following bit of output:

    Looking for C++ include tr1/type_traits
    Looking for C++ include tr1/type_traits - not found
    Looking for C++ include type_traits
    Looking for C++ include type_traits - found

This shows up in itkConfigure.h like this:

    // defined if the system has <tr1/type_traits> header
    /* #undef ITK_HAS_STLTR1_TR1_TYPE_TRAITS */
    // defined if the system has <type_traits> header
    #define ITK_HAS_STLTR1_TYPE_TRAITS
    // defined if std type traits are with C++11 ( no tr1 namespace )
    #define ITK_HAS_CPP11_TYPETRAITS

If I set CMAKE_CXX_FLAGS = -stdlib=libstdc++ the compiler seems to 
understand what I want and uses the GNU headers. The problem is that the 
#define  derails the compilation in itkImageAlgorithm.h on the second 
line below because it is looking for the wrong file.

    #ifdef ITK_HAS_STLTR1_TYPE_TRAITS
    #  include <type_traits>
    #elif defined ITK_HAS_STLTR1_TR1_TYPE_TRAITS
    #  include <tr1/type_traits>
    #else
    #  include "itkIsSame.h"
    #endif

Leading to the error:

    /Users/tim/devel/InsightToolkit-4.8.0/Modules/Core/Common/include/itkImageAlgorithm.h:24:12:
    fatal error: 'type_traits' file not found
    #  include <type_traits>


Is there any way of telling CMake that it's first guess of which C++ 
library I want to use is wrong?

Thanks.

-- 
Tim Allman, Ph.D.
35 Margaret Street,
Guelph Ontario N1E 5R6
Canada

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150722/03259455/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dr_tim_allman.vcf
Type: text/x-vcard
Size: 151 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150722/03259455/attachment.vcf>


More information about the Insight-users mailing list