vowpal-wabbit: fix Darwin build.

- Follow the same logic for finding boost-python as for Linux.
- Set DYLD_LIBRARY_PATH so that ctypes find_library can find
  boost-python.
- Do not use '-mt' suffix when linking against boost-serialization
  and boost-program_options on Darwin.
This commit is contained in:
Daniël de Kok 2018-09-03 21:48:13 +02:00
parent 875bb6bcb9
commit fe7e89ba3b
2 changed files with 30 additions and 7 deletions

View file

@ -1,5 +1,5 @@
{ lib, buildPythonPackage, fetchPypi, python, boost, zlib, clang, ncurses
, pytest, docutils, pygments, numpy, scipy, scikitlearn }:
{ stdenv, lib, buildPythonPackage, fetchPypi, python, boost, zlib, clang
, ncurses, pytest, docutils, pygments, numpy, scipy, scikitlearn }:
buildPythonPackage rec {
pname = "vowpalwabbit";
@ -25,6 +25,11 @@ buildPythonPackage rec {
buildInputs = [ python.pkgs.boost zlib.dev clang ncurses pytest docutils pygments ];
propagatedBuildInputs = [ numpy scipy scikitlearn ];
# Python ctypes.find_library uses DYLD_LIBRARY_PATH.
preConfigure = lib.optionalString stdenv.isDarwin ''
export DYLD_LIBRARY_PATH="${python.pkgs.boost}/lib"
'';
checkPhase = ''
# check-manifest requires a git clone, not a tarball
# check-manifest --ignore "Makefile,PACKAGE.rst,*.cc,tox.ini,tests*,examples*,src*"

View file

@ -1,8 +1,11 @@
--- vowpalwabbit-8.5.0.orig/setup.py 2018-09-03 14:27:22.833621339 +0200
+++ vowpalwabbit-8.5.0/setup.py 2018-09-03 14:37:18.076127914 +0200
@@ -25,12 +25,7 @@
--- vowpalwabbit-8.5.0.orig/setup.py 2018-09-03 20:32:39.000000000 +0200
+++ vowpalwabbit-8.5.0/setup.py 2018-09-03 20:34:09.000000000 +0200
@@ -23,18 +23,11 @@
def find_boost():
"""Find correct boost-python library information """
if system == 'Linux':
- if system == 'Linux':
+ if system == 'Linux' or system == 'Darwin':
# use version suffix if present
- boost_lib = 'boost_python-py{v[0]}{v[1]}'.format(v=sys.version_info)
- if sys.version_info.major == 3:
@ -13,4 +16,19 @@
+ boost_lib = 'boost_python{v[0]}{v[1]}'.format(v=sys.version_info)
if not find_library(boost_lib):
boost_lib = "boost_python"
elif system == 'Darwin':
- elif system == 'Darwin':
- boost_lib = 'boost_python-mt' if sys.version_info[0] == 2 else 'boost_python3-mt'
elif system == 'Cygwin':
boost_lib = 'boost_python-mt' if sys.version_info[0] == 2 else 'boost_python3-mt'
else:
--- vowpalwabbit-8.5.0.orig/src/Makefile 2018-09-03 20:32:40.000000000 +0200
+++ vowpalwabbit-8.5.0/src/Makefile 2018-09-03 21:42:30.000000000 +0200
@@ -37,7 +37,7 @@
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
endif
ifeq ($(UNAME), Darwin)
- LIBS = -lboost_program_options-mt -lboost_serialization-mt -l pthread -l z
+ LIBS = -lboost_program_options -lboost_serialization -l pthread -l z
# On Macs, the location isn't always clear
# brew uses /usr/local
# but /opt/local seems to be preferred by some users