[Insight-users] Cygwin dynamic library build and wrapping problems.

Tony Pan tpan at bmi.osu.edu
Thu, 4 Mar 2004 17:31:05 -0500


I made the mistake of not searching through the list archive before I
started my build.  I was trying to build tag ITK-1-6-0 under latest
cygwin in windows XP, with dynamic libraries and wrapping turned on for
Python and Tcl.  Yeah, I can hear you all laughing.

Needless to say, nothing compiles.  And previous messages in the list
archives (07/03 to today) suggest that neither dynamic libraries and
wrapping are working in cygwin.  (On a side note, it'd be great to have
a chart that shows which features work on which platform.)  So I took a
closer look at my error messages.

Building executable /cygdrive/d/builds/ITK/bin/itkCommonTests.exe...
itkCommonPrintTest.o(.text$_ZN3itk14KernelFunctionC2Ev+0x15):itkCommonPr
intTest.cxx: undefined reference to `__imp___ZTVN3itk14KernelFunctionE'
itkCommonPrintTest.o(.text$_ZN3itk14KernelFunctionD2Ev+0xa):itkCommonPri
ntTest.cxx: undefined reference to `__imp___ZTVN3itk14KernelFunctionE'
itkCommonPrintTest.o(.text$_ZN3itk13DynamicLoaderC1Ev+0x17):itkCommonPri
ntTest.cxx: undefined reference to `__imp___ZTVN3itk13DynamicLoaderE'
itkCommonPrintTest.o(.text$_ZN3itk22GaussianKernelFunctionC1Ev+0x15):itk
CommonPrintTest.cxx: undefined reference to
`__imp___ZTVN3itk22GaussianKernelFunctionE'
itkCommonPrintTest.o(.text$_ZN3itk10TextOutputC1Ev+0x17):itkCommonPrintT
est.cxx: undefined reference to `__imp___ZTVN3itk10TextOutputE'
itkCommonPrintTest.o(.text$_ZN3itk7VersionC1Ev+0x17):itkCommonPrintTest.
cxx: undefined reference to `__imp___ZTVN3itk7VersionE'

Running nm on the .dll files showed that there are no symbols with
__imp__ prefix.  Further, the few instances where the string "Version"
appear in symbols, they are for function calls
(__ZN3itk7Version19GetITKSourceVersionEv) instead of just the class
names.  Btw, this is the same kind of problem that caused the wrapping
to fail.

A little more digging in the code and I saw that not all classes have
XXX_EXPORT flag in the declaration, and the ones that do, have either
ITK_EXPORT or ITKCommon_EXPORT.  There are no ITKAlgorithms_EXPORT,
ITKIO_EXPORT, ITKNumerics_EXPORT, or ITKSpatialObjects_EXPORT.  As it
turn out, ITK_EXPORT in ITK-1-6-0 release is defined to empty.  Anyways,
the bottomline is a very small portion of the symbols are being
exported, at least in cygwin.

Anyways, just thought I'd share what I found out.  I didn't check more
recent release tags of ITK to see if this is fixed, other than looking
at itkWin32Header.h and a few randomly sampled .h files in WebCVS.  I'd
appreciate any information on how to get this to work (or how this will
not work).  I am giving up cygwin-ITK for now, and am going to use ITK
on my remote Linux box.  Thank god for LAN and RoadRunnder(R).


Tony C. Pan
Ohio State University
Department of Biomedical Informatics
Multi-Scale Computing Lab
Research Specialist
tpan at bmi.osu.edu
614-292-1157