Installing SExtractor on Mac OS X Snow Leopard

(November 25, 2010) I screwed up SExtractor installation for no reason and in an attempt to fix it, I’ve found a few things.  After wasting a few hours again, I think this installation note can work for most people who can actually build software from source… I think the usefulness of this note will be limited though, as a new release of SExtractor appears imminent.

Installing from Fink

Fink has a version of SExtractor.  I can install this via the command fink install.

$ fink install sextractor

If Fink is already installed, this may be the most trouble free way of installing SExtractor.

Installing from Source

IMPORTANT: I need FFTW and ATLAS installed already, and assume that FFTW was installed at /usr/local/fftw, and ATLAS at /usr/local/atlas following the source install procedures described in those notes.  Make sure that you build both double and single precision versions of FFTW by going through the make procedure twice to install both.  Build both of them from source, and do not use the libraries from, say, Fink; otherwise dependency hell might arise.  So, if I have Fink or Scisoft installed, put them away during the installation to avoid path problems.  For example, temporarily rename /sw to /sw.tmp to put Fink away, /usr/local/scisoft to /usr/local/scisoft.tmp to put Scisoft away.  (Or alternatively I can “comment out” from your start up shell script those lines that set up Fink and Scisoft, so that environment variables won’t include paths to these things.)  Then restart the computer, and start the whole installation process (that is, including FFTW and ATLAS).

Download the SExtractor source into a temporary directory:

$ mkdir tmp
$ cd tmp
... download sextractor-2.8.6.tar.gz
$ tar -xvzf sex*.tar.gz
$ cd sextractor-2.8.6
$ ./configure --prefix=/usr/local/sextractor-2.8.6 \
    --with-atlas=/usr/local/atlas/lib --with-atlas-incdir=/usr/local/atlas/include \
    --with-fftw=/usr/local/fftw/lib --with-fftw-incdir=/usr/local/fftw/include \
$ make
$ sudo make install
$ ln -s /usr/local/sextractor-2.8.6 /usr/local/sextractor
$ sudo cp -rp config /usr/local/sextractor

This will install SExtractor at /usr/local/sextractor-2.8.6 (which is aliased by /usr/local/sextractor) and an executable command sex will be located at /usr/local/sextractor/bin/sex.  Make a simlink to that binary /usr/local/bin to make it available system-wide.  I might also want to make a simlink to /usr/local/sextractor/bin/ldactoasc, which is a utility command that might be useful.  The last line copies the SExtractor configuration files and convolution masks to /usr/local/sextractor/config.  The default convolution masks are often used so it may be a good idea to keep them under the same installation directory.

Hope this is it!

What if Make Stops with an Error?

There may be a bug in ./configure script that makes the --with-fftw-incdir option to be not honored.  If the make stops with errors complaining as in “error: fftw3.h: No such file or directory” despite that I have installed FFTW properly, copy /usr/local/fftw/include/fftw3.h to the sextractor-2.8.6/src directory before doing make.  It will compile fine then.

Update History

November 25, 2010 — Made the procedure description a bit more elaborate where things may fail.

This entry was posted in Uncategorized and tagged , , , , , , , . Bookmark the permalink.

