Skip to content

Commit e14a64f

Browse files
committed
fix: support debian multiarch with local toolchains
1 parent cab415d commit e14a64f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

python/private/get_local_runtime_info.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
# The platform-specific filename suffix for library files.
4646
# Includes the dot, e.g. `.so`
4747
"SHLIB_SUFFIX",
48+
# Debian has a "multiarch" layout that has libs for different archs
49+
# in slightly other locations. The MULTIARCH sysconfig varible tells
50+
# which directory under `LIBDIR` these exist in, if any.
51+
# See https://wiki.debian.org/Python/MultiArch
52+
"MULTIARCH",
4853
]
4954
data.update(zip(config_vars, sysconfig.get_config_vars(*config_vars)))
5055
print(json.dumps(data))

python/private/local_runtime_repo.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def _local_runtime_repo_impl(rctx):
126126
# In some cases, the same value is returned for multiple keys. Not clear why.
127127
shared_lib_names = {v: None for v in shared_lib_names}.keys()
128128
shared_lib_dir = info["LIBDIR"]
129+
multiarch = info["MULTIARCH"]
129130

130131
# The specific files are symlinked instead of the whole directory
131132
# because it can point to a directory that has more than just
@@ -141,6 +142,11 @@ def _local_runtime_repo_impl(rctx):
141142
repo_utils.watch(rctx, origin)
142143
rctx.symlink(origin, "lib/" + name)
143144

145+
origin_multiarch = rctx.path("{}/{}/{}".format(shared_lib_dir, multiarch, name))
146+
if origin_multiarch.exists:
147+
repo_utils.watch(rctx, origin)
148+
rctx.symlink(origin, "lib/{}/{}".format(multiarch, name))
149+
144150
rctx.file("WORKSPACE", "")
145151
rctx.file("MODULE.bazel", "")
146152
rctx.file("REPO.bazel", "")

0 commit comments

Comments
 (0)