Search code examples
gccclangopenmpfftwmacos-big-sur

Configure FFTW `configure: error: don't know how to enable OpenMP`


I've been using FFTW3 for two months now. I've recently decided to try and implement some parallel aspects to it to speed up computation. However...

When I try to ./configure --enable-threads --enable-openmp --prefix=/$HOME/Desktop/FFTWLibParallel it runs for a while and then I am met with the following:

checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no extra underscore
checking for OpenMP flag of C compiler... unknown
configure: error: don't know how to enable OpenMP

I have tried to run with ./configure CC=gcc-12.0.0 ..., however this returns

checking for gcc... gcc-12.0.0
checking whether the C compiler works... no
configure: error: in `/Users/USER/Desktop/fftw-3.3.9':
configure: error: C compiler cannot create executables
See `config.log' for more details 

The issue is evidently with using --enable-openmp, but I'm not really sure why or how to combat it. I've seen a few renditions of this question on here, but none have helped me fix my issue.

Thanks.

Edit:

I'm on a mac!


Solution

  • Coming back to this in case anyone, like me, encounters a similar issue and can't find the solution. After further probing, the following finally worked for me:

    ./configure CC=gfortran --enable-openmp --enable-threads CFLAGS="-fopenmp"
    

    the crucial part being the CC=gfortran which in turn, unlike CC=gcc, enabled the use of CFLAGS="-fopenmp".