Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake doesn't find FFTW #52

Closed
bebuch opened this issue Jan 14, 2021 · 2 comments
Closed

CMake doesn't find FFTW #52

bebuch opened this issue Jan 14, 2021 · 2 comments

Comments

@bebuch
Copy link

bebuch commented Jan 14, 2021

CMake fails to find FFTW (version 3.3.9) which was installed from source. I use CMake version 3.19.3 on Ubuntu 20.04.

$ cmake --version
cmake version 3.19.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

FFTW is installed in /usr/local:

/usr/local/lib/libfftw3q.a
/usr/local/lib/libfftw3q.a
/usr/local/include/fftw3.h
/usr/local/include/fftw3.f
/usr/local/include/fftw3l.f03
/usr/local/include/fftw3q.f03
/usr/local/include/fftw3.f03
/usr/local/lib/pkgconfig/fftw3q.pc
/usr/local/lib/cmake/fftw3q/FFTW3qConfig.cmake
/usr/local/lib/cmake/fftw3q/FFTW3qConfigVersion.cmake
/usr/local/lib/cmake/fftw3q/FFTW3LibraryDepends.cmake
/usr/local/lib/cmake/fftw3q/FFTW3LibraryDepends-release.cmake

I suspect that your CMake code is no longer compatible with current CMake versions.

Simple cmake call:

$ cmake ../xtensor-fftw-0.2.6
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building xtensor-fftw v0.2.6
-- Performing Test arch_native_supported
-- Performing Test arch_native_supported - Success
-- Found xtensor: /usr/local/include/xtensor
-- Found xtl: /usr/local/include/xtl
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
CMake Error at /snap/cmake/769/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find FFTW (missing: FLOAT_LIB DOUBLE_LIB LONGDOUBLE_LIB)
Call Stack (most recent call first):
  /snap/cmake/769/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/findFFTW/FindFFTW.cmake:277 (find_package_handle_standard_args)
  CMakeLists.txt:88 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/bebuch/media/tmp/install/xtensor-fftw-0.2.6-build/CMakeFiles/CMakeOutput.log".

Call with FFTW_ROOT:

$ cmake -DFFTW_ROOT=/usr/local ../xtensor-fftw-${XTENSOR_FFTW_VERSION}
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building xtensor-fftw v0.2.6
-- Performing Test arch_native_supported
-- Performing Test arch_native_supported - Success
-- Found xtensor: /usr/local/include/xtensor
-- Found xtl: /usr/local/include/xtl
CMake Warning (dev) at CMakeLists.txt:88 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  CMake variable FFTW_ROOT is set to:

    /usr/local

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
CMake Error at /snap/cmake/769/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find FFTW (missing: FLOAT_LIB DOUBLE_LIB LONGDOUBLE_LIB)
Call Stack (most recent call first):
  /snap/cmake/769/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/findFFTW/FindFFTW.cmake:277 (find_package_handle_standard_args)
  CMakeLists.txt:88 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/bebuch/media/tmp/install/xtensor-fftw-0.2.6-build/CMakeFiles/CMakeOutput.log".
@bebuch
Copy link
Author

bebuch commented Feb 19, 2021

I solved it. The problem was the strange build process of FFTW. I used CMake options for single, double, long double and quad-double simultaneously, which is not allowed but runs without warning or error. The result was, that only the quad-double version was build.

To build FFTW correctly with CMake use:

FFTW_VERSION=3.3.9
curl -L http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz | tar xz
mkdir build && cd $_
cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_OPENMP=ON -DENABLE_THREADS=ON -DENABLE_LONG_DOUBLE=ON ../fftw-${FFTW_VERSION}
make -j $(nproc) install
rm -r *
cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_OPENMP=ON -DENABLE_THREADS=ON -DENABLE_FLOAT=ON -DENABLE_SSE=ON -DENABLE_SSE2=ON -DENABLE_AVX=ON -DENABLE_AVX2=ON ../fftw-${FFTW_VERSION}
make -j $(nproc) install
rm -r *
cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_OPENMP=ON -DENABLE_THREADS=ON -DENABLE_SSE=ON -DENABLE_SSE2=ON -DENABLE_AVX=ON -DENABLE_AVX2=ON ../fftw-${FFTW_VERSION}
make -j $(nproc) install

@bebuch bebuch closed this as completed Feb 19, 2021
@egpbos
Copy link
Member

egpbos commented Feb 19, 2021

Excellent! Thanks for also sharing your solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants