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
[WIP] Fix linker error when using haskell_module with TH and local library #1802
base: master
Are you sure you want to change the base?
Conversation
@@ -103,6 +103,27 @@ stack_snapshot( | |||
}, | |||
) | |||
|
|||
new_local_repository( | |||
name = "system-libs", | |||
# pkg-config --variable=libdir x11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a leftover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I am sorry, don't think this is ready for review yet. It fixes the problem, but the test case requires a local library which isn't portable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I converted the PR into a draft, feel free to undo that once it's ready :)
@@ -338,6 +350,7 @@ def _build_haskell_module( | |||
narrowed_deps_info.deps_hs_libraries, | |||
narrowed_deps_info.empty_hs_libraries, | |||
object_inputs, | |||
depset(static_libs + dynamic_libs), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've added this because of the error in PR description. However this problems doesn't happen for zlib
so we are not sure if we are correctly including the libphonenumber
library. Does adding dependencies to run_ghc
here make sense from you perspective @googleson78 ?
@@ -103,6 +103,27 @@ stack_snapshot( | |||
}, | |||
) | |||
|
|||
new_local_repository( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@googleson78 do you have any idea of a better / more portable way to provide the library to the test? Unfortunately it has a bunch of dependencies https://github.com/google/libphonenumber/tree/master/cpp. I don't know much about nix, but maybe there is a nix package for it? (https://github.com/google/libphonenumber/tree/master/cpp)
I rebased your branch in master and modified your test to be fetching the dependency from nix in https://github.com/tweag/rules_haskell/tree/fix-haskell-module-th-linking. In particular, 1340c40 is the commit which makes the dependency change (and the only new commit there). Feel free to cherry-pick that or reset your branch to that one (I had to rebase because tests fail on NixOS from where you branched). Note however that there is still some work to be done regarding the test, as it must be disabled(?) when not running |
Getting this to work with the bindist route will require some effort, while disabling the test for bindists feels unsatisfying as well. Can you specifically on reproduce the issue with |
Thanks for your help! |
WIP: not ready for review yet.
The problem:
It seems to fix the problem, but the test case requires a local library which isn't portable.
Co-authored: @zyla