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

X is not a toolchain library #1920

Closed
aveltras opened this issue Jul 10, 2023 · 6 comments · Fixed by #1921
Closed

X is not a toolchain library #1920

aveltras opened this issue Jul 10, 2023 · 6 comments · Fixed by #1921
Assignees
Labels
P1 critical: next release type: bug

Comments

@aveltras
Copy link
Contributor

Hi,

I have upgraded a project to use GHC 9.6.2 (from 9.2.5).
I'm using nix to provide haskell dependencies using ghcWithPackages like so:

ghc = final.haskellPackages.ghcWithPackages (p:
  with p; [
     aeson
     aeson-pretty
    ...etc

I have a BUILD file with many targets and I have all the nix provided libraries declared as haskell_toolchain_library:

haskell_toolchain_library(name="aeson")
haskell_toolchain_library(name="aeson-pretty")
haskell_toolchain_library(name="amazonka")
haskell_toolchain_library(name="amazonka-cognito-idp")
haskell_toolchain_library(name="amazonka-core")
haskell_toolchain_library(name="amazonka-dynamodb")
...etc

This used to work previously but now I can't load REPL or build library because of the following error:

ERROR: /home/romain/Code/matryo-product/backend/BUILD.bazel:58:26: in haskell_toolchain_library rule //backend:aeson-pretty:
Traceback (most recent call last):
        File "/home/romain/.cache/bazel/_bazel_romain/7404dc8029ea6151e966016273940d3d/external/rules_haskell/haskell/private/haskell_impl.bzl", line 801, column 13, in haskell_toolchain_library_impl
                fail(
Error in fail:
aeson-pretty is not a toolchain library.
Check that it ships with your version of GHC.
The following toolchain libraries are available:
{}

The library specified in the error (here aeson-pretty) changes with each try so i think it's a more general issue.
The libraries are available with the nix provided GHC according to ghc-pkg list

ghc-pkg list | grep aeson-pretty
    aeson-pretty-0.8.9

I'm using latest commit for rules_haskell and rules_nixpkgs.

Has something changed in the way we should use rules_haskell with Nix recently ?

@avdv
Copy link
Member

avdv commented Jul 13, 2023

Hi aveltras,

thanks for the bug report. I know there have been some changes to GHC 9.6 that might be causing this and we have to adapt rules_haskell for that. I'll have a deeper look later.

@avdv
Copy link
Member

avdv commented Jul 14, 2023

Hi @aveltras ,

I figured out why the pkg db was empty with GHC 9.6.x and I have created a draft PR here: #1921

It would be nice if you could test if this works for you. I want to add a test case for this, but that won't happen until after I am back from vacation.

@aveltras
Copy link
Contributor Author

aveltras commented Aug 8, 2023

Hi @avdv,
I tested using your PR but encountered other issues while trying to build.
Not sure if those were before or after the initial issue since this was related to bazel code that I'm not familiar with.
I won't have the time to pursue updating in the near future but I'll be returning to this eventually.
Maybe #1918 will change something when doing so.

@avdv
Copy link
Member

avdv commented Aug 10, 2023

Thanks for trying, @aveltras.

I'll try to get proper support for GHC 9.4 and 9.6 ready as part of #1878 - currently we don't thoroughly test GHC versions other than 9.2.5. (I could reproduce the issue also with 9.2.8 BTW - e.g. here)

@avdv avdv self-assigned this Oct 19, 2023
@avdv avdv added the P1 critical: next release label Oct 19, 2023
@mergify mergify bot closed this as completed in #1921 Dec 11, 2023
@avdv
Copy link
Member

avdv commented Dec 11, 2023

@aveltras this issue should now be fixed. If you could take a look if it works for you and report back that would be awesome.

@aveltras
Copy link
Contributor Author

@avdv seems to be working, i could enter the repl with the full project now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 critical: next release type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants