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

toConfiguredComponent: unix (Windows) #3978

Closed
alexbiehl opened this issue Oct 13, 2016 · 18 comments
Closed

toConfiguredComponent: unix (Windows) #3978

alexbiehl opened this issue Oct 13, 2016 · 18 comments

Comments

@alexbiehl
Copy link
Member

alexbiehl commented Oct 13, 2016

Trying new-build with cabal-install from HEAD on a project of mine:

$ cabal new-build hunt-searchengine

Results in:

$ Resolving dependencies...
$ toConfiguredComponent: unix
$ CallStack (from HasCallStack):
$ error, called at .\Distribution\Backpack\ConfiguredComponent.hs:131:20 in
$ Cabal-1.25.0.0-2vbl2DGycuL3ehQ9RJKv1s:Distribution.Backpack.ConfiguredComponent

I would cabal expect to fail on building unix (since I am on Windows) instead of some internal error.

@alexbiehl alexbiehl changed the title toConfiguredComponent: unix toConfiguredComponent: unix (Windows) Oct 13, 2016
@23Skidoo
Copy link
Member

@ezyang, can you please look into this?

@ezyang
Copy link
Contributor

ezyang commented Oct 13, 2016

@alexbiehl Any chance I can get some -v logs? (Or better yet, -v3)

@alexbiehl
Copy link
Member Author

Yes of course, I will hand them in tomorrow.

Edward Z. Yang [email protected] schrieb am Do., 13. Okt. 2016,
19:50:

@alexbiehl https://github.com/alexbiehl Any chance I can get some -v
logs?


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#3978 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AByiiUDLDsxXIahKCQG7LM9fy5-3Phfjks5qzm9mgaJpZM4KVnNl
.

@alexbiehl
Copy link
Member Author

cabal new-build hunt-searchengine -v3 with dist-newstyle deleted first:
https://gist.github.com/alexbiehl/b303b584dcf636b54d2b84392088c20d

And here the same command as a subsequent run (with a dist-newstyle present). Not sure if needed though.
https://gist.github.com/alexbiehl/47c2b561de69cf4b0085eb55cbfdc4ba

I have one question to add:

Somewhere in the logs it says targets: html-hunter, hunt-client, hunt-crawler, hunt-searchengine, hunt-server, hunt-server-cli. But I only requested to build hunt-searchengine which does not depend on any of the other targets. Is this something weird or is it just listing all available targets?

@ezyang
Copy link
Contributor

ezyang commented Oct 14, 2016

new-build will solve for ALL local packages in your project, so that when you decide to build some of the other ones, it doesn't have to resolve.

@ezyang
Copy link
Contributor

ezyang commented Oct 14, 2016

If you can, apply this patch and then give me the non-verbose log?

diff --git a/Cabal/Distribution/Backpack/ConfiguredComponent.hs b/Cabal/Distribution/Backpack/ConfiguredComponent.hs
index 184b8bb..86cb899 100644
--- a/Cabal/Distribution/Backpack/ConfiguredComponent.hs
+++ b/Cabal/Distribution/Backpack/ConfiguredComponent.hs
@@ -128,7 +128,8 @@ toConfiguredComponent pkg_descr this_cid
     bi = componentBuildInfo component
     find_it :: PackageName -> VersionRange -> (ComponentId, PackageId)
     find_it name reqVer =
-        fromMaybe (error ("toConfiguredComponent: " ++ display name)) $
+        fromMaybe (error ("toConfiguredComponent: " ++ display (packageName pkg_descr) ++
+                            " " ++ display name)) $
             lookup_name lib_map <|>
             lookup_name external_lib_map
       where

@alexbiehl
Copy link
Member Author

$ cabal new-build hunt-searchengine
Resolving dependencies...
toConfiguredComponent: hxt-cache unix
CallStack (from HasCallStack):
error, called at .\Distribution\Backpack\ConfiguredComponent.hs:131:20 in
Cabal-1.25.0.0-2vbl2DGycuL3ehQ9RJKv1s:Distribution.Backpack.ConfiguredComponent

@ezyang
Copy link
Contributor

ezyang commented Oct 14, 2016

So, I guess this is not a direct dependency of hunt-searchengine, but one of the other packages that are local?

@alexbiehl
Copy link
Member Author

Yes, right. hxt-cache is the offender here.

@ezyang
Copy link
Contributor

ezyang commented Oct 14, 2016

I guess I have some guesses how I might reproduce this locally. I guess this is not urgent, since you can just remove the unbuildable packages from your project?

@alexbiehl
Copy link
Member Author

No not urgent. I already filled a pull-request for hxt-cache and use a modifed copy.

@ezyang
Copy link
Contributor

ezyang commented Oct 16, 2016

OK, the bug seems to be somehow related to buildable. Min repro:

name: p
version: 0.1
build-type: Simple
cabal-version: >= 1.25

