Trying to make on ubuntu. No cairo.h error

2,554 views
Skip to first unread message

Dan Gray

unread,
Feb 19, 2018, 7:28:09 PM2/19/18
to astrometry
Hi all,
I'm trying to "make" astrometry, and I get a some of errors....
Of course, I'm a Noobee.....

#1....Where do I get numpy????
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    import numpy
ImportError: No module named numpy
Makefile:93: recipe for target 'spherematch_c.so' failed
make[3]: *** [spherematch_c.so] Error 1
make[3]: Leaving directory '/home/dan/astrometry.net-0.73/libkd'

#2.... Looks like python 2 and python 3 is installed.  But I get this message about Python.h:
make[3]: Entering directory '/home/dan/astrometry.net-0.73/sdss'
python setup.py build_ext -v --inplace --build-temp .
running build_ext
building '_cutils' extension
swigging cutils.i to cutils_wrap.c
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cutils_wrap.c -o ./cutils_wrap.o
cutils_wrap.c:149:21: fatal error: Python.h: No such file or directory

#3....  Do I need to install Cairo??  If so, how?
make[2]: Entering directory '/home/dan/astrometry.net-0.73/blind'
gcc -o plotquad.o -c plotquad.c   -g -Wall -ffinite-math-only -fno-signaling-nans -pthread -march=native -O3 -fomit-frame-pointer -DNDEBUG -fpic -Winline -I../include -I../include/astrometry -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DAN_GIT_REVISION='"0.73"' -DAN_GIT_DATE='"Thu_Nov_16_08:30:44_2017_-0500"' -DAN_GIT_URL='"https://github.com/dstndstn/astrometry.net"' -I../catalogs         -I../include -I../include/astrometry -I../gsl-an     -I../include -I../include/astrometry -I../gsl-an  -I../util -I.   
plotquad.c:10:19: fatal error: cairo.h: No such file or directory
compilation terminated.

Thanks,
Dan Gray





Dustin Lang

unread,
Feb 20, 2018, 10:03:20 AM2/20/18
to astrometry
Hi,

Here,

http://astrometry.net/doc/build.html#ubuntu-or-debian-like-systems

it says that on ubuntu, you will need to install the following packages:

sudo apt-get install libcairo2-dev libnetpbm10-dev netpbm \
                       libpng12-dev libjpeg-dev python-numpy \
                       python-pyfits python-dev zlib1g-dev \
                       libbz2-dev swig cfitsio-dev

Let us know if you still have trouble after that!

cheers,
--dustin


Dan Gray

unread,
Feb 20, 2018, 1:38:50 PM2/20/18
to astrometry
Thanks a million Dustin,
This got me a LOT further.

Now,  in ./util/MakeFile line 432 I get this warning:
Makefile:432: cairoutils.dep: No such file or directory

But cairoutils.dep is right there in the same directory.

Here's the portion of the make file:
# we'll just tack this on here... It depends on cairo, libjpeg, etc,
# so it's not part of the anX.a libraries.
ifeq ($(MAKECMDGOALS),cairoutils.o)
  include cairoutils.dep
endif




Here's the contents of the cairoutils.dep file:
cairoutils.o: cairoutils.c /usr/include/cairo/cairo.h \
 /usr/include/cairo/cairo-version.h /usr/include/cairo/cairo-features.h \
 /usr/include/cairo/cairo-deprecated.h /usr/include/libpng12/png.h \
 /usr/include/libpng12/pngconf.h ../include/astrometry/os-features.h \
 ../include/astrometry/os-features-config.h \
 ../include/astrometry/ioutils.h ../include/astrometry/an-bool.h \
 ../include/astrometry/bl.h ../include/astrometry/keywords.h \
 ../include/astrometry/bl-nl.h ../include/astrometry/bl-nl.ph \
 ../include/astrometry/cairoutils.h ../include/astrometry/errors.h

Dustin Lang

unread,
Feb 20, 2018, 2:49:22 PM2/20/18
to astrometry
That's normal and expected -- when "make" sees that that file does not exist, it will create it.  ("dep" means "dependencies" -- "make" gets the compiler to read the source files and figure out their internal dependency structure, and then those dependencies are included in the makefile.  It's pretty standard stuff, but there's no way I have found to tell make not to complain that the dep file doesn't exist.)

If there were no other errors, then your build probably completed successfully.

cheers,
--dustin


Dan Gray

