How to link CFITSIO LIBRARY on MacOSX?

271 views
Skip to first unread message

Simone Iovenitti

unread,
Feb 27, 2020, 5:20:53 AM2/27/20
to astrometry
I tried to compile several times, explicitingly linking cfitsio:

make CFITS_INC="/Library/cfitsio-3.47/include" CFITS_LIB="/Library/cfitsio-3.47/lib -lcfitsio"


But when I try to do:

solve-field --scale-low 10 examples/apod4.jpg


I still get this error message:

ERROR: Mismatch in the CFITSIO_SONAME value in the fitsio.h include file

that was used to build the CFITSIO library, and the value in the include file

that was used when compiling the application program:

   Version used to build the CFITSIO library   = 8

   Version included by the application program = 7


Fix this by recompiling and then relinking this application program 

with the CFITSIO library.


Do someone have any idea? :S...

Thank you.

Simo

Dustin Lang

unread,
Feb 27, 2020, 7:40:02 AM2/27/20
to Simone Iovenitti, astrometry
Hi,

CFITS_INC and CFITS_LIB must be full command-line arguments to gcc -- so for INC you need the "-I" and for LIB you need the "-L" in front of the directories.

make clean
make CFITS_INC="-I/Library/cfitsio-3.47/include" CFITS_LIB="-L/Library/cfitsio-3.47/lib -lcfitsio"

Note that this just tells gcc where to find the header and library at link time.  At run time, it's up to the OS (dynamic linker) to actually find and load the library files.

You can check which library files will be used with ldd:

ldd $(which solve-field)

Eg, I get dozens of lines, including

> ldd $(which solve-field)
linux-vdso.so.1 (0x00007ffd434ed000)
libcfitsio.so.5 => /usr/lib/x86_64-linux-gnu/libcfitsio.so.5 (0x00007f9cef2a8000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9cef089000)
libwcs.so.4.7 => /usr/local/wcslib-4.7/lib/libwcs.so.4.7 (0x00007f9ceed86000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9cee9e8000)

if it is finding some other cfitsio library instead of the one you want, you can use the LD_LIBRARY_PATH environment variable to add a search path:

export LD_LIBRARY_PATH=/Library/cfitsio-3.47/lib:${LD_LIBRARY_PATH}
ldd $(which solve-field)

cheers,
--dustin






--
You received this message because you are subscribed to the Google Groups "astrometry" group.
To unsubscribe from this group and stop receiving emails from it, send an email to astrometry+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/astrometry/4d13cc9b-10ee-4e41-9fd4-a5d145e0c9ac%40googlegroups.com.

Simone Iovenitti

unread,
Feb 27, 2020, 8:57:50 AM2/27/20
to astrometry
Dear Dustin,

thank you so much, but it doesn't work.

I have recompiled the whole astrometry with the commands:
   $ make CFITS_INC="-I/Users/simo/Software/Astro/Astrometry/cfitsio-3.47/include" CFITS_LIB="-L/Users/simo/Software/Astro/Astrometry/cfitsio-3.47/lib -lcfitsio"
   $ make py
   $ make extra
   $ make install INSTALL_DIR=/Users/simo/Software/Astro/Astrometry

Then I have tried: 
   $ solve-field demo/sdss.jpg
but I get the same error then before.

Reading input file 1 of 1: "demo/sdss.jpg"...

jpegtopnm: WRITING PPM FILE

Read file stdin: 496 x 340 pixels x 1 color(s); maxval 255

Using 8-bit output

Extracting sources...


ERROR: Mismatch in the CFITSIO_SONAME value in the fitsio.h include file

that was used to build the CFITSIO library, and the value in the include file

that was used when compiling the application program:

   Version used to build the CFITSIO library   = 8

   Version included by the application program = 7


Fix this by recompiling and then relinking this application program 

with the CFITSIO library.

augment-xylist.c:940:augment_xylist Source extraction failed

 image2xy-files.c:47:image2xy_files Failed to open FITS input file /tmp/tmp.fits.NfnddF

 ../util/cfitsutils.h:26:cfitserr could not open the named file



The output of:
   $ otool -L $(which solve-field)        # analogous to linux' $ ldd $(which solve-field)

/Users/simo/Software/Astro/Astrometry/bin/solve-field:

@rpath/libcfitsio.8.dylib (compatibility version 8.0.0, current version 8.3.47)

/opt/local/lib/libgsl.23.dylib (compatibility version 25.0.0, current version 25.0.0)

/opt/local/lib/libgslcblas.0.dylib (compatibility version 1.0.0, current version 1.0.0)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

/opt/local/lib/libwcs.5.dylib (compatibility version 5.0.0, current version 5.17.0)



While
   $ echo $LD_LIBRARY_PATH
gives:

/Users/simo/Software/Astro/Astrometry/cfitsio-3.47/lib




.. I really don't know what is going wrong :S
Do you have any further idea?
Thank you again,
Simone
 

Dustin Lang

unread,
Feb 27, 2020, 9:32:38 AM2/27/20
to Simone Iovenitti, astrometry
Ok, the error message is saying that version 7 of cfitsio.h was included when building the code.  So it looks like you have another copy of cfitsio installed somewhere that is searched BEFORE your -I... path.

You can see where gcc is finding its header files by going

make CC="gcc -H" CFITS_INC=".....etc......"

cheers,
--dustin



--
You received this message because you are subscribed to the Google Groups "astrometry" group.
To unsubscribe from this group and stop receiving emails from it, send an email to astrometry+...@googlegroups.com.

Simone Iovenitti

unread,
Feb 27, 2020, 10:26:30 AM2/27/20
to Dustin Lang, astrometry
Thank you Dustin for your help.
I am trying with CONDA
as I cannot find a solution to this.
Thank you again,

    Simone Iovenitti

--



Dustin Lang

unread,
Feb 27, 2020, 10:32:19 AM2/27/20
to Simone Iovenitti, astrometry
You probably have another copy of cfitsio.h in /usr/include or /usr/local/include.

Reply all
Reply to author
Forward
0 new messages