# HG changeset patch # User Georges Racinet # Date 2019-06-14 10:18:06 # Node ID 8ee0fdf3b08721c84849e55be45422b5900b1da4 # Parent f4a65077e94978da1f60f714af8af0ed679ea83e rust-cpython: fix build for MacOSX MacOSX needs special link flags. Quoting the README of rust-cpython: create a `.cargo/config` with the following content: ``` [target.x86_64-apple-darwin] rustflags = [ "-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup", ] ``` This is tested with Python 2.7 (Anaconda install) and Python 3 (Homebrew install) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1199,6 +1199,9 @@ class RustExtension(Extension): if sys.version_info[0] == 3 and self.py3_features is not None: cargocmd.extend(('--features', self.py3_features, '--no-default-features')) + if sys.platform == 'darwin': + env['RUSTFLAGS'] = ("-C link-arg=-undefined " + "-C link-arg=dynamic_lookup") try: subprocess.check_call(cargocmd, env=env, cwd=self.rustsrcdir) except OSError as exc: