mirror of https://github.com/google/benchmark.git
Change nanobind linkage to response file approach on macOS (#1638)
* Change nanobind linkage to response file approach This change needs https://github.com/bazelbuild/bazel/pull/18952 to be merged first. Fixes macOS linkage of GBM's nanobind bindings on macOS by supplying a linker response file instead of `-undefined dynamic_lookup`. The latter has since been deprecated on macOS. * Fix bazel_skylib checksum, bump skylib version in MODULE.bazel * Bump Bazel to version 6.4.0 for linker response file support
This commit is contained in:
parent
5893034e46
commit
e45585a4b8
|
@ -5,7 +5,7 @@ if ! bazel version; then
|
||||||
fi
|
fi
|
||||||
echo "Installing wget and downloading $arch Bazel binary from GitHub releases."
|
echo "Installing wget and downloading $arch Bazel binary from GitHub releases."
|
||||||
yum install -y wget
|
yum install -y wget
|
||||||
wget "https://github.com/bazelbuild/bazel/releases/download/6.3.0/bazel-6.3.0-linux-$arch" -O /usr/local/bin/bazel
|
wget "https://github.com/bazelbuild/bazel/releases/download/6.4.0/bazel-6.4.0-linux-$arch" -O /usr/local/bin/bazel
|
||||||
chmod +x /usr/local/bin/bazel
|
chmod +x /usr/local/bin/bazel
|
||||||
else
|
else
|
||||||
# bazel is installed for the correct architecture
|
# bazel is installed for the correct architecture
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module(name = "google_benchmark", version="1.8.3")
|
module(name = "google_benchmark", version="1.8.3")
|
||||||
|
|
||||||
bazel_dep(name = "bazel_skylib", version = "1.4.1")
|
bazel_dep(name = "bazel_skylib", version = "1.4.2")
|
||||||
bazel_dep(name = "platforms", version = "0.0.6")
|
bazel_dep(name = "platforms", version = "0.0.6")
|
||||||
bazel_dep(name = "rules_foreign_cc", version = "0.9.0")
|
bazel_dep(name = "rules_foreign_cc", version = "0.9.0")
|
||||||
bazel_dep(name = "rules_cc", version = "0.0.6")
|
bazel_dep(name = "rules_cc", version = "0.0.6")
|
||||||
|
|
|
@ -7,26 +7,27 @@ def benchmark_deps():
|
||||||
if "bazel_skylib" not in native.existing_rules():
|
if "bazel_skylib" not in native.existing_rules():
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "bazel_skylib",
|
name = "bazel_skylib",
|
||||||
sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728",
|
sha256 = "66ffd9315665bfaafc96b52278f57c7e2dd09f5ede279ea6d39b2be471e7e3aa",
|
||||||
urls = [
|
urls = [
|
||||||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
|
||||||
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
|
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.2/bazel-skylib-1.4.2.tar.gz",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
if "rules_foreign_cc" not in native.existing_rules():
|
if "rules_foreign_cc" not in native.existing_rules():
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "rules_foreign_cc",
|
name = "rules_foreign_cc",
|
||||||
sha256 = "bcd0c5f46a49b85b384906daae41d277b3dc0ff27c7c752cc51e43048a58ec83",
|
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
|
||||||
strip_prefix = "rules_foreign_cc-0.7.1",
|
strip_prefix = "rules_foreign_cc-0.9.0",
|
||||||
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.7.1.tar.gz",
|
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.9.0.tar.gz",
|
||||||
)
|
)
|
||||||
|
|
||||||
if "rules_python" not in native.existing_rules():
|
if "rules_python" not in native.existing_rules():
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "rules_python",
|
name = "rules_python",
|
||||||
url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz",
|
sha256 = "0a8003b044294d7840ac7d9d73eef05d6ceb682d7516781a4ec62eeb34702578",
|
||||||
sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
|
url = "https://github.com/bazelbuild/rules_python/releases/download/0.24.0/rules_python-0.24.0.tar.gz",
|
||||||
|
strip_prefix = "rules_python-0.24.0",
|
||||||
)
|
)
|
||||||
|
|
||||||
if "com_google_absl" not in native.existing_rules():
|
if "com_google_absl" not in native.existing_rules():
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "symboltable",
|
||||||
|
srcs = ["cmake/darwin-ld-cpython.sym"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "nanobind",
|
name = "nanobind",
|
||||||
srcs = glob([
|
srcs = glob([
|
||||||
|
@ -12,6 +21,13 @@ cc_library(
|
||||||
"ext/robin_map/include/tsl/*.h",
|
"ext/robin_map/include/tsl/*.h",
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
linkopts = select({
|
||||||
|
"@platforms//os:macos": ["-Wl,@$(location :cmake/darwin-ld-cpython.sym)"],
|
||||||
|
"//conditions:default": [],
|
||||||
|
}),
|
||||||
|
additional_linker_inputs = select({
|
||||||
|
"@platforms//os:macos": [":cmake/darwin-ld-cpython.sym"],
|
||||||
|
"//conditions:default": [],
|
||||||
|
}),
|
||||||
deps = ["@python_headers"],
|
deps = ["@python_headers"],
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
cc_library(
|
cc_library(
|
||||||
name = "python_headers",
|
name = "python_headers",
|
||||||
hdrs = glob(["**/*.h"]),
|
hdrs = glob(["**/*.h"]),
|
||||||
|
|
7
setup.py
7
setup.py
|
@ -53,7 +53,9 @@ class BuildBazelExtension(build_ext.build_ext):
|
||||||
def run(self):
|
def run(self):
|
||||||
for ext in self.extensions:
|
for ext in self.extensions:
|
||||||
self.bazel_build(ext)
|
self.bazel_build(ext)
|
||||||
build_ext.build_ext.run(self)
|
super().run()
|
||||||
|
# explicitly call `bazel shutdown` for graceful exit
|
||||||
|
self.spawn(["bazel", "shutdown"])
|
||||||
|
|
||||||
def bazel_build(self, ext: BazelExtension):
|
def bazel_build(self, ext: BazelExtension):
|
||||||
"""Runs the bazel build to create the package."""
|
"""Runs the bazel build to create the package."""
|
||||||
|
@ -98,9 +100,6 @@ class BuildBazelExtension(build_ext.build_ext):
|
||||||
ext_dest_path = Path(self.get_ext_fullpath(ext.name))
|
ext_dest_path = Path(self.get_ext_fullpath(ext.name))
|
||||||
shutil.copyfile(ext_bazel_bin_path, ext_dest_path)
|
shutil.copyfile(ext_bazel_bin_path, ext_dest_path)
|
||||||
|
|
||||||
# explicitly call `bazel shutdown` for graceful exit
|
|
||||||
self.spawn(["bazel", "shutdown"])
|
|
||||||
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
cmdclass=dict(build_ext=BuildBazelExtension),
|
cmdclass=dict(build_ext=BuildBazelExtension),
|
||||||
|
|
Loading…
Reference in New Issue