[ITK-users] ITK 4.8 build problem

Matt McCormick matt.mccormick at kitware.com
Wed Jul 22 10:23:05 EDT 2015


Hi Tim,

The try_compile checks ("Looking for C++ include tr1/type_traits",
etc), occur on the first CMake configuration run, then are cached for
efficiency on further runs.  Therefore, make sure that
CMAKE_CXX_FLAGS=-stdlib=libstdc++ is set before the initial run.

HTH,
Matt

On Wed, Jul 22, 2015 at 10:14 AM, Tim Allman <dr.tim.allman at gmail.com> wrote:
> 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
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list