git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #45987 from danieldk/fix-vowpalwabbit

vowpalwabbit: fix build against boost-python.

commitd22e22e2dd83510ca11ab6966cacd2ee929a2d73 authorxeji <36407913+xeji@users.noreply.github.com> dateTue 4 Sep 2018, 08:54 (8 years ago) parent8e9c7e869d418a
2 files changed+50−3
pkgs/development/python-modules/vowpalwabbit/default.nix+16−3 pkgs/development/python-modules/vowpalwabbit/vowpal-wabbit-find-boost.diff+34
pkgs/development/python-modules/vowpalwabbit/default.nix+16−3
@@ -1,5 +1,5 @@
1−{ lib, buildPythonPackage, fetchPypi, python, boost, zlib, clang, ncurses
2−, pytest, docutils, pygments, numpy, scipy, scikitlearn }:
1+{ stdenv, lib, buildPythonPackage, fetchPypi, python, boost, zlib, clang
2+, ncurses, pytest, docutils, pygments, numpy, scipy, scikitlearn }:
33
44buildPythonPackage rec {
55 pname = "vowpalwabbit";
@@ -9,15 +9,27 @@ buildPythonPackage rec {
99 inherit pname version;
1010 sha256 = "0b517371fc64f1c728a0af42a31fa93def27306e9b4d25d6e5fd01bcff1b7304";
1111 };
12+
13+ # Should be fixed in next Python release after 8.5.0:
14+ # https://github.com/JohnLangford/vowpal_wabbit/pull/1533
15+ patches = [
16+ ./vowpal-wabbit-find-boost.diff
17+ ];
18+
1219 # vw tries to write some explicit things to home
1320 # python installed: The directory '/homeless-shelter/.cache/pip/http'
1421 preInstall = ''
1522 export HOME=$PWD
1623 '';
1724
18− buildInputs = [ boost.dev zlib.dev clang ncurses pytest docutils pygments ];
25+ buildInputs = [ python.pkgs.boost zlib.dev clang ncurses pytest docutils pygments ];
1926 propagatedBuildInputs = [ numpy scipy scikitlearn ];
2027
28+ # Python ctypes.find_library uses DYLD_LIBRARY_PATH.
29+ preConfigure = lib.optionalString stdenv.isDarwin ''
30+ export DYLD_LIBRARY_PATH="${python.pkgs.boost}/lib"
31+ '';
32+
2133 checkPhase = ''
2234 # check-manifest requires a git clone, not a tarball
2335 # check-manifest --ignore "Makefile,PACKAGE.rst,*.cc,tox.ini,tests*,examples*,src*"
@@ -28,6 +40,7 @@ buildPythonPackage rec {
2840 description = "Vowpal Wabbit is a fast machine learning library for online learning, and this is the python wrapper for the project.";
2941 homepage = https://github.com/JohnLangford/vowpal_wabbit;
3042 license = licenses.bsd3;
43+ broken = stdenv.isAarch64;
3144 maintainers = with maintainers; [ teh ];
3245 };
3346}
pkgs/development/python-modules/vowpalwabbit/vowpal-wabbit-find-boost.diffnew file+34
@@ -0,0 +1,34 @@
1+--- vowpalwabbit-8.5.0.orig/setup.py 2018-09-03 20:32:39.000000000 +0200
2++++ vowpalwabbit-8.5.0/setup.py 2018-09-03 20:34:09.000000000 +0200
3+@@ -23,18 +23,11 @@
4+
5+ def find_boost():
6+ """Find correct boost-python library information """
7+- if system == 'Linux':
8++ if system == 'Linux' or system == 'Darwin':
9+ # use version suffix if present
10+- boost_lib = 'boost_python-py{v[0]}{v[1]}'.format(v=sys.version_info)
11+- if sys.version_info.major == 3:
12+- for candidate in ['-py36', '-py35', '-py34', '3']:
13+- boost_lib = 'boost_python{}'.format(candidate)
14+- if find_library(boost_lib):
15+- exit
16++ boost_lib = 'boost_python{v[0]}{v[1]}'.format(v=sys.version_info)
17+ if not find_library(boost_lib):
18+ boost_lib = "boost_python"
19+- elif system == 'Darwin':
20+- boost_lib = 'boost_python-mt' if sys.version_info[0] == 2 else 'boost_python3-mt'
21+ elif system == 'Cygwin':
22+ boost_lib = 'boost_python-mt' if sys.version_info[0] == 2 else 'boost_python3-mt'
23+ else:
24+--- vowpalwabbit-8.5.0.orig/src/Makefile 2018-09-03 20:32:40.000000000 +0200
25++++ vowpalwabbit-8.5.0/src/Makefile 2018-09-03 21:42:30.000000000 +0200
26+@@ -37,7 +37,7 @@
27+ NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
28+ endif
29+ ifeq ($(UNAME), Darwin)
30+- LIBS = -lboost_program_options-mt -lboost_serialization-mt -l pthread -l z
31++ LIBS = -lboost_program_options -lboost_serialization -l pthread -l z
32+ # On Macs, the location isn't always clear
33+ # brew uses /usr/local
34+ # but /opt/local seems to be preferred by some users