FFTW / fftw3

DO NOT CHECK OUT THESE FILES FROM GITHUB UNLESS YOU KNOW WHAT YOU ARE DOING. (See below.)
GNU General Public License v2.0
2.67k stars 652 forks source link

compilation fails with icc (classic) 2021.4.0 #264

Open aepace opened 2 years ago

aepace commented 2 years ago

Hi, I'm getting a compilation error using icc 2021.4.0 in a Centos 8 container.

# icc -V
Intel(R) C Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.4.0 Build 20210910_000000
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.
# gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The build fails when making all in api with following error:

libtool: compile:  icc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I .. -O3 -fPIC -no-gcc -fp-model strict -axCORE-AVX512,CORE-AVX2,AVX,SSE4.2 -I/opt/intel/oneapi/mkl/2021.4.0/include -MT plan-many-r2r.lo -MD -MP -MF .deps/plan-many-r2r.Tpo -c plan-many-r2r.c -o plan-many-r2r.o >/dev/null 2>&1
mv -f .deps/execute-split-dft.Tpo .deps/execute-split-dft.Plo
mv -f .deps/execute-dft-r2c.Tpo .deps/execute-dft-r2c.Plo
version.c(24): error: expected a ";"
  const char X(cc)[] = FFTW_CC;
                       ^

My configure line looks like:

CC=icc CFLAGS='-O3 -fPIC -fp-model strict -axCORE-AVX512,CORE-AVX2,AVX,SSE4.2 -I"${MKLROOT}/include"' LDFLAGS='-L${MKLROOT}/lib/intel64 -lmkl_rt -lpthread -ldl' ./configure  --enable-avx512 --enable-avx2 --enable-avx --enable-shared --enable-sse --enable-sse2  --enable-float --enable-fma

Thanks!

rdolbeau commented 2 years ago

Check the definition of FFTW_CC in your config.h, it should be a string. It's possible the fact you have double-quotes inside your CFLAGS might confuse things. Try removing them, as they are likely not necessary (and not used in your LDFLAGS anyway).

stevengj commented 2 years ago

Probably you want outer double quotes, not outer single quotes:

CFLAGS="-O3 -fPIC -fp-model strict -axCORE-AVX512,CORE-AVX2,AVX,SSE4.2 -I'${MKLROOT}/include'"
LDFLAGS="-L'${MKLROOT}/lib/intel64' -lmkl_rt -lpthread -ldl"

so that ${MKLROOT} gets substituted into the definitions of CFLAGS and LDFLAGS. (If you use outer single quotes, then ${MKLROOT} appears literally in the flags variable.)

stevengj commented 2 years ago

But yes, the literal double quotes in string might be confusing C; this should be fixed by correcting the order of the quotes as I suggested above.

Maybe we need to do some escaping when the #define FFTW_CC is constructed here: https://github.com/FFTW/fftw3/blob/80f5c5cf2a74835d101c38c54001a54de815c956/configure.ac#L747