Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

added back support for CFITSIO_EXT_LIB and CFITSIO_EXT_INC #65

Merged
merged 2 commits into from

1 participant

Andrea Zonca
Andrea Zonca
Owner

I noticed Ubuntu by default ships libcfitsio on 64 bit in /usr/include/fitsio.h and /usr/lib/x86_64-linux-gnu/libcfitsio.[a, so]. Therefore I think it is necessary to add back the support for CFITSIO_EXT_LIB and CFITSIO_EXT_INC.
But now the definition is the same as the one of HEALPIX, this is necessary because the same environment variable is used by the HEALPIX C++ Makefile.

Andrea Zonca zonca merged commit ddcc39d into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 56 additions and 51 deletions.
  1. +34 −28 INSTALL → INSTALL.rst
  2. +1 −1  doc/install.rst
  3. +21 −22 setup.py
62 INSTALL → INSTALL.rst
View
@@ -6,49 +6,55 @@ Installation procedure for Healpy
Requirements
------------
-* Healpy needs HEALPix. You can either:
- - let Healpy build its own HEALPix library from the source code included in
- this package (the default behavior) or
- - use an existing installation :
- Either define the environment variable HEALPIX_EXT_PREFIX where to find the
- healpix libraries and include files (eg /usr/local, so that
- /usr/local/include/healpix_base.h and /usr/local/lib/libhealpix_cxx.a
- exist)
-
-* Healpix needs cfitsio. You can either:
- - use an existing installation :
- Either define the environment variable CFITSIO_EXT_PREFIX where to find the
- cfitsio library and include file (eg /usr/local, so that
- /usr/local/include/fitsio.h and /usr/local/lib/libcfitsio.a exists),
- CFITSIO_EXT_INC and CFITSIO_EXT_LIB are not supported since healpy 1.4.1
- - compile a specific cfitsio lib:
- Define EXTERNAL_CFITSIO=no, place the cfitsioXXXX.tar.gz in
- hpbeta/libcfitsio before installing. The cfitsio version XXXX must
- match the version in hpbeta/planck.make (or you need to modify it there).
-
-* the psht spherical transform library is integrated into healpy with the
+Healpy needs HEALPix. You can either:
+* let Healpy build its own HEALPix library from the source code included in
+this package (the default behavior)
+* use an existing installation :
+Define the environment variable HEALPIX_EXT_PREFIX where to find the
+healpix libraries and include files (eg /usr/local, so that
+/usr/local/include/healpix_base.h and /usr/local/lib/libhealpix_cxx.a
+exist)
+
+Healpix needs cfitsio. You can either:
+* use an existing installation :
+Either define the environment variable CFITSIO_EXT_PREFIX where to find the
+cfitsio library and include file (eg /usr/local, so that
+/usr/local/include/fitsio.h and /usr/local/lib/libcfitsio.a exists),
+or CFITSIO_EXT_INC with the include folder, e.g. /usr/local/include and
+CFITSIO_EXT_LIB with full path to the libcfitsio.* library with full filename
+e.g. /usr/local/lib/libcfitsio.a or .so
+* compile a specific cfitsio lib:
+Define EXTERNAL_CFITSIO=no, place the cfitsioXXXX.tar.gz in
+hpbeta/libcfitsio before installing. The cfitsio version XXXX must
+match the version in hpbeta/planck.make (or you need to modify it there).
+
+the psht spherical transform library is integrated into healpy with the
pshyt cython wrapper. a pregenerated c code is included in the repository, but
if you have cython installed it will be run in the build phase.
Installation
------------
-$ cd healpy
-$ python setup.py build
+ cd healpy
+ python setup.py build
OR, if you do not want OpenMP support (sometimes, it causes SegFault)
-$ python setup.py build --without-openmp
+ python setup.py build --without-openmp
+
(alternatively, you can define the environment variable HEALPY_WITHOUT_OPENMP)
If you do not want the "-march=native" flag (if your g++ is too old)
-$ python setup.py build --without-native
+ python setup.py build --without-native
+
(alternatively, you can define the environment variable HEALPY_WITHOUT_NATIVE)
If everything goes fine, you can give a test:
-$ cd build/lib*
-$ ipython -pylab
+
+ cd build/lib*
+ ipython -pylab
+
>>> import healpy as H
>>> H.mollview(arange(12))
>>> pylab.show()
@@ -73,7 +79,7 @@ Suggested compilation on OSX Lion is installing pyfits, cython and cfitsio using
Known issues
------------
- * Incompatibility with cfitisio from HEASOFT: due to a conflict of header file names it is currently not possible to use the cfitsio library provided with the HEASOFT package for compilation of Healpix C++. HEASOFT's include directory contains a file called "rotmatrix.h" which clashes with Healpix's own rotmatrix.h.
+* Incompatibility with cfitisio from HEASOFT: due to a conflict of header file names it is currently not possible to use the cfitsio library provided with the HEASOFT package for compilation of Healpix C++. HEASOFT's include directory contains a file called "rotmatrix.h" which clashes with Healpix's own rotmatrix.h.
Development install
-------------------
2  doc/install.rst
View
@@ -1 +1 @@
-.. include:: ../INSTALL
+.. include:: ../INSTALL.rst
43 setup.py
View
@@ -167,33 +167,39 @@ def get_version():
'healpy/version.py')
return __version__
-
healpy_pixel_lib_src = '_healpy_pixel_lib.cc'
healpy_spht_src = '_healpy_sph_transform_lib.cc'
healpy_fitsio_src = '_healpy_fitsio_lib.cc'
library_dirs = []
include_dirs = [numpy_inc]
-# cfitsio needs to be last in order to correctly link the healpix libraries
-# so needs to go in extra_link instead of libraries
-extra_link = ['-lcfitsio']
-healpix_libs = []
+extra_link = []
+
+if not 'HEALPIX_EXT_PREFIX' in os.environ and not (
+ ('CFITSIO_EXT_PREFIX' in os.environ) or
+ ('CFITSIO_EXT_LIB' in os.environ and 'CFITSIO_EXT_INC' in os.environ)
+ ):
+ print """ERROR: In order to build HEALPIX C++ it is necessary either
+to create the environment variable:
+* CFITSIO_EXT_PREFIX with the path to the location of cfitsio as
+CFITSIO_EXT_PREFIX/include/fitsio.h and CFITSIO_EXT_PREFIX/lib/libcfitsio.*
+or:
+* CFITSIO_EXT_INC with the include folder and CFITSIO_EXT_LIB with full path
+to the libcfitsio.* library with full filename"""
+ sys.exit(1)
if 'CFITSIO_EXT_PREFIX' in os.environ:
cfitsio_inc_dir = os.path.join(os.environ['CFITSIO_EXT_PREFIX'], 'include')
cfitsio_lib_dir = os.path.join(os.environ['CFITSIO_EXT_PREFIX'], 'lib')
include_dirs.append(cfitsio_inc_dir)
library_dirs.append(cfitsio_lib_dir)
-
-# Standard system libraries in /usr are included, as in most linux distribution
-# the cfitsio package installed via package manager is located there;
-# this way install should work often without specifying CFITSIO_EXT_PREFIX
-if not library_dirs:
- print ("""CFITSIO_EXT_PREFIX environment variable not set,
- trying with the default /usr/,
- if healpy fails at runtime, please see INSTALL""")
- include_dirs.append("/usr/include/")
- library_dirs.append("/usr/lib/")
+ # cfitsio needs to be last in order to correctly link the healpix libraries
+ # so needs to go in extra_link instead of libraries
+ extra_link.append('-lcfitsio')
+else:
+ include_dirs.append(os.environ['CFITSIO_EXT_INC'])
+ # works both in the form -Lfolder -lcfitsio and full path to library
+ extra_link.append(os.environ['CFITSIO_EXT_LIB'].strip())
if 'HEALPIX_EXT_PREFIX' in os.environ:
healpix_inc_dir = os.path.join(os.environ['HEALPIX_EXT_PREFIX'], 'include')
@@ -213,7 +219,6 @@ def get_version():
sources=[join('healpy','src', healpy_pixel_lib_src)],
include_dirs=include_dirs,
library_dirs=library_dirs,
- libraries=healpix_libs,
extra_compile_args = healpix_args,
extra_link_args = extra_link
)
@@ -222,7 +227,6 @@ def get_version():
sources=[join('healpy','src', healpy_spht_src)],
include_dirs=include_dirs,
library_dirs=library_dirs,
- libraries=healpix_libs,
extra_compile_args=healpix_args,
extra_link_args = extra_link
)
@@ -231,13 +235,10 @@ def get_version():
sources=[join('healpy','src', healpy_fitsio_src)],
include_dirs=include_dirs,
library_dirs=library_dirs,
- libraries=healpix_libs,
extra_compile_args=healpix_args,
extra_link_args = extra_link
)
-#
-
if on_rtd:
libraries = []
cmdclass = {}
@@ -257,14 +258,12 @@ def get_version():
Extension("healpy._query_disc",
['healpy/src/_query_disc.'+extcpp],
include_dirs = [numpy_inc] + include_dirs,
- libraries = healpix_libs,
library_dirs = library_dirs,
extra_link_args = extra_link,
language='c++'),
Extension("healpy._sphtools",
['healpy/src/_sphtools.'+extcpp],
include_dirs = [numpy_inc] + include_dirs,
- libraries = healpix_libs,
library_dirs = library_dirs,
extra_compile_args = healpix_args,
extra_link_args = extra_link,
Something went wrong with that request. Please try again.