Skip to content

Commit

Permalink
Merge pull request #401 from Dekken/pip_segfault
Browse files Browse the repository at this point in the history
call import_array statically for linux/mac
  • Loading branch information
PhilipDeegan authored Oct 31, 2019
2 parents 6ba33d3 + 5c3745e commit 5b088ea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
10 changes: 10 additions & 0 deletions lib/swig/tick/array/array_module.i
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@
#include <system_error>
#include "numpy/arrayobject.h"
#include "numpy/npy_math.h"

#ifndef _WIN32
int tick_import_numpy(){
return _import_array();
}
static const int tick_numpy_import = tick_import_numpy();
#endif

#include "tick/base/debug.h"
#include "tick/array/carray_python.h"
#include "tick/array/vector_operations.h"


%}


Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,11 @@ def add_dir_name(dir_name, filenames):
lib = os.path.join(build_dir, mod.build, "_"+mod.extension_name)
lib += os.path.splitext(sysconfig.get_config_var("EXT_SUFFIX"))[0]
libraries.append(lib)
# names (i.e. not lib<name>.so) we specify the full library path
elif platform.system() == 'Linux':
lib_dir = os.path.abspath(os.path.join(build_dir, mod.build))
extra_link_args.append("-L"+lib_dir)
extra_link_args.append("-Wl,-rpath,"+lib_dir)
extra_link_args.append("-l:"+mod.lib_filename)
else:
extra_link_args.append(os.path.abspath(
os.path.join(build_dir, mod.build, mod.lib_filename)))
Expand Down
6 changes: 3 additions & 3 deletions tools/docker/build_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

set -e -x

python_versions=(cp36-cp36m)
python_versions=(cp36-cp36m cp37-cp37m)

for PYVER in ${python_versions[@]}; do
PYBIN=/opt/python/${PYVER}/bin

cd /io

"${PYBIN}/python3" -mpip install -r requirements.txt
"${PYBIN}/python3" -m pip install pip --upgrade
"${PYBIN}/python3" -m pip install -r requirements.txt
"${PYBIN}/python3" setup.py bdist_wheel --dist-dir=/tick/wheelhouse
done

Expand Down

0 comments on commit 5b088ea

Please sign in to comment.