[ITK Community] Build problem using MinGW32 4.5.0 and FFT

Matt McCormick matt.mccormick at kitware.com
Sun Jan 5 17:00:46 EST 2014


Hi Jan,

Thanks for the note and the description.

It sounds like you have discovered two bugs:

  fftwf_import_wisdom_from_file

versus

  fftw_import_wisdom_from_file

and

  _sopen_s

versus

  _sopen

_sopen_s is Microsoft's standard incompatible, "secure" version of
_sopen.  The standard version is preferred.

The best way to get this fixed is to submit patches to Gerrit [1].
Please let us know if there are any difficulties.

Thanks,
Matt

[1] http://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySoftwareProcess/SubmitAPatchToGerrit/index.html

On Sun, Jan 5, 2014 at 5:01 AM, Jan Ehrhardt
<ehrhardt at imi.uni-luebeck.de> wrote:
> Hi Matt,
>
> I use ITK_USE_SYSTEM_FFTW and it doesn't work. _sopen_s seems not to be
> implemented in MinGW. Using _sopen instead compiles.
>
> I think there is a bug in the Win32 code in
> itkFFTWGlobalConfiguration::ExportWisdomFileDouble and
> ImportWisdomFileDouble
>
> In ImportWisdomFileDouble the method fftwf_import_wisdom_from_file() is
> used resulting in an unresolved symbol. The Unix code uses
> fftw_import_wisdom_from_file().
>
> In ExportWisdomFileDouble and ExportWisdomFileFloat the
> fftwf_import_wisdom_from_file() is called instead of the
> fftw_export_wisdom_to_file(). (Copy and paste error?)
>
> I changed the code in ImportWisdomFileDouble and Filtering/FFT now compiles:
>
> #if defined(ITK_USE_FFTWD)
> #ifdef _WIN32
>   FILE *f;
>   int  fd;
>   fd = _sopen( path.c_str(), _O_RDONLY, _SH_DENYNO, _S_IREAD);
>   if (fd != -1)
>   {
>     if ( (f = _fdopen(fd, "r")) != NULL )
>       {
>       ret = fftw_import_wisdom_from_file( f );
>       }
>     _close(fd);
>   }
> #else
>   FILE * f = fopen( path.c_str(), "r" );
>   if( f )
>     {
>     flock( fileno(f), LOCK_SH );
>     ret = fftw_import_wisdom_from_file( f );
>     flock( fileno(f), LOCK_UN );
>     fclose( f );
>     }
> #endif
> #endif
>
> I don't know the difference between _sopen and _sopen_s, but replacing
> _sopen_s compiles with MinGW.
>
> Best regards,
> Jan
>
> Am Sa, 4.01.2014, 20:33, schrieb Matt McCormick:
>> Hi Jan,
>>
>> Does building fftw manually, then turning on ITK_USE_SYSTEM_FFTW work?
>>
>> Please let use know how it goes.
>>
>> Thanks,
>> Matt
>>
>> On Thu, Jan 2, 2014 at 1:30 PM, Jan Ehrhardt
>> <ehrhardt at imi.uni-luebeck.de> wrote:
>>> Hi folks,
>>>
>>> I try to compile ITK 4.4.0 on Win32 with MinGW32 4.5.0. If I use the
>>> option ITK_USE_FFTWD a compile error appears in
>>> itkFFTWGlobalConfiguration.cxx: "_sopen_s was not declared in this
>>> scope"
>>> (lines 369 and 446)
>>>
>>> I couldn't find a declaration of _sopen_s in any header file of MinGW -
>>> maybe not implemented?
>>>
>>> Is there a workaround to compile ITK with FFTW enabled?
>>>
>>> Best regards,
>>> Jan
>>>
>>> _______________________________________________
>>> Community mailing list
>>> Community at itk.org
>>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>>
>



More information about the Community mailing list