[ITK-users] ITK 4.8 build problem

Matt McCormick matt.mccormick at kitware.com
Wed Jul 22 11:12:31 EDT 2015


Hi Tim,

Yes, the way to set this not very obvious.

For cmake-gui, before the initial run, click the "+ Add Entry" button.

For ccmake, pass entries on the command as would be done with cmake
with the "-D" flag, e.g.,

  ccmake "-DCMAKE_CXX_FLAGS:STRING=-stdlib=libstdc++" ~/src/ITK

HTH,
Matt

On Wed, Jul 22, 2015 at 10:40 AM, Tim Allman <dr.tim.allman at gmail.com> wrote:
> Matt,
>
> The problem is that for ccmake and cmake-gui the area in which these flags
> are set is absolutely blank. There is nowhere to set this before the first
> configuration is done.
>
> Tim
>
> On 15-07-22 10:23 AM, Matt McCormick wrote:
>>
>> 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
>>>
>
> --
> Tim Allman, Ph.D.
> 35 Margaret Street,
> Guelph Ontario N1E 5R6
> Canada
>


More information about the Insight-users mailing list