rwesson / ALFA

Automated Line Fitting Algorithm
http://www.nebulousresearch.org/codes/alfa/
GNU General Public License v3.0
12 stars 6 forks source link

Compiling on Mac OS X 10.11 - fails #8

Closed dcnicholls closed 7 years ago

dcnicholls commented 8 years ago

The makefile will need a bit of tweaking for the Mac (especially OSX 10.11with the new security system). The following errors result from 'make' on a system running the Macports installs of gcc 5.3 and using gfortran (probably not a surprise):

ld: warning: directory not found for option '-L/usr/lib/x86_64-linux-gnu/' ld: library not found for -lcfitsio collect2: error: ld returned 1 exit status make: *\ [alfa] Error 1

Am exploring further.

DN

rwesson commented 8 years ago

Thanks for that information! I don't have a mac to test things on, but I heard from another mac user that removing '-L/usr/lib/x86_64-linux-gnu/' gives a successful compilation, and that specifying PREFIX=/usr/local allows installation under the new security restrictions.

dcnicholls commented 8 years ago

With those changes made, I still see

ld: library not found for -lcfitsio

I'll see about installing cfitsio libraries and report back. I do have cfitsio installed under Macports, but apparently that's not enough.

dcnicholls commented 8 years ago

I needed to add the following line to allow sudo make install to work: test -e ${DESTDIR}${PREFIX}/share/bash-completion/completions || mkdir -p ${DESTDIR}${PREFIX}/share/bash-completion/completions Otherwise the folder was not created and the process, while it compiled the executable, threw an error on the Mac.

dcnicholls commented 8 years ago

More important, for reasons I have not yet discovered, using the option -skycat, -strongcat or -deepcat gives the following error:

13:36:51 : starting code 13:36:51 : command line: alfa filename.txt -rg 7000 -deepcat 13:36:51 : error: some input options were not recognised: filename.txt -deepcat

Without that catalogue option, it does work.

dcnicholls commented 8 years ago

One more point, I needed to compile the HEASARC cfitsio (with prefix set to /usr/local in the Makefile), because the Macports version of cfitsio threw errors when called from alfa. It is probably an old version. The HEASARC version works fine.

rwesson commented 8 years ago

I've fixed the makefile so that it doesn't fail to install if the bash completion directory is not found. I'm surprised that macports cfitsio didn't work as I'd tested ALFA with cfitsio 2 and 3. Was the error during compilation or at runtime? If the macports version puts the library somewhere non-standard, you could also fix that by giving the path in the -L switch, or set the LD_LIBRARY_PATH environment variable.

The problem with catalogue options is that the code doesn't understand them if they are not followed by a filename. I've changed the error messages given when options are not recognised to hopefully make them clearer.

dcnicholls commented 8 years ago

The Macports cfitsio error was at alfa compile time. I did try the -L option to point to /opt/local... etc but the compiler said that some of the routines it needed were missing. The -L flag set to the HEASARC compile version of cfitsio worked without a glitch. However, when I tried to run alfa with a simple spectrum fits file (the same data I used as a text file successfully) the process stalled and I had to kill it (maybe I was just impatient?). The fits file was the source of the text file, converted using STSDAS/wspectext. I will try it with other spectrum fits files to see if I can repeat the problem.

rwesson commented 8 years ago

On debian, the CFITSIO libraries are split into one package just for running codes which call it, and another for actually compiling them, so maybe the macports problem is that it only contains the runtime libraries. Unless you are really very impatient, it sounds like the code didn't handle your fits file properly - it should take only a second or two to analyse. Probably the FITS reading is going wrong. Does the file have multiple extensions?

dcnicholls commented 8 years ago

No, just a very simple fits file with a simple header. I installed the Macports cfitsio using the +universal flag. I don't know what that ends up with. However, the HEASARC version is simple to compile provided you set up the --prefix command to point to a Mac OSX 10.11 acceptable location. I'll try other fits files and see if I get the same problem.

rwesson commented 8 years ago

I released version 1.0 a few weeks ago, which I think should have addressed FITS reading issues. Previously ALFA could get into an infinite loop if a keyword was not found, which was most likely the problem you reported on 30 April. Please do update this thread if you encounter any further problems.

rwesson commented 7 years ago

Since this bug report I fixed FITS reading issues, and additionally changed the Makefile to be more portable between mac and linux systems. I think this should have fixed the issues here, but if not, then please do reopen this issue or create another one. Thanks!