library
    buildable: False

Stick this in a package with a building package (say q), and then run cabal new-build q.

@ezyang
Copy link
Contributor

ezyang commented Oct 16, 2016

OK, so here's the problem: when the library of a pckage is marked as non-buildable, new-build does NOT eagerly fail. In 1.24, the error would only happen if you tried to build it, or anything that depended on it:

cabal: Unknown build target 'lib:p'.
There is no library component 'p' or component 'lib'.

or

cabal: No executables, libraries, tests, or benchmarks found. Nothing to do.

I suppose that's reasonable behavior; it lets you build some part of your project even when other parts are non-buildable.

But when I refactored this code for Backpack, I assumed that I would only ever get plans with packages that depended upon buildable things. Thus the assert failure! The library doesn't exist and never was configured.

I guess one way we could fix this is to have the solver reject a package if the library is marked as non-buildable (as opposed to executables/tests/etc. May god have mercy on your soul if you have a non-buildable library with a buildable executable.) But maybe this is not so good for you because it means that you can't develop a project if any of the local deps transitively depends on a non-buildable thing. But maybe you didn't care so much about this case?

By the way, unix also has build-depends: buildable < 0, so you might wonder why the solver didn't fail? Well, that's because when buildable: False we ignore the build-depends. This is desirable for executables but not for libraries.

ezyang added a commit to ezyang/cabal that referenced this issue Oct 17, 2016
Now you get something like this:

    Resolving dependencies...
    cabal: Could not resolve dependencies:
    trying: p-0.1 (user goal)
    unknown package: unbuildable (dependency of p-0.1)
    fail (backjumping, conflict set: p, unbuildable)
    Dependency tree exhaustively searched.

The error message is not the best.

Fixes haskell#3978

Signed-off-by: Edward Z. Yang <[email protected]>
@dcoutts
Copy link
Contributor

dcoutts commented Oct 18, 2016

@ezyang fyi, I've seen the same error toConfiguredComponent: blah, but I don't think it was the same problem as unix here. Can we add any more detail to this internal error so we can get better info if we hit it again in future.

@ezyang
Copy link
Contributor

ezyang commented Oct 21, 2016

@dcoutts Do you have a repro?

ezyang added a commit to ezyang/cabal that referenced this issue Oct 22, 2016
When a library/executable is unbuildable, the solver may still
return a reference to it.  Handle this gracefully in ProjectPlanning
with a nice error message, rather than an assert failure.

Fixes haskell#3978.

Signed-off-by: Edward Z. Yang <[email protected]>
ezyang added a commit to ezyang/cabal that referenced this issue Oct 22, 2016
When a library/executable is unbuildable, the solver may still
return a reference to it.  Handle this gracefully in ProjectPlanning
with a nice error message, rather than an assert failure.

Fixes haskell#3978.

Signed-off-by: Edward Z. Yang <[email protected]>
ezyang added a commit to ezyang/cabal that referenced this issue Oct 22, 2016
When a library/executable is unbuildable, the solver may still
return a reference to it.  Handle this gracefully in ProjectPlanning
with a nice error message, rather than an assert failure.

Fixes haskell#3978.

Signed-off-by: Edward Z. Yang <[email protected]>
ezyang added a commit to ezyang/cabal that referenced this issue Oct 22, 2016
When a library/executable is unbuildable, the solver may still
return a reference to it.  Handle this gracefully in ProjectPlanning
with a nice error message, rather than an assert failure.

Fixes haskell#3978.

Signed-off-by: Edward Z. Yang <[email protected]>
@phadej
Copy link
Collaborator

phadej commented May 11, 2018

I get this error when

% cabal new-build -w ghc-7.8.4 --enable-tests all
Resolving dependencies...
Error:
    Dependency on unbuildable library from http-client
    In the stanza 'library'
    In the package 'http-client-tls-0.3.5.3'

with servant 0c66b9c0559721ea682cd0d1fa35f403ec075cda

@phadej
Copy link
Collaborator

phadej commented May 11, 2018

Now I see the problem: http://hdiff.luite.com/cgit/http-client/diff?id=0.5.12.1&id2=0.5.12

clicksaver

+  -- See build failure at https://travis-ci.org/snoyberg/http-client/jobs/359573631
+  if impl(ghc < 7.10)
+    buildable: False

@grayjay
Copy link
Collaborator

grayjay commented May 15, 2018

I opened an issue for the new type of failure: #5325

phadej pushed a commit to phadej/cabal that referenced this issue May 19, 2018
Now you get something like this:

    Resolving dependencies...
    cabal: Could not resolve dependencies:
    trying: p-0.1 (user goal)
    unknown package: unbuildable (dependency of p-0.1)
    fail (backjumping, conflict set: p, unbuildable)
    Dependency tree exhaustively searched.

The error message is not the best.

Fixes haskell#3978
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment