Handbrake: Building from source fails due to missing fftw3.h when compiling libsamplerate

Created on 28 Feb 2016  路  9Comments  路  Source: HandBrake/HandBrake

I am trying to build the latest HandBrake commit from source (as described here, but with the --enable-fdk option enabled). Compilation fails when trying to compile the libsamplerate tests, due to a missing fftw3.h header:

michael@machine:~/devel/HandBrake$ lsb_release -a
LSB Version:    core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch:security-4.0-amd64:security-4.0-noarch:security-4.1-amd64:security-4.1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:    15.10
Codename:   wily
michael@machine:~/devel/HandBrake$ git rev-parse HEAD
5764ff3816214014c822ddf3c8099ec3e5f69b61
michael@machine:~/devel/HandBrake$ ./configure --cross=x86_64-w64-mingw32 --enable-x265 --enable-qsv --enable-hwd --launch-jobs=1 --launch --enable-fdk
[...lots of output...]
  : /home/michael/Downloads/mingw/bin/x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I. -I../src -I./../src  -I/home/michael/devel/HandBrake/build/contrib/include -mfpmath=sse -msse2 -mno-ms-bitfields  -I/home/michael/devel/HandBrake/build/contrib/include -std=gnu99 -mfpmath=sse -msse2 -mno-ms-bitfields -std=gnu99 -W -Wstrict-prototypes -Wmissing-prototypes -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wpointer-arith -pipe -c -o multi_channel_test-calc_snr.o `test -f 'calc_snr.c' || echo './'`calc_snr.c
  : calc_snr.c:30:19: fatal error: fftw3.h: No such file or directory
  :  #include <fftw3.h>
  :                    ^
  : compilation terminated.
  : Makefile:505: recipe for target 'multi_channel_test-calc_snr.o' failed
  : make[2]: *** [multi_channel_test-calc_snr.o] Error 1
  : make[2]: Leaving directory '/home/michael/devel/HandBrake/build/contrib/libsamplerate/libsamplerate/tests'
  : Makefile:292: recipe for target 'all-recursive' failed
  : make[1]: *** [all-recursive] Error 1
  : make[1]: Leaving directory '/home/michael/devel/HandBrake/build/contrib/libsamplerate/libsamplerate'
  : ../contrib/libsamplerate/module.rules:2: recipe for target 'contrib/libsamplerate/.stamp.build' failed
  : make: *** [contrib/libsamplerate/.stamp.build] Error 2

It seems that FFTW is not downloaded into the ./build/contrib directory, nor a relevant include path added. I have it installed via my package manager (i.e. find /usr/include/ -name "fftw3.h") returns the found header, but I assume that's not very useful for cross-compilation.

Most helpful comment

Indeed; I have just tried building according to the documentation using a fresh Ubuntu VM install. It succeeds out of the box, but as soon as I install FFTW:

sudo apt-get install libfftw3-dev

the build fails, as above.

All 9 comments

I'm guessing your using the cross compiler that came with ubuntu? Last time I checked it wouldn't work.

See the doc folder for details on the supported version of mingw.

Nope, I am using the cross compiler that I downloaded as described here:

You will need a copy of their toolchain from 鈥媓ttp://sourceforge.net/projects/mingw-w64/files/?source=navbar
Please see "Toolchains targetting Win64" -> "Automated Builds" and choose the latest version.
At the time of writing, "mingw-w64-bin_x86_64-linux_20131228.tar.bz2" is used.

Version output:

michael@machine:~/Downloads/mingw/bin$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/home/michael/Downloads/mingw/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.0/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../../build/gcc/src/configure --target=x86_64-w64-mingw32 --prefix=/home/mingw-w64/mingw-w64/linux-x86_64-x86_64/build/build/root --with-sysroot=/home/mingw-w64/mingw-w64/linux-x86_64-x86_64/build/build/root --with-gnu-ld --with-gnu-as --enable-fully-dynamic-string --disable-multilib
Thread model: win32
gcc version 4.9.0 20131228 (experimental) (GCC) 

As far as I can tell, I have exactly followed the instructions in the documentation.

Able to provide a full build log from a clean checkout? Any old pastebin site link will do.

Nothing steps out I'm afraid. It's probably something else on your path that's causing problems with the toolchain. Unfortunately I have no idea what.

All I can do is confirm the stated toolchain works on a clean ubuntu 15 install.

Removing unnecessary entries from my PATH did not change anything.
However, removing the system-installed FFTW3 library led to success:

sudo apt-get remove libfftw3-dev

followed by a clean HandBrake clone results in a successful build.
Which leads me to believe that, on a fresh Ubuntu install, installing the FFTW3 library will probably result in build failure, but I did not try this yet.
My suspicion is that some configure script (wrongly) sees the system-installed libfftw3-dev, records its presence such that some conditionally compiled code is activated, but then the system path /usr/local/include does not get added to the includes (and rightfully so).

If this can't be fixed easily, maybe this could be mentioned as a potential caveat in the build documentation?

Indeed; I have just tried building according to the documentation using a fresh Ubuntu VM install. It succeeds out of the box, but as soon as I install FFTW:

sudo apt-get install libfftw3-dev

the build fails, as above.

Added a note to the included docs.

How can I install fftw3 in windows?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Vuurvlieg picture Vuurvlieg  路  5Comments

rajibkhan picture rajibkhan  路  5Comments

Cagliostrooo picture Cagliostrooo  路  3Comments

iburunat picture iburunat  路  3Comments

joshrabinowitz picture joshrabinowitz  路  5Comments