unread,
Feb 20, 2018, 3:38:48 PM2/20/18
to astrometry
Oh, well, thanks, that's great.
Now comes building the index files, started reading.....
Thanks again...
Dan

Dustin Lang

unread,
Feb 20, 2018, 4:43:13 PM2/20/18
to astrometry
No need to build your own index files unless you have unusual needs -- you can download pre-built ones from data.astrometry.net .

4100-series, built from Tycho-2, should be good for wide-field images.

4200-series, from 2MASS, are needed for narrow-field images.

cheers,
--dustin


Dan Gray

unread,
Feb 20, 2018, 5:15:00 PM2/20/18
to astrometry
Ok, great, I'll try those!
Thanks,
Dan

Carolyne Santos de Oliveira

unread,
Feb 4, 2019, 3:13:54 PM2/4/19
to astrometry
Hi Dustin,

I'm having the same error, accusing I don't have cairo installed but I already follow your suggestion.

Dustin Lang

unread,
Feb 4, 2019, 3:29:29 PM2/4/19
to astrometry
Hi,

Do you have the "libcairo2-dev" package installed?

Can you please send what "make" prints when you try to build?

Also, what does "pkg-config --modversion cairo" and "pkg-config --cflags cairo" ?

Thanks,
--dustin


Carolyne Santos de Oliveira

unread,
Feb 4, 2019, 3:41:40 PM2/4/19
to astrometry
I didn't have problems with "make", but "make py" is not working

Both commands you suggested say that I don't have cairo installed but when I try to install (sudo apt-get install libcairo2-dev) it says that I already have the newest version.


make py 

