Fwd: Re: [Insight-users] Cannot build ITK for MAC OS X Tiger 64 bit

Luis Ibanez luis.ibanez at kitware.com
Sun Jul 15 08:42:46 EDT 2007


Hi Sean,

Thanks for contributing this fix.

We log the issue as Bug # 5347
http://public.kitware.com/Bug/bug.php?op=show&bugid=5347&pos=0

and committed your modifications.

http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/CMakeLists.txt?root=Insight&sortby=date&r2=1.123&r1=1.122
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkMultiThreader.cxx?root=Insight&sortby=date&r2=1.39&r1=1.38 



   Please let us know if you find any other problems,


      Thanks


        Luis


--------------------
Sean McBride wrote:
> Hi Luis,
> 
> On the ITK list, Alex reported that this patch worked for him.  I have
> high confidence in it, as VTK does the same.
> 
> Can you apply the patch?
> 
> BTW, this is why our dashboard failed today, as we added 64bit to it:
> <http://www.itk.org/Testing/Sites/RogueResearch2/MacOSXTiger-univ/
> 20070712-0100-Nightly/BuildError.html>
> 
> Thanks,
> 
> Sean
> 
> 
> 
> 
> 
> ---------------- Begin Forwarded Message ----------------
> Subject: Re: [Insight-users] Cannot build ITK for MAC OS X Tiger 64 bit
> Date Sent: Friday, July 6, 2007 3:56 PM
> From: Sean McBride <sean at rogue-research.com>
> To: Alex Lisovich <alex.lisovich at gmail.com>
> , insight-users at itk.org
> 
> On 7/6/07 2:06 PM, Alex Lisovich said:
> 
> 
>>Was anybody able to build ITK on MAC OS Tiger for 64 bit Intel target
>>(x86_64)?
> 
> 
> Tiger is only kinda 64 bit.  We have a 64 bit ITK mostly working in a
> Mac OS X 10.5 beta.  It builds anyway.
> 
> 
>>   The first problem is that it itkMultiThreader.cxx unconditionally
>>includes Carbon.h for any APPLE build including 64-bit, and Carbon on
>>Tiger does not support it. It seems I was able to solve this by using
>>fix from VTK bug report list ( see
>>http://www.vtk.org/Bug/bug.php?op=show&bugid=2932 ) which allowed ITK
>>to build (without examples and tests).
> 
> 
> Neat, that was me that patched that.  :)  A shame that ITK has pretty
> much the same code copy and pasted.  I had no idea or I would have
> patched it in both places.
> 
> 
>>And the build fails:
>>
>>....
>>ld64 warning: in /System/Library/Frameworks//AppKit.framework/AppKit,
>>missing required architecture x86_64 in file
> 
> 
> AppKit is 32 bit only in 10.4.  Odd that ITK thinks it needs to link
> with AppKit.framework.  However, searching the ITK source reveals that
> it does indeed pass "-framework AppKit".  This should not be necessary. 
> I suspect if you remove that your problem will go away.  The current ITK
> code does an #include <Carbon/Carbon.h> and so should use "-framework
> Carbon", AppKit itself links to Carbon which explains why ITK can link.
> 
> Anyway, try the attached patch.  I have not actually tried it, but I
> think it will work.
> 
> Let us know if it works, then maybe someone can commit it.
> 
> Cheers,
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: Code/Common/CMakeLists.txt
> ===================================================================
> RCS file: /cvsroot/Insight/Insight/Code/Common/CMakeLists.txt,v
> retrieving revision 1.122
> diff -r1.122 CMakeLists.txt
> 127,129d126
> < IF(APPLE)
> <   TARGET_LINK_LIBRARIES(ITKCommon "-framework AppKit")
> < ENDIF(APPLE)
> Index: Code/Common/itkMultiThreader.cxx
> ===================================================================
> RCS file: /cvsroot/Insight/Insight/Code/Common/itkMultiThreader.cxx,v
> retrieving revision 1.38
> diff -r1.38 itkMultiThreader.cxx
> 42c42,43
> < #include <Carbon/Carbon.h>
> ---
> 
>>#include <sys/types.h>
>>#include <sys/sysctl.h>
> 
> 44c45
> <     
> ---
> 
> 123,125c124,133
> <     // MPProcessors returns the physical number of processors present
> <     // MPProcessorsScheduled returns number of active processors
> <     num = MPProcessors();
> ---
> 
>>    // Use sysctl() to determine the number of CPUs.  This is prefered
>>    // over MPProcessors() because it doesn't require CoreServices
>>    // (which is only available in 32bit on Mac OS X 10.4)
>>    int mib[2] = {CTL_HW, HW_NCPU};
>>    size_t dataLen = sizeof(int); // 'num' is an 'int'
>>    int result = sysctl(mib, 2, &num, &dataLen, NULL, 0);
>>    if (result == -1)
>>      {
>>      num = 1;
>>      }


More information about the Insight-users mailing list