16 Responses to Installing SExtractor on Mac OS X Snow Leopard

  1. Pingback: Installing SExtractor 2.8.6 on Mac OS X Leopard | Biboroku

  2. CJ says:

    Hi, it was really helpful for me. Thank you.
    I have one question!
    Could you let me know how can I make a simlink to make sextractor command system-wide?

    • Taro says:

      CJ — First on command line do,

      $ echo $PATH

      and see what directories are defined in the environment variable PATH. If your sex binary (or symlink to it) is in one of those directories, you are able to just type sex to launch the program.

      If you want to make the program available system-wide and can use sudo, then

      $ sudo ln -s /usr/local/sextractor/bin/sex /usr/local/bin

      should do it, as PATH usually has /usr/local/bin defined.

  3. Glenn says:

    So, I’ve been trying to follow your instructions for installing SExtractor 2.8.6 on a Mac Mini running Snow Leopard. I started with a clean Mini, installed gfortran from HPC, and then built FFTW 3.3.2 and ATLAS 3.9.78 (using LAPACK 3.4.1) successfully. But when I try to configure SExtractor, I get:

    checking for clapack_dpotrf in -llapack… no
    checking for cblas_dgemm in -lcblas… yes
    checking for clapack_dpotrf in -llapack… no
    checking for cblas_dgemm in -lcblas… yes
    configure: error: CBLAS/LAPack library files not found in /Users/admin/Downloads/atlas/lib! Exiting.

    I just have no idea where to go from here, and thought maybe you could help?

    • Glenn says:

      (Incidentally, I was using the Downloads directory in place of /usr/local to do all the building for testing purposes; I substituted all the paths correctly on the command line, and the ATLAS install exists exactly where it says above [see below].)

      ls -l $HOME/Downloads/atlas/lib
      total 71472
      -rw-r–r– 1 admin staff 6791032 Jun 22 11:17 libatlas.a
      -rw-r–r– 1 admin staff 301944 Jun 22 11:17 libcblas.a
      -rw-r–r– 1 admin staff 303832 Jun 22 11:17 libf77blas.a
      -rw-r–r– 1 admin staff 7581672 Jun 22 11:17 liblapack.a
      -rw-r–r– 1 admin staff 301992 Jun 22 11:17 libptcblas.a
      -rw-r–r– 1 admin staff 303880 Jun 22 11:17 libptf77blas.a
      -rwxr-xr-x 1 admin staff 10447568 Jun 22 11:17 libsatlas.dylib
      -rwxr-xr-x 1 admin staff 10548920 Jun 22 11:17 libtatlas.dylib

      nm -a $HOME/Downloads/atlas/lib/liblapack.a | grep dpotrf
      U _ATL_dpotrf
      0000000000000000 T _clapack_dpotrf
      U _dpotrf_

      There it is, so the only thing I can figure is a bug in the SExtractor configure script? I’m stumped for now.

    • Glenn says:

      Oddly, I get a different problem on Lion (10.7.4); the configure completes normally, but the make process exits early with:

      cc -DHAVE_CONFIG_H -I. -I.. -O3 -g -funroll-loops -fomit-frame-pointer -Wall -D_REENTRANT -MT fft.o -MD -MP -MF .deps/fft.Tpo -c -o fft.o fft.c
      fft.c:25:10: fatal error: ‘fftw3.h’ file not found

      Note that the command line makes no mention of where to find FFTW, though I configured FFTW to be in a custom location. Clearly, the configure process for SExtractor 2.8.6 has some issues.

      • Taro says:

        Glenn — Sorry for not finding your comment sooner. There are so many spams sent to this site and comments often get lost; I have to install a spam filter, which I haven’t gotten around to do yet.

        I think this ‘fftw3.h’ file not found problem is something I’ve encountered, and the same workaround that I described above (at the end of the post) helps there.

        As for another issue, I have no idea how to fix. I also find the SExtractor config file to be fairly mysterious, and when things go wrong you can only experiment with things and/or ask Emanuel Bertin and hope he responds in his site.

        Somebody should take up the challenge of writing an open-source equivalent of SExtractor, so that we don’t have to deal with this sort of thing (or at least people can contribute their patches).

    • Glenn says:

      I figured it out, I think; the latest versions of ATLAS (3.9.78, at least) create dynamic libraries named libsatlas.dylib (serial) and libtatlas.dylib (threaded). The threaded one seems to be the library SExtractor wants; if you do a global substitute of “-ltatlas” for “-llapack|-lcblas|-latlas|-lptcblas” in SExtractor’s configure file, the darn thing compiles under 10.6.8.

      • Glenn says:

        FFTW 3.3.2

        sudo tar -xzof fftw-3.3.2.tar.gz -C /usr/local/
        pushd /usr/local/fftw-3.3.2/
        sudo ./configure --enable-threads
        sudo make; sudo make install
        sudo ./configure --enable-threads --enable-single
        sudo make clean; sudo make; sudo make install

        ATLAS 3.9.78 with LAPACK 3.4.1

        sudo tar -xof atlas3.9.78.tar.bz2 -C /usr/local/atlas-3.9.78 \
        --strip-components 1
        sudo cp lapack-3.4.1.tgz /usr/local/atlas-3.9.78/lapack.tgz
        sudo mkdir /usr/local/atlas-3.9.78/build
        pushd /usr/local/atlas-3.9.78/build
        sudo ../configure -b 64 --shared --prefix=/usr/local \
        sudo make build
        sudo make check
        sudo make time
        sudo make install

        SExtractor 2.8.6 (Astromatic source)

        sudo tar -xzof sextractor-2.8.6.tar.gz -C /usr/local/
        pushd /usr/local/sextractor-2.8.6
        sudo sed -i '' -e 's/-llapack/-ltatlas/' -e 's/-lcblas/-ltatlas/' \
        -e 's/-latlas/-ltatlas/' -e 's/-lptcblas/-ltatlas/' ./configure
        sudo ./configure --enable-threads
        sudo make; sudo make install

  4. Semeli says:

    Thank you for helpful comments.

    If you have used macports to install atlast use this:

    ./configure –prefix=/usr/local/sextractor-2.8.6 –with-atlas=/opt/local/lib –with-atlas-incdir=/opt/local/include –with-fftw=/opt/local/lib –with-fftw-incdir=/opt/local/include –enable-threads

  5. Hugo says:

    Does this work on Mountain Lion and newer versions of ATLAS and LATPACK?

  6. bryce says:

    thanks very much everyone, this is a fantastic resource!

  7. Sebastian Ramirez says:

    Thanks for the procedure!
    It worked in Mavericks (MacOSX 10.9)

Leave a Reply

Your email address will not be published. Required fields are marked *