[Insight-developers] Explicit Instantiation + SGI Builds
Hans Johnson
hans-johnson at uiowa.edu
Wed Feb 21 09:35:25 EST 2007
Hello All,
I am trying to get SGI compiler to build with Explicit Instantiation. I run
out of time to play with this, so I thought I would write a short report
about what I have found:
**************
**************
**************
**************
**************
**************
1) Compiler errors during build with unmodified code:
[ 30%] Building CXX object
Code/Common/CMakeFiles/ITKCommon.dir/itkChainCodePath2D.o
cc-1077 CC: ERROR File =
/.../DEBUG/Insight/Code/Common/Templates/itkPathUIO22.h, Line = 5
The indicated declaration has no storage class or type specifier.
ITK_IMPORT_ITKCommon(Path,(unsigned int,itk::Offset<2>,2),UIO22)
===== compile with -E flag to look at failures in expanded macros.
#line 4
"/scratch/purify/Testing/SGI/DEBUG/Insight/Code/Common/Templates/itkPathUIO2
2.h"
namespace itk { _Pragma("do_not_instantiate ITK_TEMPLATE_3(class Path<
unsigned int,itk::Offset<2>,2 >)") namespace Templates { typedef Path<
unsigned int,itk::Offset<2>,2 > PathUIO22; } }
#line 2
"/scratch/purify/Testing/SGI/DEBUG/Insight/Code/Common/Templates/itkPath+-.h
"
#line 138 "/scratch/purify/Testing/SGI/Insight/Code/Common/itkPath.h"
=========
cc-1077 CC: ERROR File =
/scratch/purify/Testing/SGI/DEBUG/Insight/Code/Common/Templates/itkPathUIO22
.h, Line = 5
The indicated declaration has no storage class or type specifier.
namespace itk { _Pragma("do_not_instantiate ITK_TEMPLATE_3(class Path<
unsigned int,itk::Offset<2>,2 >)") namespace Templates { typedef Path<
unsigned int,itk::Offset<2>,2 > PathUIO22; } }
^
=====
The _Pragma C++ extension is described in :
http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi/0650/bks/SGI_Develope
r/books/Pragmas/sgi_html/ch01.html
Compiler directives can also be specified in the following form, which has
the advantage in that it can appear inside macro definitions:
_Pragma("identifier");
This form has the same effect as using the #pragma form, except that
everything that appeared on the line following the #pragma must now appear
inside the double quotation marks and parentheses. The expression inside the
parentheses must be a single string literal, but it cannot be a macro that
expands into a string literal. _Pragma is a SGI extension to the C and C++
standards.
**************
**************
**************
**************
**************
**************
2) Change itkMacro.h to ignore this if Explicit instantiaion is used
[purify at kraepelin Common]$ cvs diff itkMacro.h
Index: itkMacro.h
===================================================================
RCS file: /cvsroot/Insight/Insight/Code/Common/itkMacro.h,v
retrieving revision 1.69
diff -r1.69 itkMacro.h
631c631
< #if defined(__sgi) && defined(_COMPILER_VERSION)
---
> #if defined(__sgi) && defined(_COMPILER_VERSION) &&
!defined(ITK_EXPLICIT_INSTANTIATION)
======
This allows complete compilation, but runtime errors occur
ctest -V -R itkAmoebaOptimizerTest
Add coverage exclude regular expressions.
Start processing tests
Test project /scratch/purify/Testing/SGI/DEBUG/Insight
Constructing a list of tests
Done constructing a list of tests
Changing directory into
/scratch/purify/Testing/SGI/DEBUG/Insight/Utilities/vxl/vcl/tests
Changing directory into
/scratch/purify/Testing/SGI/DEBUG/Insight/Utilities/vxl/core/testlib/tests
Changing directory into
/scratch/purify/Testing/SGI/DEBUG/Insight/Utilities/vxl/core/vnl/algo/tests
Changing directory into
/scratch/purify/Testing/SGI/DEBUG/Insight/Utilities/vxl/core/vnl/tests
Changing directory into
/scratch/purify/Testing/SGI/DEBUG/Insight/Testing/Code/Numerics
84/1121 Testing itkAmoebaOptimizerTest
Test command: /scratch/purify/Testing/SGI/DEBUG/bin/itkNumericsTests
itkAmoebaOptimizerTest
4321073:/scratch/purify/Testing/SGI/DEBUG/bin/itkNumericsTests: rld: Error:
unresolvable symbol in
/scratch/purify/Testing/SGI/DEBUG/lib/libITKCommon.so.3.1:
__T_Q2_3itk145ConstNeighborhoodIterator__pt__111_Q2_3itk21Image__pt__9_iXCUi
L12Q2_3itk71ZeroFluxNeumannBoundaryCondition__pt__31_Q2_3itk21Image__pt__9_i
XCUiL12
4321073:/scratch/purify/Testing/SGI/DEBUG/bin/itkNumericsTests: rld: Fatal
Error: this executable has unresolvable symbols
-- Process completed
***Failed
**************
**************
**************
**************
**************
**************
Hypothesis: the itkMacro _Pragma magic is required on SGI, but implemented
incorrectly.
This code was added by the compiler master Brad King in "version 1.63, Thu
Apr 13 17:57:25 2006 UTC"
Any advice would be greatly appreciated.
At a minimum, I would propose that we put a CMAKE guard around explicit
instantiation to cause CMAKE failure if explicit instantiation will not work
for that platform.
Thanks,
Hans
More information about the Insight-developers
mailing list