-
Notifications
You must be signed in to change notification settings - Fork 81
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
Make ‘cc_haskell_import’ work with ‘haskell_binary’ targets #191
Conversation
c5ef9c8
to
905f30a
Compare
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.
As to whether we should create an extra output always or have a flag for that - let's do the former, not the latter.
Bazel only generates the outputs that are needed by dependencies. Listing the output in DefaultInfo
only makes it a default output. So if the output is never requested downstream then we'll never do the work to create it, provided the rule actions are structured correctly (independent actions for independent outputs).
But I don't understand what this PR is doing. A Haskell binary is a binary, not a library. #179 did not call for sometimes making a Haskell binary a library, whether through an explicit flag or as an extra (non-default) output. Even when a binary is compiled with -pie
, it's still a bona fide executable, named exactly as the user specified.
All I was expecting from this PR was that a provider be returned by haskell_binary
, and that this provider be common to haskell_library
as well (probably by decomposing the monolithic HaskellPackageInfo
into smaller pieces as mentioned in the ticket), so that cc_haskell_import
can uniformly deal with either, provided the binary was compiled as PIE (which incidentally, should probably be the default, or perhaps even always the case, given the security benefits).
I tried what you describe (only generate binary) but I could not make C program link against such a binary exposed via
The main issue is not this, but that label of executable target no longer designates single file, but several and so it cannot be used in I also have the impression that only outputs listed in |
Yes. You mentioned in the PR description that an alternative would be to fix |
I don't think this is going to work because while I was experimenting with this, I tried generating an executable and naming it with |
Can try once again tomorrow if you like. |
1b2e0d8
to
1f1ba7f
Compare
Amended the PR.
So far I can't build |
1f1ba7f
to
9ece46c
Compare
Close #179.
This PR allows to generate
.so
files from object files of executables, not just executables themselves. This way it's possible to use them withcc_haskell_import
. Generation of.so
version in conditional though, and disabled by default. The reasons:Some existing
sh_test
s run outputs of targets, and so if executable target produces more than one file they get confused. This could be avoided, if they just usedexecutable
fromDefaultInfo
, which always be a single file, but somehow this is not whatsh_test
does. We use our own copy of it, so we could patch it and submit the changes upstream.Usually such
.so
versions of binaries are not needed, so why do extra work.The both reasons are not very strong IMO, so I'm open to alternative decisions.