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

New-style build fails during "sdist" #81

Closed
peti opened this issue May 24, 2017 · 10 comments
Closed

New-style build fails during "sdist" #81

peti opened this issue May 24, 2017 · 10 comments

Comments

@peti
Copy link
Contributor

peti commented May 24, 2017

I have a strange build failure at https://travis-ci.org/peti/hsyslog/jobs/234171806:

$ cabal sdist
ghc: can't find a package database at /home/travis/build/peti/hsyslog/dist-newstyle/packagedb/ghc-8.0.2

That .travis.yml file was generated with the current version (3e1b384) of make_travis_yml_2.hs and that error makes no sense to me. When I run cabal dist locally, it works just fine. Any idea what I could do to fix this issue?

@phadej
Copy link
Collaborator

phadej commented May 24, 2017

@peti you should remove .ghc.environment.* file (e.g .in rm -rf dist line). I run into this today as well.

Could you submit a PR?

@peti
Copy link
Contributor Author

peti commented May 24, 2017

Thank you for the suggestion! The changed removed the error. Unfortunately, now a new error just popped up (https://travis-ci.org/peti/hsyslog/jobs/235778854) which I believe to be unrelated to the travis-ci build instructions, though.

@phadej
Copy link
Collaborator

phadej commented May 24, 2017

@peti, are you sure you use: https://github.com/phadej/cabal-doctest/blob/master/example/Setup.hs like Setup.hs, we tweaked it recently to workaround sdist issues.

@peti
Copy link
Contributor Author

peti commented May 25, 2017

Man, this has been a long journey. :-/ Now the tests succeed with GHC 8.x, but none of the other compilers can build the project, apparently because the latest cabal-install does not provide a copy of the latest Cabal? The error during sdist looks a bit strange: https://travis-ci.org/peti/hsyslog/jobs/235822039.

@phadej
Copy link
Collaborator

phadej commented May 25, 2017

@peti you don't need to put cabal-version: >= 1.24, the cabal-version: >= 1.10 should be enough.

The situation is a bit tricky:

  • custom-setup section is supported with Cabal >= 1.24
  • but you only need a cabal-install compiled against recent enough Cabal
  • Cabal bundled with GHC can however be anything what setup-depends says.
  • i.e. different Cabals are used in different stages.

@hvr hvr closed this as completed in #82 May 25, 2017
hvr pushed a commit that referenced this issue May 25, 2017
….*, too

If `dist/` is deleted but .ghc.environment.* is not, then the repository is in a state that's going to confuse Cabal.

Fixes #81.
@peti
Copy link
Contributor Author

peti commented May 25, 2017

OK, I see. I took the >= 1.24 requirement from the doctest-cabal example at https://github.com/phadej/cabal-doctest/blob/master/example/example.cabal#L13 and assumed that would be important. Now, after removing it, the situation has improve significantly. There remains only one error with GHC 7.10.x that I cannot explain:

https://travis-ci.org/peti/hsyslog/jobs/235963325

Any idea how bytestring might end up missing? I would think that's a core package of GHC 7.10.x.

@hvr
Copy link
Member

hvr commented May 25, 2017

@peti I'm not sure yet (still looking), this seems to occur only with Cabal-1.22, but setting setup-depends: Cabal >= 1.24 makes it work.

EDIT: Now I see it; this is the infamous buildable: False bug of older Cabal versions! (see also haskell/cabal#1725 (comment) ; TLDR: you need to move the build-depends into the if-clause if you want to be compatible with Cabal < 1.24)

peti added a commit to peti/hsyslog that referenced this issue May 29, 2017
@peti
Copy link
Contributor Author

peti commented May 29, 2017

Okay, thank you very much for looking at the issue. I've moved the build-depends into the conditional, as suggested. This fixes the error we've seen before, but now the build fails with

setup: The program 'hsc2hs' is required but it could not be found

instead. When I add the Cabal >= 1.24 constraint, then all builds succeed fine, but without it GHC 7.10.x appears to be in trouble.

@hvr
Copy link
Member

hvr commented May 29, 2017

Your package most likely lacks a build-tools: hsc2hs >= x.y && < z line; future cabal versions will warn about it; the reason is that cabal needs to know that it needs hsc2hs (and possibly which versions of it) at the solver-stage, so we need to inform cabal early on via the .cabal file. (this is also in line with cabal's "No untracked dependencies" design mantra)

@peti
Copy link
Contributor Author

peti commented May 29, 2017

Phew, https://travis-ci.org/peti/hsyslog/builds/237107742 now succeeds on all platforms. Thank you very much for taking the time to walk me through this process, gentlemen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants