Skip to content

Commit

Permalink
Guard against setting HOMEBREW variables in conda builds
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed Sep 15, 2024
1 parent ef5a7a4 commit 95648d7
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def build_extensions(self):
sys.platform == "darwin"
and platform.processor() == "arm"
and "HOMEBREW_PREFIX" in os.environ
and "CONDA_PREFIX" not in os.environ
):
os.environ["CXXFLAGS"] = (
f"-I{os.environ['HOMEBREW_PREFIX']}/include "
Expand All @@ -78,10 +79,6 @@ def build_extensions(self):
f"-L{os.environ['HOMEBREW_PREFIX']}/lib "
+ os.environ.get("LDFLAGS", "")
)
# For reasons that are unclear, the LDFLAGS need to be fully
# overridden. It is insufficient to just prepend the Homebrew
# library path to the existing LDFLAGS.
# os.environ["LDFLAGS"] = f"-L{os.environ['HOMEBREW_PREFIX']}/lib"

# RPATH is set for shared libraries in the following locations:
# * fastjet/
Expand Down Expand Up @@ -129,26 +126,6 @@ def build_extensions(self):
env["CXX"] = env.get("CXX", "g++")
env["LDFLAGS"] = env.get("LDFLAGS", "")

# Hack to inject the required CXXFLAGS and LDFLAGS for building
# on macOS aarch64 and with Conda.
# For reasons that are unclear, the LDFLAGS need to be fully
# overridden. It is insufficient to just prepend the Homebrew
# library path to the existing LDFLAGS.
# Things will _build_ without this, but then at runtime there
# will be 'symbol not found in flat namespace' errors.
# This is a bad hack, and will be alleviated if CMake can be used
# by FastJet and FastJet-contrib.
# c.f. https://github.com/scikit-hep/fastjet/issues/310
#
# Hm.....this WASN'T NEEDED IN CI!?!?! Only on local build with conda?
#
if (
sys.platform == "darwin"
and platform.processor() == "arm"
and "HOMEBREW_PREFIX" in os.environ
):
env["LDFLAGS"] = f"-L{env['HOMEBREW_PREFIX']}/lib"

# For aarch64 macOS need to set the LDFLAGS for Homebrew installed
# dependencies to be found. However, fastjet-contrib's configure
# script does not use/accept LDFLAGS as an argument, and so to get
Expand Down

0 comments on commit 95648d7

Please sign in to comment.