[Insight-developers] Borland compiler
Miller, James V (Research)
millerjv@crd.ge.com
Wed, 11 Sep 2002 16:06:23 -0400
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C259CE.B3664D70
Content-Type: text/plain;
charset="iso-8859-1"
I just checked a long series of modications to allow ITK to be built using the Borland compiler.
Borland offers a free command line version of their (previous version) C++ compiler. CMake can
generate the makefiles needed to use the Borland command line tools. The Borland compiler is very
popular in Europe and given its free it would probably be popular with academics.
The Borland compiler does not like ITK's use of enums to cache value template parameters inside the
class. As the enums get delegated from templated class to templated class, they eventually get lost
and become zero.
To address this, I added a macro called itkStaticConstMacro() that is used wherever we were using an
enum to cache a value template parameter. The use
itkStaticConstMacro(ConstantName, ConstantType, ConstantValue);
or specifically
itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
This macro defines the constant as "static ConstantType ConstantName = ConstantValue" on the
platforms that accept inclass static initializers. For the other platforms, it falls back to using
an enum.
If you need you the constant within the class (for instance in defining a typedef), there is another
macro itkGetStaticConstMacro(ConstantName) which inserts the appropriate code (platform specific) on
how to access the constant (some compilers will not allow the constant to be accessed without it
being fully scoped, so this macro becomes (Self::ConstantName). ).
Use of the itkGetStaticConstMacro requires the class have Self defined.
Other Borland issues:
----
Dependent default template parameters #1:
It looks like these cause the Borland compiler a number of problems. For the Microsoft compiler, we
have been using a series of helper classes
template <class TImage, class TAccessor >
class ITK_EXPORT ImageAdaptor : public ImageBase< GetImageDimension<TImage>::ImageDimension>
the Borland compiler does not like this helper class (GetImageDimension) unless it is fully scoped,
i.e.
template <class TImage, class TAccessor >
class ITK_EXPORT ImageAdaptor : public ImageBase< ::itk::GetImageDimension<TImage>::ImageDimension>
Note that we need to leave a space between the "<" and the "::itk::" becomes "<:" is a valid digraph
(does anyone ever use digraphs?)
---
Dependent default template parameters 2:
In some class definitions, the Borland compiler did not like some of the typedefs. Particularly
typedefs that extracted some trait from an earlier typedef where the earlier typedef was accepting a
default template parameter. In these cases, I modified the earlier typedef to not accept the default
template parameter and fully spec'ed out the template parameters.
---
It looks like using the Borland compiler for ITK is going to require an upgrade to CMake. I am
working with Bill Hoffman on this. He has already put in one fix. But he cannot reproduce my
remaining problems until I check in these changes to ITK.
---
I tested these code changes on:
Borland C++ 5.5.1
Intel C++ 5.0
Microsoft VC 6
Microsoft VC 7
Cygwin GCC (2.95)
We'll need to check how these changes affect SGI CC, Solaris CC, Mac GCC, and GCC 3.0
I have not built the examples (except under VC6).
---
Open Issues:
FEM Library: the Borland compiler gets an internal compiler error building
itkFEMLoadImplementsRegister.cxx
VC7 gets a build error in itkFEMGenerateMesh
DiscreteGaussianImageFilterTest crashes. I haven't tried tracking this down yet.
PrintSelfCheck: with having to fully scope some of the helper classes for dependent default template
parameters, the PrintSelfCheck tcl script needs to be updated to understand the new syntax.
---
Nightly tests:
I want to set up machines to do nightly builds and tests for the following compilers:
* VC7
* Borland 5.5.1
* Intel 5.0
* Cygwin GCC
Bill Lorensen has a machine ready to for the Cygwin GCC build
I have a machine set up for the Borland 5.5.1 build
Then I run out of machines. It looks like one of my current testing machines is caught in an endless
reboot cycle... So it will take me some time to repair it. If anyone want to run a Nightly on any of
these other compilers, please let me know.
I might put VC7 on the machine that is also running the VC6 builds and the Borland builds. But that
may be a pretty heavy load on that machine.
There are a couple of other compilers out there to try:
* Intel 6.0
* Borland 6.0
I don't have any immediate plans to purchase these last two compilers. But if anyone has them and
wants to run a Nightly let me know.
Jim Miller
_____________________________________
Visualization & Computer Vision
GE Research
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301
millerjv@research.ge.com <mailto:millerjv@research.ge.com>
james.miller@research.ge.com
(518) 387-4005, Dial Comm: 8*833-4005,
Cell: (518) 505-7065, Fax: (518) 387-6981
------_=_NextPart_001_01C259CE.B3664D70
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o = "urn:schemas-microsoft-com:office:office"><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2715.400" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=491390816-03092002><FONT size=2>I just checked a long series of
modications to allow ITK to be built using the Borland compiler. Borland
offers </FONT></SPAN><SPAN class=491390816-03092002><FONT size=2>a free command
line version of their (previous version) C++ compiler. CMake can generate
the makefiles needed </FONT></SPAN><SPAN class=491390816-03092002><FONT
size=2>to use the Borland command line tools. The Borland compiler is very
popular in Europe and given its free it would probably be popular with
academics.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>The Borland compiler does not
like ITK's use of enums to cache value template parameters inside the class. As
the enums get delegated from templated class to templated class, they eventually
get lost and become zero.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>To address this, I added a
macro called itkStaticConstMacro() that is used wherever we were using an enum
to cache a value template parameter. The use</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT
size=2>itkStaticConstMacro(ConstantName, ConstantType,
ConstantValue);</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>or
specifically</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT
size=2>itkStaticConstMacro(ImageDimension, unsigned int,
TImage::ImageDimension);</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>This macro defines the constant
as "static ConstantType ConstantName = ConstantValue" on the platforms that
accept inclass static initializers. For the other platforms, it falls back
to using an enum.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>If you need you the constant
within the class (for instance in defining a typedef), there is another macro
itkGetStaticConstMacro(ConstantName) which inserts the appropriate code
(platform specific) on how to access the constant (some compilers will not allow
the constant to be accessed without it being fully scoped, so this macro becomes
(Self::ConstantName). ).</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Use of the
itkGetStaticConstMacro requires the class have Self defined.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Other Borland
issues:</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>----</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Dependent default template
parameters #1: </FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>It looks like these cause the
Borland compiler a number of problems. For the Microsoft compiler, we have
been using a series of helper classes </FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>template <class TImage,
class TAccessor ><BR>class ITK_EXPORT ImageAdaptor : public ImageBase<
GetImageDimension<TImage>::ImageDimension><BR></FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>the Borland compiler does not
like this helper class (GetImageDimension) unless it is fully scoped,
i.e.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2> </DIV></FONT></SPAN>
<DIV><SPAN class=491390816-03092002><FONT size=2>template <class TImage,
class TAccessor ><BR>class ITK_EXPORT ImageAdaptor : public ImageBase<
::itk::GetImageDimension<TImage>::ImageDimension><BR></FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Note that we need to leave a
space between the "<" and the "::itk::" becomes "<:" is a valid digraph
(does anyone ever use digraphs?)</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>---</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Dependent default template
parameters 2:</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>In some class definitions, the
Borland compiler did not like some of the typedefs. Particularly typedefs
that extracted some trait from an earlier typedef where the earlier typedef was
accepting a default template parameter. In these cases, I modified the earlier
typedef to not accept the default template parameter and fully spec'ed out the
template parameters.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>---</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>It looks like using the Borland
compiler for ITK is going to require an upgrade to CMake. I am working
with Bill Hoffman on this. He has already put in one fix. But he
cannot reproduce my remaining problems until I check in these changes to
ITK.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>---</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>I tested these code changes
on:</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Borland C++
5.5.1</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Intel C++
5.0</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Microsoft VC
6</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Microsoft VC
7</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Cygwin GCC
(2.95)</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002></SPAN><SPAN class=491390816-03092002><FONT
size=2>We'll need to check how these changes affect SGI CC, Solaris CC, Mac GCC,
and GCC 3.0</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>I have not built the examples
(except under VC6).</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>---</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Open
Issues:</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>FEM Library: the Borland
compiler gets an internal compiler error building
itkFEMLoadImplementsRegister.cxx</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT
size=2>
VC7 gets a build error in itkFEMGenerateMesh</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>DiscreteGaussianImageFilterTest
crashes. I haven't tried tracking this down yet.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>PrintSelfCheck: with having to
fully scope some of the helper classes for dependent default template
parameters, the PrintSelfCheck tcl script needs to be updated to understand the
new syntax.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>---</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Nightly
tests:</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>I want to set up machines to do
nightly builds and tests for the following compilers:</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>* VC7</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>* Borland
5.5.1</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>* Intel 5.0</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>* Cygwin
GCC</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Bill Lorensen has a machine
ready to for the Cygwin GCC build</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>I have a machine set up for the
Borland 5.5.1 build</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>Then I run out of
machines. It looks like one of my current testing machines is caught in an
endless reboot cycle... So it will take me some time to repair it. If anyone
want to run a Nightly on any of these other compilers, please let me
know.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>I might put VC7 on the machine
that is also running the VC6 builds and the Borland builds. But that may be a
pretty heavy load on that machine.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>There are a couple of other
compilers out there to try:</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>* Intel 6.0</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>* Borland
6.0</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2>I don't have any immediate
plans to purchase these last two compilers. But if anyone has them and
wants to run a Nightly let me know.</FONT></SPAN></DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=491390816-03092002><FONT size=2> </DIV></FONT></SPAN>
<DIV class=Section1>
<P style="MARGIN: 0in 0in 0pt"><B><SPAN
style="COLOR: navy; FONT-FAMILY: 'Comic Sans MS'">Jim Miller</SPAN></B>
<BR><B><I><SPAN
style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Arial">_____________________________________</SPAN></I></B><BR><EM><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Visualization &
Computer Vision</SPAN></EM><I><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial"><BR><EM>GE
Research</EM><BR><EM>Bldg. KW, Room C218B</EM><BR><EM>P.O. Box 8, Schenectady NY
12301</EM><BR><BR></SPAN></I><EM><U><SPAN
style="FONT-SIZE: 7.5pt; COLOR: blue"><A
href="mailto:millerjv@research.ge.com">millerjv@research.ge.com</A></SPAN></U></EM></P>
<P style="MARGIN: 0in 0in 0pt"><EM><U><SPAN
style="FONT-SIZE: 7.5pt; COLOR: blue">james.miller@research.ge.com</SPAN></U></EM><BR><I><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">(518) 387-4005, Dial
Comm: 8*833-4005, </SPAN></I><BR><I><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Cell: (518) 505-7065,
Fax: (518) 387-6981</SPAN></I> </P>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV> </DIV></BODY></HTML>
------_=_NextPart_001_01C259CE.B3664D70--