[Insight-developers] vnl_math::pi coming up undefined with vector optimization turned on?
kent williams
norman-k-williams at uiowa.edu
Thu Oct 22 16:36:24 EDT 2009
I¹m trying to build ITK from the CVS source as of today. I¹m not modifying
anything at all. The only thing I did was use our CFLAGS and CXXFLAGS when
I run CMake. The undefined externals are coming during building ITK itself,
not in my application.
The problem didn¹t show up until I added O3 to the command line. Why that
would interact with the static const members of vnl_math I have no idea.
On 10/22/09 3:21 PM, "Bradley Lowekamp" <blowekamp at mail.nih.gov> wrote:
> 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 <http://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/0c7d2dc2/attachment.htm>
More information about the Insight-developers
mailing list