make -C util config
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/util'
make[1]: Nothing to be done for 'config'.
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/util'
make -C qfits-an
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/qfits-an'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/qfits-an'
make -C util
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/util'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/util'
make -C libkd
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/libkd'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/libkd'
make -C catalogs
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/catalogs'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/catalogs'
make -C util pyutil
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/util'
make[1]: Nothing to be done for 'pyutil'.
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/util'
make -C libkd pyspherematch
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/libkd'
pyspherematch
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/libkd'
make -C sdss
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/sdss'
make lib
make[2]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/sdss'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/sdss'
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/sdss'
make -C util cairoutils.o
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/util'
make[1]: 'cairoutils.o' is up to date.
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/util'
make -C blind pyplotstuff
make[1]: Entering directory '/home/carolyne/Programas/astrometry.net-0.76/blind'
LDFLAGS=" -g -Wall -ffinite-math-only -fno-signaling-nans -pthread -march=native -O3 -fomit-frame-pointer -DNDEBUG -fpic -Winline" LDLIBS="          -lm        -lm           -lm        -lm  -L/home/carolyne/anaconda2/envs/iraf27/lib -lpng16 -lz -L. -lnetpbm -ljpeg" \
SLIB="../util/cairoutils.o libastrometry.a ../catalogs/libcatalogs.a ../util/libanfiles.a ../libkd/libkd.a ../util/libanutils.a  ../qfits-an/libqfits.a ../util/libanbase.a     ../gsl-an/libgsl-an.a  ../util/libanutils.a  ../qfits-an/libqfits.a ../util/libanbase.a     ../gsl-an/libgsl-an.a " \
INC="     -I../include -I../include/astrometry -I../gsl-an     -I../include -I../include/astrometry -I../gsl-an   " \
CFLAGS_SWIG="  " \
CFLAGS=" -g -Wall -ffinite-math-only -fno-signaling-nans -pthread -march=native -O3 -fomit-frame-pointer -DNDEBUG -fpic -Winline -I../include -I../include/astrometry -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DAN_GIT_REVISION='"0.76-11-g8a0dee93"' -DAN_GIT_DATE='"Sat_Dec_22_10:26:36_2018_-0500"' -DAN_GIT_URL='"https://github.com/dstndstn/astrometry.net"' -I../catalogs         -I../include -I../include/astrometry -I../gsl-an     -I../include -I../include/astrometry -I../gsl-an  -I../util -I. -I/home/carolyne/anaconda2/envs/iraf27/include " \
python setup.py build_ext -v --inplace --build-temp .
('link:', ['-g', '-Wall', '-ffinite-math-only', '-fno-signaling-nans', '-pthread', '-march=native', '-O3', '-fomit-frame-pointer', '-DNDEBUG', '-fpic', '-Winline', '-lm', '-lm', '-lm', '-lm', '-L/home/carolyne/anaconda2/envs/iraf27/lib', '-lpng16', '-lz', '-L.', '-lnetpbm', '-ljpeg'])
('objs:', ['../util/cairoutils.o', 'libastrometry.a', '../catalogs/libcatalogs.a', '../util/libanfiles.a', '../libkd/libkd.a', '../util/libanutils.a', '../qfits-an/libqfits.a', '../util/libanbase.a', '../gsl-an/libgsl-an.a', '../util/libanutils.a', '../qfits-an/libqfits.a', '../util/libanbase.a', '../gsl-an/libgsl-an.a'])
('inc:', ['../include', '../include/astrometry', '../gsl-an', '../include', '../include/astrometry', '../gsl-an', '../util'])
('cflags:', ['-g', '-Wall', '-ffinite-math-only', '-fno-signaling-nans', '-pthread', '-march=native', '-O3', '-fomit-frame-pointer', '-DNDEBUG', '-fpic', '-Winline', '-I../include', '-I../include/astrometry', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_GNU_SOURCE', "-DAN_GIT_REVISION='0.76-11-g8a0dee93'", "-DAN_GIT_DATE='Sat_Dec_22_10:26:36_2018_-0500'", "-DAN_GIT_URL='https://github.com/dstndstn/astrometry.net'", '-I../catalogs', '-I../include', '-I../include/astrometry', '-I../gsl-an', '-I../include', '-I../include/astrometry', '-I../gsl-an', '-I../util', '-I.', '-I/home/carolyne/anaconda2/envs/iraf27/include'])
running build_ext
building '_plotstuff_c' extension
swigging plotstuff.i to plotstuff_wrap.c
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -Wall -ffinite-math-only -fno-signaling-nans -pthread -march=native -O3 -fomit-frame-pointer -DNDEBUG -fpic -Winline -I../include -I../include/astrometry -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DAN_GIT_REVISION=0.76-11-g8a0dee93 -DAN_GIT_DATE=Sat_Dec_22_10:26:36_2018_-0500 -DAN_GIT_URL=https://github.com/dstndstn/astrometry.net -I../catalogs -I../include -I../include/astrometry -I../gsl-an -I../include -I../include/astrometry -I../gsl-an -I../util -I. -I/home/carolyne/anaconda2/envs/iraf27/include -fPIC -I/home/carolyne/anaconda2/envs/iraf27/lib/python2.7/site-packages/numpy/core/include -I../include -I../include/astrometry -I../gsl-an -I../include -I../include/astrometry -I../gsl-an -I../util -I/home/carolyne/anaconda2/envs/iraf27/include/python2.7 -c plotstuff_wrap.c -o ./plotstuff_wrap.o
In file included from plotstuff_wrap.c:3065:0:
../include/astrometry/plotstuff.h:10:10: fatal error: cairo.h: No such file or directory
 #include <cairo.h>
          ^~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
Makefile:416: recipe for target '_plotstuff_c.so' failed
make[1]: *** [_plotstuff_c.so] Error 1
make[1]: Leaving directory '/home/carolyne/Programas/astrometry.net-0.76/blind'
Makefile:115: recipe for target 'pyplotstuff' failed
make: *** [pyplotstuff] Error 2

pkg-config --modversion cairo

Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found


pkg-config --cflags cairo

Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found

sudo apt-get install libcairo2-dev


Reading package lists... Done
Building dependency tree       
Reading state information... Done
libcairo2-dev is already the newest version (1.15.10-2ubuntu0.1).
The following packages were automatically installed and are no longer required:
  linux-headers-4.15.0-42 linux-headers-4.15.0-42-generic
  linux-image-4.15.0-42-generic linux-modules-4.15.0-42-generic
  linux-modules-extra-4.15.0-42-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 79 not upgraded.

Dustin Lang

unread,
Feb 4, 2019, 3:52:51 PM2/4/19
to astrometry
Hi,

The Astrometry.net Makefile uses pkg-config to figure out how to find cairo, so you definitely need pkg-config to work...

On my Ubuntu 16.04.5 machine, I get:

$ pkg-config --cflags cairo
-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12

$ pkg-config --modversion cairo
1.14.6

And the ".pc" file is:

$ dpkg -L libcairo2-dev | grep cairo.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/cairo.pc


Have you set your PKG_CONFIG_PATH to something strange?  (I see you are using IRAF --- any chance it has messed with your environment?)

cheers,
--dustin


Reply all
Reply to author
Forward
0 new messages