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

[BUG] configure fails to find FFTW, SuiteSparse, OpenMP, BLAS, LAPACK, OpenGL #302

Open
yurivict opened this issue Nov 12, 2023 · 5 comments
Labels

Comments

@yurivict
Copy link

🐛 Bug report

Description of the bug

checking for Python ... /usr/ports/misc/madagascar/work/.bin/python
checking Python version ... 3.9.18
checking for RSFROOT ... /usr/local
checking for SCons ... /usr/local/bin/scons
checking SCons version ... v4.4.0.fc8d0ec215ee6cba8bc158ad40c099be0b598297
Running RSFROOT=/usr/local /usr/local/bin/scons  config ...
------------------------
scons: Reading SConscript files ...
checking platform ... (cached) posix [unknown]
checking for C compiler ... (cached) cc
checking if cc works ... yes
checking for ar ... (cached) ar
checking for rpc ... ['m']
checking complex support ... yes
checking for X11 headers ... /usr/X11R6/include
checking for X11 libraries ... /usr/X11R6/lib
checking for OpenGL ... no
checking for sfpen ... (cached) xtpen
checking for ppm ... no
checking for tiff ... no

  sfbyte2tif, sftif2byte, and tiffpen will not be built.
checking for GD (PNG) ... no

  gdpen will not be built.
checking for plplot ... no
checking for ffmpeg ... no
checking for cairo (PNG) ... no
checking for jpeg ... no

  sfbyte2jpg, sfjpg2byte, and jpegpen will not be built.
checking for BLAS ... no
checking for LAPACK ... no
checking for SWIG ... (cached) /usr/local/bin/swig
checking for numpy ... (cached) yes
checking API options ... (cached) []
checking for C++ compiler ... (cached) CC
checking if CC works ... yes
checking for MPICC ... (cached) /usr/local/bin/mpicc
checking if /usr/local/bin/mpicc works ... yes
checking for MPICXX ... (cached) /usr/local/bin/mpicxx
checking if /usr/local/bin/mpicxx works ... yes
checking for MPIRUN ... (cached) /usr/local/bin/mpirun
checking for Posix threads ... no
checking for OpenMP ... no
checking for CUDA ... (cached) no
checking for FFTW ... no
checking for SuiteSparse ... no
scons: done reading SConscript files.
usage: scons [OPTIONS] [VARIABLES] [TARGETS]

SCons Error: no such option: --build
------------------------
Done with configuration.

All these packages are installed and are easily discoverable.

Include and lib paths are set correctly in CFLAGS, CXXFLAGS, LDFLAGS, which is a convention.

I see that you wrote 2600+ lines in framework/configure.py to detect some of these packages and this code fails in SCons.
SCons is an anachronism, I recommend that you should use cmake.
With cmake finding all these packages would have been done correctly with fewer than 100 lines of cmake code.

To Reproduce
Run configure.

Revision: d729968
FreeBSD 13.2

@yurivict yurivict added the bug label Nov 12, 2023
@sfomel
Copy link
Contributor

sfomel commented Nov 12, 2023

Please check the file config.log to find specific errors that prevent the configure script from detecting the optional extra packages.

@yurivict
Copy link
Author

yurivict commented Nov 12, 2023

for example:

scons: Configure: checking for FFTW ...
.sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.c <-
  |
  |    #include <fftw3.h>
  |    int main(int argc,char* argv[]) {
  |    fftwf_complex *in;
  |    fftwf_plan p;
  |    in = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * 10);
  |    p = fftwf_plan_dft_1d(10, in, in, FFTW_FORWARD, FFTW_ESTIMATE);
  |    fftwf_destroy_plan(p);
  |    fftwf_free(in);
  |    return 0;
  |    }
  |
cc -o .sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.o -c -O2 -DNO_BLAS -I/usr/include/cblas .sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.c
.sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.c:2:14: fatal error: 'fftw3.h' file not found
    #include <fftw3.h>
             ^~~~~~~~~
1 error generated.

It fails to find fftw3.h despite its path (-isystem /usr/local/include) being in the CXXFLAGS and CFLAGS environment variables.

@sfomel
Copy link
Contributor

sfomel commented Nov 13, 2023

SCons does not inherit the environment. You can specify parameters to configure as follows:

./configure CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS

Run scons --help to see other options.

@yurivict
Copy link
Author

Configure still fails to find FFTW with ./configure CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS:

scons: Configure: checking for FFTW ...
.sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.c <-
  |
  |    #include <fftw3.h>
  |    int main(int argc,char* argv[]) {
  |    fftwf_complex *in;
  |    fftwf_plan p;
  |    in = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * 10);
  |    p = fftwf_plan_dft_1d(10, in, in, FFTW_FORWARD, FFTW_ESTIMATE);
  |    fftwf_destroy_plan(p);
  |    fftwf_free(in);
  |    return 0;
  |    }
  |
cc -o .sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.o -c -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -DNO_BLAS -I/usr/include/cblas .sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.c
cc -o .sconf_temp/sfconftest_0c46a2a96952db7f43919c6fc31987be_0_25260cce507de1f1d4e4fc265dc8e16f .sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.o -lm
ld: error: undefined symbol: fftwf_malloc
>>> referenced by conftest_0c46a2a96952db7f43919c6fc31987be_0.c
>>>               .sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.o:(main)

ld: error: undefined symbol: fftwf_plan_dft_1d
>>> referenced by conftest_0c46a2a96952db7f43919c6fc31987be_0.c
>>>               .sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.o:(main)

ld: error: undefined symbol: fftwf_destroy_plan
>>> referenced by conftest_0c46a2a96952db7f43919c6fc31987be_0.c
>>>               .sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.o:(main)

ld: error: undefined symbol: fftwf_free
>>> referenced by conftest_0c46a2a96952db7f43919c6fc31987be_0.c
>>>               .sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_0.o:(main)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
.sconf_temp/conftest_0c46a2a96952db7f43919c6fc31987be_1.c <-

pkg-config does return the correct link flags:

 pkg-config --libs fftw3
-L/usr/local/lib -lfftw3

but they don't appear in the above link line which leads to the missing symbols problem.
The required argument -lfftw3 does not appear in the link line.

@yurivict
Copy link
Author

It's not necessary to compile a snippet of code using FFTW. pkg-config returns proper flags, and the cmake script returns correct flags as well.

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

No branches or pull requests

2 participants