astromatic / sextractor

Extract catalogs of sources from astronomical images
http://astromatic.net/software/sextractor
GNU General Public License v3.0
148 stars 43 forks source link

Option to compile SExtractor without fftw and ATLAS #17

Closed kirxkirx closed 8 months ago

kirxkirx commented 3 years ago

It would be convenient to have an option to compile SExtractor on systems that do not have fftw and ATLAS installed. While fftw is of not much concern, ATLAS is a monster and users may have problems compiling/installing it. Even when ATLAS can be installed using a package manager, it is still a pain to figure out where it was installed on that particular system (linux distribution) and supply the appropriate paths to SExtractor's configure script. At the same time, fftw and ATLAS are not needed for users not planning to do PSF-fitting photometry with SExtractor - the aperture photometry parameters work just fine without these libraries. Luckily, there is the SExtractor configure script option that is intended to do just that - compile SExtractor without the use of fftw and ATLAS: --disable-model-fitting

The problem is that after running ./configure --disable-model-fitting make fails with the following error message:

In file included from makeit.c:46:
./fft.h:34:10: error: expected "FILENAME" or <FILENAME>
#include FFTW_H
         ^
1 error generated.
make[3]: *** [makeit.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Some time ago I suggested a quick and seemingly safe fix to this problem. Can you please consider implementing this fix?

rmathar commented 3 years ago

The option to bypass ATLAS does exist: use configure --enable-openblas before compiling. The option to start programming without the fftw library would make much less sense, because fftw3-devel seems to be available in essentially all Linuxes.

kirxkirx commented 3 years ago

Thanks for pointing out the --enable-openblas option. It is good that there is a way to avoid ATLAS. However, I would argue that it is not the same as making the --disable-model-fitting option work. Neither OpenBLAS, nor fftw are typically installed by default, meaning the user has to make an effort to install them. If the user is (god forbid) on Mac, the user will need to explain to the configure script where these libraries are installed. I've just tried and failed:

# Install fftw
sudo port install fftw-3
# create the configure script
./autogen.sh
# run the configure script, Mac Ports install their stuff in /opt/local
./configure --enable-openblas --with-fftw-incdir=/opt/local/include --with-fftw-libdir=/opt/local/lib
...
checking whether OpenBLAS is enabled... yes
checking if model-fitting should be disabled (default=enabled)... no
checking for profiler mode... checking best linking option... no
checking /opt/local/include/fftw3.h usability... yes
checking /opt/local/include/fftw3.h presence... yes
checking for /opt/local/include/fftw3.h... yes
checking for fftwf_execute in -lfftw3f... no
configure: error: FFTW single precision library files not found in /opt/local/lib! Exiting.

I was obviously not trying hard enough, but my point is that I don't need any of these complications if I don't need the model-fitting feature. With the --disable-model-fitting option fixed, the contemporary version of SExtractor can be compiled just like SExtractor v2.5 with basically just gcc and make, requiring no external libraries. (One other thing is that having autogen.sh instead of configure script requires user to install autotools, which again seems like an unnecessary complication.) But leaving my personal desire for simplicity of installation aside...

Is there a reason not to implement this fix?

wellsjam commented 8 months ago

Did you ever get a fix for this? I have downloaded FFTW and Atlas and when I attempt to figure SExrtracter I get the same: checking whether OpenBLAS is enabled... yes checking if model-fitting should be disabled (default=enabled)... no checking for profiler mode... checking best linking option... no checking /opt/local/include/fftw3.h usability... yes checking /opt/local/include/fftw3.h presence... yes checking for /opt/local/include/fftw3.h... yes checking for fftwf_execute in -lfftw3f... no configure: error: FFTW single precision library files not found in /opt/local/lib! Exiting.

It is as if it can find the fftw3 but then cannot find the executable inside it?

rmathar commented 8 months ago

The function is there... you perhaps need to search also in /opt/local/lib64? Standard linux distributions install libraries in /usr/lib or /usr/lib64, not in /opt

mathar@mathar:/usr/lib64> objdump libfftw3f.so.3.6.9 -T | fgrep exec
00000000000e6fc0 g    DF .text  000000000000002a  Base        sfftw_execute_split_dft_c2r_
00000000000e5ea0 g    DF .text  0000000000000012  Base        fftwf_execute
0000000000021740 g    DF .text  0000000000000044  Base        fftwf_solvtab_exec
00000000000e7530 g    DF .text  0000000000000005  Base        sfftw_execute_dft_r2c__
kirxkirx commented 8 months ago

The current GitHub version of SExtractor understands the configure option --disable-model-fitting, so if you run

./configure --disable-model-fitting

it will not bother you with FFTW and ATLAS (I've just double-checked that it works). That is a solution for the case where one doesn't need PSF photometry functionality and plans to do only aperture photometry with SExtractor.

ebertin commented 8 months ago

Hi @wellsjam, Indeed this was fixed in b13e36d (thx to @kirxkirx). I should have closed this issue. Thanks.