Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions spy/build/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -126,9 +127,19 @@ def __init__(self, config: BuildConfig):
self.ldflags += ["-L", f"{gc_prefix}/lib", "-lgc"]
else:
self.ldflags += ["-lgc"]
# On macOS, Homebrew installs bdw-gc outside the default
# compiler search paths
if sys.platform == "darwin" and shutil.which("brew"):
conda_prefix = os.environ.get("CONDA_PREFIX")
if conda_prefix and os.path.exists(
os.path.join(conda_prefix, "include", "gc.h")
):
# bdw-gc installed in a conda environment
self.cflags += ["-I", f"{conda_prefix}/include"]
self.ldflags += ["-L", f"{conda_prefix}/lib"]
# conda-forge libgc has an @rpath install name: without an
# rpath entry the executable won't find it at runtime
self.ldflags += [f"-Wl,-rpath,{conda_prefix}/lib"]
elif sys.platform == "darwin" and shutil.which("brew"):
# On macOS, Homebrew installs bdw-gc outside the default
# compiler search paths
prefix = subprocess.run(
["brew", "--prefix", "bdw-gc"],
capture_output=True,
Expand Down
Loading