I'm currently trying to install a few Ruby Gems that require the fftw3 library to be installed and linked correctly on Windows 10. It's a one-line fix on Linux, so I'm rather annoyed at this point.
- fftw3 ~> 0.3
- convolver ~> 0.3.1
I have Ruby 2.2.4 (64-bit) installed and the 64-bit Devkit installed as well.
Running gem install fftw3
produces the following:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing fftw3:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/fftw3-0.3/ext
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20180813-7456-1v4icuv.rb extconf.rb
checking for narray.h... yes
checking for narray_config.h... yes
checking for fftw3.h... yes
checking for main() in -lfftw3... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You
may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-narray-dir
--without-narray-dir
--with-narray-include
--without-narray-include=${narray-dir}/include
--with-narray-lib
--without-narray-lib=${narray-dir}/lib
--with-fftw3-dir
--without-fftw3-dir
--with-fftw3-include
--without-fftw3-include=${fftw3-dir}/include
--with-fftw3-lib
--without-fftw3-lib=${fftw3-dir}/lib
--with-fftw3lib
--without-fftw3lib
** configure error **
Header fftw3.h or the compiled fftw3 library is not found.
If you have the library installed under /fftw3dir (that is, fftw3.h is
in /fftw3dir/include and the library in /fftw3dir/lib/),
try the following:
% ruby extconf.rb --with-fftw3-dir=/fftw3dir
Alternatively, you can specify the two directory separately
with --with-fftw3-include and --with-fftw3-lib.
To see why this extension failed to compile, please check the mkmf.log which
can be found here:
C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/fftw3-0.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/fftw3-0.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/fftw3-0.3/gem_make.out
There is a lot in here...So far I've been able to get the fftw3.h file to link properly by reading the mkmf.log file and placing the headers in a path that's searched by the gem installation. I've tried using more of the command line options ruby extconf.rb <opts>
to generate the makefile (receiving similar errors), I've placed the DLL in the System32 and SysWOW64 folders.
The same error populates with the ruby-termios gem, but instead it's looking for termios.h. Which lead me to believe there may be something wrong with the gems that need the Devkit to install, so I tried reinstalling it with no luck as well.
So I have a few questions:
Why do the Devkit gems search for header files that match the gem to be installed? (e.g. fftw3 looks for fftw3.h, ruby-termios looks for termios.h) Shouldn't these come bundled with the gem?
Is it possible that libfftw3 is missing a main() function? I'm unsure if the install command can find the dll, or if the dll is missing main(). If this is the case, what would be the work-around for that problem? (I don't want to remove the have_library("fftw3") call from the extconf.rb file as this just feels dirty and all around incorrect.)
Does anyone know the work-around for this error?
Sorry for throwing so much at you and hopefully this is clear enough. Thanks in advance.
EDIT: A couple things to note:
- On Windows, you can install the fftw3 library during Cygwin's installation
gem install
also has an option to install --with-fftw3-dir="path"