# Installing external libraries (FITS files in ROOT)

**URL:** <https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945>\
**Category:** ROOT\
**Created:** [July 21, 2014, 5:22pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945 "2014-07-21T17:22:28Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![adthelad](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@adthelad](https://root-forum.cern.ch/u/adthelad)\
**Post date:** [July 21, 2014, 5:22pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/1 "2014-07-21T17:22:28Z")

</div>

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](http://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

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [July 21, 2014, 5:56pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/2 "2014-07-21T17:56:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adthelad](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@adthelad](https://root-forum.cern.ch/u/adthelad)\
**Post date:** [July 21, 2014, 6:43pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/3 "2014-07-21T18:43:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [July 21, 2014, 6:46pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/4 "2014-07-21T18:46:44Z")

</div>

See the “[ROOT Build Prerequisites](http://root.cern.ch/drupal/content/build-prerequisites)” web page (search for “fitsio”).

---

<div class="post-metadata">

**Author:** ![adthelad](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@adthelad](https://root-forum.cern.ch/u/adthelad)\
**Post date:** [July 21, 2014, 7:06pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/5 "2014-07-21T19:06:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [July 21, 2014, 7:14pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/6 "2014-07-21T19:14:04Z")

</div>

See the “[Installing ROOT from Source](http://root.cern.ch/drupal/content/installing-root-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](http://root.cern.ch/root/html534/tutorials/fitsio/index.html)” web page.

---

<div class="post-metadata">

**Author:** ![adthelad](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@adthelad](https://root-forum.cern.ch/u/adthelad)\
**Post date:** [July 21, 2014, 7:42pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/7 "2014-07-21T19:42:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adthelad](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@adthelad](https://root-forum.cern.ch/u/adthelad)\
**Post date:** [July 21, 2014, 8:49pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/8 "2014-07-21T20:49:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [July 21, 2014, 9:03pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/9 "2014-07-21T21:03:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adthelad](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@adthelad](https://root-forum.cern.ch/u/adthelad)\
**Post date:** [July 21, 2014, 9:13pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/10 "2014-07-21T21:13:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adthelad](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@adthelad](https://root-forum.cern.ch/u/adthelad)\
**Post date:** [July 21, 2014, 10:51pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/11 "2014-07-21T22:51:29Z")

</div>

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 )

---

<div class="post-metadata">

**Author:** ![adthelad](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@adthelad](https://root-forum.cern.ch/u/adthelad)\
**Post date:** [July 22, 2014, 12:39am UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/12 "2014-07-22T00:39:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [July 22, 2014, 8:19am UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/13 "2014-07-22T08:19:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adthelad](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/57b2e6/32.png) [@adthelad](https://root-forum.cern.ch/u/adthelad)\
**Post date:** [July 22, 2014, 2:34pm UTC](https://root-forum.cern.ch/t/installing-external-libraries-fits-files-in-root/17945/14 "2014-07-22T14:34:09Z")

</div>

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 😃
