Skip to content

Commit

Permalink
Fix NumPy 1 build by using numpy.get_include()
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarrison committed Jul 27, 2024
1 parent c562b9e commit 3a782c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,14 @@ ifeq ($(DO_CHECKS), 1)
# NUMPY is available -> next step should not fail
# That's why we are not checking if the NUMPY_INCL_FLAG is defined.
ifeq ($(NUMPY_CHECKED), 0)
export NUMPY_INCL_FLAG := $(shell $(PYTHON) -c "from __future__ import print_function; import numpy; print('-isystem ' + numpy.__path__[0] + '/_core/include/')")
export NUMPY_INCL_FLAG := $(shell $(PYTHON) -c "from __future__ import print_function; import numpy; print('-isystem ' + numpy.get_include())")
# Take the second word -> the path (the first word is "isystem")
NUMPY_INCL_PATH := $(word 2, ${NUMPY_INCL_FLAG})
# Now check that the 'arrayobject.h' file is present in the
# supposed numpy directory. Otherwise, compilation will fail.
# The absence of the file likely indicates a missing numpy-devel
# package (see issue #134 on github)
NUMPY_NEEDED_HEADER_FILE := ${NUMPY_INCL_PATH}numpy/arrayobject.h
NUMPY_NEEDED_HEADER_FILE := ${NUMPY_INCL_PATH}/numpy/arrayobject.h
ifeq (,$(wildcard ${NUMPY_NEEDED_HEADER_FILE}))
$(error Required $(ccred)numpy headers$(ccreset) are missing...stopping the compilation. You might be able to fix this by installing $(ccblue)numpy-devel$(ccreset))
endif
Expand Down

0 comments on commit 3a782c7

Please sign in to comment.