Skip to content

Commit d67085d

Browse files
committed
Fix using the single threaded RTS
Since GHC 9.4.1, the rts library has `hs-libraries: HSrts-1.0.2 Cffi` in the package config. We have special handling for HSrts (and Cffi) but that fails due to the name change.
1 parent 759e4f5 commit d67085d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

haskell/private/pkgdb_to_bzl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def hs_library_pattern(name, mode = "static", profiling = False):
100100
# See https://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/config#rts-configurations
101101
configs = ["_p"] if profiling else [""]
102102
# Special case HSrts or Cffi - include both libXYZ and libXYZ_thr.
103-
if name == "HSrts" or name == "Cffi":
103+
if name == "HSrts" or name.startswith("HSrts-") or name == "Cffi":
104104
configs = [
105105
prefix + config
106106
for config in configs

haskell/toolchain.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ def _haskell_toolchain_libraries(ctx, libraries):
250250
if len(ext_components) == 2 and ext_components[0] == "so":
251251
libs[libname]["dynamic"] = lib
252252
else:
253+
# with GHC >= 9.4.1 the rts library has a version number
254+
# included in the name.
255+
# for handling single-threaded and threading variants below,
256+
# we normalize the name and strip the version number
257+
if libname.startswith("HSrts-"):
258+
idx = libname.find("_")
259+
suffix = libname[idx:] if idx > 0 else ""
260+
libname = "HSrts" + suffix
261+
253262
libs[libname] = {"dynamic": lib}
254263
for lib in target[HaskellImportHack].static_libraries.to_list():
255264
name = get_static_hs_lib_name(with_profiling, lib)

0 commit comments

Comments
 (0)