Installing external libraries (FITS files in ROOT)

Hi,

I would like to analyze FITS files within ROOT. I found an external library that I believe can do it, but I was not able to use it. Would anyone be able to provide me with a guide on how to install external libraries, and how to set environment variables, as this gave me some trouble. The library I wish to install is here:

isdc.unige.ch/astroroot/index

I am not sure if this library is still supported, the website looks quite old. I’m also open to other suggestions for analyzing FITS files within ROOT if there are better options out there.

Thanks,
Adam

Try:
root-config --features
and see if it contains the “fitsio” string, or try:
root-config --has-fitsio
and see if you get “yes”.

Otherwise, you will need to configure and build your ROOT from scratch (assuming that you have installed appropriate cfitsio / libcfitsio and fitsio.h files). After the “configure” step, make sure that you see “fitsio” among the enabled features near the end of the “config.log” file. If not, search the “config.log” file for “fitsio” and see why it failed to find your cfitsio library / include file.

okay I downloaded cfitsio and extracted it, but was not able to configure it. Would you be able to post a step by step way to do this as it’s really confusing me. Thanks

See the “ROOT Build Prerequisites” web page (search for “fitsio”).

okay I have installed all of the build prerequsites. Would you be able to direct me how to recompile using the fitsio library?

See the “Installing ROOT from Source” web page.

The simplest trial would be: rm -rf v5-34-00-patches git clone -b v5-34-00-patches http://root.cern.ch/git/root.git v5-34-00-patches cd v5-34-00-patches unset ROOTSYS ./configure --enable-soversion --all make
See also the “ROOT Tutorials: CFITSIO interface” web page.

my ROOT is compiling now, i will let you know after compiling if the FITSIO library is working. Thanks for all the help so far, its been very helpful.

So i recompiled ROOT but I still get no for root-config --has-fitsio. Do I need to add an extra argument to the ./configure command?

Inspect the “config.log” file. Search for the line “Checking for fitsio.h …” and then for the line “Checking for libcfitsio, or cfitsio …” and see why your “fitsio” has not been found.

ROOT searched many directories but never found it, I will extract cfitsio into usr/local/include now. I think i did not make cfitsio in the correct place. I have done this now and will try to recompile ROOT. Will let you know how it goes.

Okay so now ROOT can find the library but I get the error in the logfile:

Found file /usr/lib/i386-linux-gnu/libcfitsio.a
Checking if /usr/lib/i386-linux-gnu/libcfitsio.a is a 64-bit library
objdump -a /usr/lib/i386-linux-gnu/libcfitsio.a | grep 'x86-64’
result = 0

I understand this means my library is not a 64 bit library. How can i amend this? ( I use a 32 bit machine )

I was able to get past this now by switching to a 64Bit OS I have on another machine. By following all the steps again I have reached the point where in the config.log file it appears as if cfitsio should be detected, but root-config --has-fitsio returns no.

The config.log file now says in relation to fitsio:

Checking for fitsio.h ... Checking in directory /usr/local/include Checking for fitsio.h in directory /usr/local/include /usr/local/include/fitsio.h is read-able Checking for libcfitsio, or cfitsio ... libraries to check for: libcfitsio.a libcfitsio.lib libcfitsio cfitsio.a cfitsio.lib cfitsio libcfitsio.so libcfitsio.sl libcfitsio.dylib libcfitsio.dll.a cfitsio.so cfitsio.sl cfitsio.dylib cfitsio.dll.a Checking in directories /usr/local/lib64 /usr/local/lib/x86_64-linux-gnu /usr/local/lib64 /usr/local/lib for libcfitsio.a libcfitsio.lib libcfitsio cfitsio.a cfitsio.lib cfitsio libcfitsio.so libcfitsio.sl libcfitsio.dylib libcfitsio.dll.a cfitsio.so cfitsio.sl cfitsio.dylib cfitsio.dll.a Checking for library libcfitsio.a in directory /usr/local/lib Checking /usr/local/lib/libcfitsio.a Found file /usr/local/lib/libcfitsio.a Checking if /usr/local/lib/libcfitsio.a is a 64-bit library objdump -a /usr/local/lib/libcfitsio.a | grep 'x86-64' result: 1 is a 64bit library

Any further advice? thanks in advance

Both (i.e. 32-bit and 64-bit) log extracts seem fine to me (you should expect “result = 0” on a 32-bit system). Try to rename both “config.log” files into, respectively, “config.log.32.txt” and “config.log.64.txt” and attach them here for further inspection.

I completely removed root and then recompiled from source and now it is working great. Thanks for all the help, recompiling was a daunting prospect at first but you talked me through it well :smiley: