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.66k stars 651 forks source link

Fftw build failed when open ENABLE_OPENMP #342

Open LilyWangLL opened 7 months ago

LilyWangLL commented 7 months ago

The version of fftw: 3.3.10 OS: Windows 11 x64 & Visual Studio 2022

I use vcpkg to install fftw3[openmp], it build failed on with the following errors. The solution from https://github.com/FFTW/fftw3/issues/120 could resolve these errors, but this could cause repeat their definitions in the DLL.

I also test this https://github.com/FFTW/fftw3/issues/142#issuecomment-383681588, but it still builds failed. cc @stevengj

[449/450] cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=CMakeFiles\fftw3f_omp.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\link.exe  CMakeFiles\fftw3f_omp.dir\threads\api.c.obj CMakeFiles\fftw3f_omp.dir\threads\conf.c.obj CMakeFiles\fftw3f_omp.dir\threads\ct.c.obj CMakeFiles\fftw3f_omp.dir\threads\dft-vrank-geq1.c.obj CMakeFiles\fftw3f_omp.dir\threads\f77api.c.obj CMakeFiles\fftw3f_omp.dir\threads\hc2hc.c.obj CMakeFiles\fftw3f_omp.dir\threads\rdft-vrank-geq1.c.obj CMakeFiles\fftw3f_omp.dir\threads\vrank-geq1-rdft2.c.obj CMakeFiles\fftw3f_omp.dir\threads\openmp.c.obj  /out:fftw3f_omp.dll /implib:fftw3f_omp.lib /pdb:fftw3f_omp.pdb /dll /version:3.0 /machine:x64 /debug /INCREMENTAL  fftw3f.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
FAILED: fftw3f_omp.dll fftw3f_omp.lib 
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=CMakeFiles\fftw3f_omp.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\link.exe  CMakeFiles\fftw3f_omp.dir\threads\api.c.obj CMakeFiles\fftw3f_omp.dir\threads\conf.c.obj CMakeFiles\fftw3f_omp.dir\threads\ct.c.obj CMakeFiles\fftw3f_omp.dir\threads\dft-vrank-geq1.c.obj CMakeFiles\fftw3f_omp.dir\threads\f77api.c.obj CMakeFiles\fftw3f_omp.dir\threads\hc2hc.c.obj CMakeFiles\fftw3f_omp.dir\threads\rdft-vrank-geq1.c.obj CMakeFiles\fftw3f_omp.dir\threads\vrank-geq1-rdft2.c.obj CMakeFiles\fftw3f_omp.dir\threads\openmp.c.obj  /out:fftw3f_omp.dll /implib:fftw3f_omp.lib /pdb:fftw3f_omp.pdb /dll /version:3.0 /machine:x64 /debug /INCREMENTAL  fftw3f.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1425~1.286\bin\Hostx64\x64\link.exe CMakeFiles\fftw3f_omp.dir\threads\api.c.obj CMakeFiles\fftw3f_omp.dir\threads\conf.c.obj CMakeFiles\fftw3f_omp.dir\threads\ct.c.obj CMakeFiles\fftw3f_omp.dir\threads\dft-vrank-geq1.c.obj CMakeFiles\fftw3f_omp.dir\threads\f77api.c.obj CMakeFiles\fftw3f_omp.dir\threads\hc2hc.c.obj CMakeFiles\fftw3f_omp.dir\threads\rdft-vrank-geq1.c.obj CMakeFiles\fftw3f_omp.dir\threads\vrank-geq1-rdft2.c.obj CMakeFiles\fftw3f_omp.dir\threads\openmp.c.obj /out:fftw3f_omp.dll /implib:fftw3f_omp.lib /pdb:fftw3f_omp.pdb /dll /version:3.0 /machine:x64 /debug /INCREMENTAL fftw3f.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\fftw3f_omp.dir/intermediate.manifest CMakeFiles\fftw3f_omp.dir/manifest.res" failed (exit code 1120) with the following output:
Microsoft (R) Incremental Linker Version 14.25.28611.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library fftw3f_omp.lib and object fftw3f_omp.exp
api.c.obj : error LNK2019: unresolved external symbol fftwf_imax referenced in function fftwf_plan_with_nthreads
api.c.obj : error LNK2001: unresolved external symbol fftwf_mksolver_ct_hook
api.c.obj : error LNK2001: unresolved external symbol fftwf_mksolver_hc2hc_hook
conf.c.obj : error LNK2019: unresolved external symbol fftwf_solvtab_exec referenced in function fftwf_threads_conf_standard
ct.c.obj : error LNK2001: unresolved external symbol fftwf_dft_solve
dft-vrank-geq1.c.obj : error LNK2001: unresolved external symbol fftwf_dft_solve
vrank-geq1-rdft2.c.obj : error LNK2019: unresolved external symbol fftwf_ops_zero referenced in function applicable
ct.c.obj : error LNK2001: unresolved external symbol fftwf_ops_zero
dft-vrank-geq1.c.obj : error LNK2001: unresolved external symbol fftwf_ops_zero
hc2hc.c.obj : error LNK2001: unresolved external symbol fftwf_ops_zero
rdft-vrank-geq1.c.obj : error LNK2001: unresolved external symbol fftwf_ops_zero
vrank-geq1-rdft2.c.obj : error LNK2019: unresolved external symbol fftwf_ops_add2 referenced in function applicable
ct.c.obj : error LNK2001: unresolved external symbol fftwf_ops_add2
dft-vrank-geq1.c.obj : error LNK2001: unresolved external symbol fftwf_ops_add2
hc2hc.c.obj : error LNK2001: unresolved external symbol fftwf_ops_add2
rdft-vrank-geq1.c.obj : error LNK2001: unresolved external symbol fftwf_ops_add2
garging commented 2 months ago

I fixed almost all errors by adding IFFTW_EXTERN to function declarations except for fftwf_mksolver_hc2hc_hook... This function is exported at fftw3f.dll, but cannot be linked in fftw3f_omp.