Skip to content

Commit

Permalink
Fix using the single threaded RTS
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
avdv committed May 30, 2024
1 parent 759e4f5 commit d67085d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion haskell/private/pkgdb_to_bzl.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def hs_library_pattern(name, mode = "static", profiling = False):
# See https://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/config#rts-configurations
configs = ["_p"] if profiling else [""]
# Special case HSrts or Cffi - include both libXYZ and libXYZ_thr.
if name == "HSrts" or name == "Cffi":
if name == "HSrts" or name.startswith("HSrts-") or name == "Cffi":
configs = [
prefix + config
for config in configs
Expand Down
9 changes: 9 additions & 0 deletions haskell/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ def _haskell_toolchain_libraries(ctx, libraries):
if len(ext_components) == 2 and ext_components[0] == "so":
libs[libname]["dynamic"] = lib
else:
# with GHC >= 9.4.1 the rts library has a version number
# included in the name.
# for handling single-threaded and threading variants below,
# we normalize the name and strip the version number
if libname.startswith("HSrts-"):
idx = libname.find("_")
suffix = libname[idx:] if idx > 0 else ""
libname = "HSrts" + suffix

libs[libname] = {"dynamic": lib}
for lib in target[HaskellImportHack].static_libraries.to_list():
name = get_static_hs_lib_name(with_profiling, lib)
Expand Down

0 comments on commit d67085d

Please sign in to comment.