[Insight-developers] vnl_math::pi coming up undefined with vector optimization turned on?
Bradley Lowekamp
blowekamp at mail.nih.gov
Thu Oct 22 16:21:23 EDT 2009
Hello kent,
I was just looking at this stuff. It turns out the following is not
standard c++:
class C {
static const double one = 1.0;
};
This is because static member variable must be defined in one obj
file, not in headers, so that all instance of the object will
reference the same address. But some compilers are smart enough to
know what you are trying to do here and let is slide.
As to why you are getting this error, are you sure you are linking
against the correct libraries? vnl_math::pi should be defined int the
vnl library.
victoria:bin blowek1$ nm libitkvnl.a | grep pi
000016d8 S __ZN8vnl_math11one_over_piE
000016e0 S __ZN8vnl_math11two_over_piE
000016e8 S __ZN8vnl_math15two_over_sqrtpiE
000016f0 S __ZN8vnl_math16one_over_sqrt2piE
000016c0 S __ZN8vnl_math2piE
000016c8 S __ZN8vnl_math9pi_over_2E
000016d0 S __ZN8vnl_math9pi_over_4E
Hope this helps,
Brad
On Oct 22, 2009, at 4:05 PM, kent williams wrote:
> I'm trying to build ITK on OS X with the "-O3" flag. I've never had
> trouble
> with "-O2" but now I get an undefined external for vnl_math::pi.
>
> The main reason to go with "-O3" is to turn on vector SIMD
> optimizations --
> in one application we're trying to optimize, the biggest share of
> CPU is
> used in the ImageToImageMetric, and Shark is suggesting that the
> loops in
> the hot routines would benefit from vector optimizations.
>
> I don't know why or from whence the problem originates, but what it
> looks
> like is that the vnl_math:: constants don't get declared as
> variables if
> VCL_STATIC_CONST_INIT_FLOAT_NO_DEFN is defined.
>
> Now I'm no VXL library hacker,so I'm pretty much baffled by this
> thing.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> 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://www.itk.org/mailman/listinfo/insight-developers
========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091022/95da9b38/attachment.htm>
More information about the Insight-developers
mailing list