Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of ghc.BUILD to import threaded-rts should be documented #437

Closed
guibou opened this issue Sep 10, 2018 · 2 comments
Closed

Usage of ghc.BUILD to import threaded-rts should be documented #437

guibou opened this issue Sep 10, 2018 · 2 comments
Labels
P3 minor: not priorized type: documentation

Comments

@guibou
Copy link
Contributor

guibou commented Sep 10, 2018

The tutorial only shows how to import ghc from nixpkgs using nixpkgs_package or a custom rule such as:

new_local_repository(
  name = "my_ghc",
  path = "/usr/local", # Change path accordingly.
  build_file_content = """
package(default_visibility = ["//visibility:public"])
filegroup(
    name = "bin",
    srcs = glob(["bin/*"]),
)
"""
)

Unfortunately this is incomplete and does not import the threaded-rts library. PR #436 shows that it is not trivial and introduce the following lines inside a file ghc.BUILD (see https://github.com/tweag/rules_haskell/blob/fcfa800a59b6d2323ce3b47d76e15b68c289356e/haskell/ghc.BUILD):

cc_library(
  name = "threaded-rts",
  srcs = glob(
      ["lib/ghc-*/rts/libHSrts_thr-ghc*." + ext for ext in ["so", "dylib"]]
      # dependency of `libHSrts_thr_ghc*`
      # globbing on the `so` version to stay working when they update
      + ["lib/ghc-*/rts/libffi.so.*"],
  ),
  hdrs = glob(["lib/ghc-*/include/**/*.h"]),
  strip_include_prefix = glob(["lib/ghc-*/include"], exclude_directories=0)[0],
)

Most projects using the threaded-rts needs te copy/paste this boilerplate. This is not documented and error prone. We need to find a way te expose this file and avoid this boilerplate, or document.

@guibou guibou self-assigned this Sep 10, 2018
@mboes mboes added the P3 minor: not priorized label Sep 12, 2018
@lunaris
Copy link
Collaborator

lunaris commented Sep 26, 2018

If I ever pick up #387 again, this might be something we work into that (providing haskell_nixpkgs_toolchain, haskell_local_toolchain etc.) I've currently parked that to work on (read: pester/file bugs) against #442; the two together will I think make rules_haskell something very user friendly (and possibly remove the "need" for Hazel, in most cases)

@guibou guibou removed their assignment Dec 18, 2018
@mboes
Copy link
Member

mboes commented Apr 7, 2019

With the introduction of haskell_register_ghc_bindists() and haskell_register_ghc_nixpkgs(), this is now resolved. Both macros use ghc.BUILD, which in turn exposes the threaded RTS. The user doesn't need to do anything here.

@mboes mboes closed this as completed Apr 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 minor: not priorized type: documentation
Projects
None yet
Development

No branches or pull requests

3 participants