idris-lang / Idris-dev

A Dependently Typed Functional Programming Language
http://idris-lang.org
Other
3.44k stars 644 forks source link

Idris installation fails on Debian stable #3350

Open nicolabotta opened 8 years ago

nicolabotta commented 8 years ago

Since a couple of days, attempts at installing Idris on my Debian stable system fail:

nicola@cirrus:~/lala/Idris-dev-master$ make
cabal install --enable-tests
Resolving dependencies...
In order, the following will be installed:
idris-0.12.2 *test (reinstall) changes: tagged-0.7.1 added, tasty-0.11.0.3
added, tasty-golden-2.3.1 added, tasty-rerun-1.1.6 added
Warning: Note that reinstalls are always dangerous. Continuing anyway...
[1 of 1] Compiling Main             ( dist/setup/setup.hs, dist/setup/Main.o )

dist/setup/setup.hs:296:26:
    Couldn't match type `PackageDescription' with `[String]'
    Expected type: Args
      Actual type: PackageDescription
    In the return type of a call of `fixPkg'
    In the second argument of `originalTestHook', namely
      `(fixPkg pkg target)'
    In a stmt of a 'do' block:
      originalTestHook args (fixPkg pkg target) local hooks flags

dist/setup/setup.hs:296:45:
    Couldn't match expected type `PackageDescription'
                with actual type `LocalBuildInfo'
    In the third argument of `originalTestHook', namely `local'
    In a stmt of a 'do' block:
      originalTestHook args (fixPkg pkg target) local hooks flags
    In the expression:
      do { let target
                 = datadir $ L.absoluteInstallDirs pkg local NoCopyDest;
           originalTestHook args (fixPkg pkg target) local hooks flags }
Failed to install idris-0.12.2
cabal: Error: some packages failed to install:
idris-0.12.2 failed during the configure step. The exception was:
ExitFailure 1
Makefile:18: recipe for target 'install' failed
make: *** [install] Error 1
nicola@cirrus:~/lala/Idris-dev-master$

Any idea how to proceed? The details of my system are:

nicola@cirrus:~/lala/Idris-dev-master$ uname -a
Linux cirrus 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux
nicola@cirrus:~/lala/Idris-dev-master$ ghci --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
jfdm commented 8 years ago

@nicolabotta Is it possible for you to find out the version of cabal you are using?

Our Travis builds incorporate building using GHC 7.6.3 and Cabal 1.20.0. So you shouldn't be seeing a problem using those versions.

Things to do in the meantime is to try and ensure that your machine is up-to-date, and you have the latest versions of cabal and ghc from your version of Debian's package universe. I imagine you are running Jessie stable...

Another question, are you building from source, or installing Idris from Hackage using cabal?

nicolabotta commented 8 years ago

@nicolabotta Is it possible for you to find out the version of cabal you are using?

nicola@cirrus:~/src/Idris-dev$ cabal --version
cabal-install version 1.20.0.3
using version 1.20.0.2 of the Cabal library 
nicola@cirrus:~/src/Idris-dev$

Idris-dev installed fine until about the middle of last week. The last installation that succeeded was

nicola@cirrus:~/src/Idris-dev$ idris --version
0.12.2-git:98c892c

I am not using Hackage. I just git pull in a local clone of https://github.com/idris-lang/Idris-dev and build using make. This has worked reliably for years until last week. I am running Debian Jessie and my system is up-to-date.

jfdm commented 8 years ago

@nicolabotta i am not too sure what is going on here. It should work. Sadly, I do not have the time to investigate this further at the moment.

Other numpty checks would be to clean the build and try again, or clone the repository again.

Given that Idris 0.12.2 was released recently on hackage, I think an interim fix would be to try and install from hackage using

cabal update; cabal install idris

Alternatively, you could look at getting more recent versions of GHC and Cabal using Jessie's Backports. However, I am not familiar with Debian, nor its backport mechanism to help further on that.

nicolabotta commented 8 years ago

@jfdm I have tried on a fresh repository clone with the same results. Also, a plain cabal install (without the --enable-tests option) fails with the same errror message.

Installing from Hackage does not seem to help either:

nicola@cirrus:~/src$ cabal install idris
Resolving dependencies...
All the requested packages are already installed:
idris-0.12.2

I have used Debian backports in the past but I am not a fan of this solution. There are anyway a number of issues (mainly #3114, #3246, #3324) that make it difficult to design and build my Idris applications at the moment. These issues are not likely to be solved until 1.0 comes out.

For the time being, I will just stay with 98c892c and regularly check if support for 7.6.3 improves.

LeifW commented 8 years ago

It's talking about reinstalls. Maybe you could try blowing away your local cabal installs of Haskell libs and start clean slate?

On Aug 9, 2016 2:43 AM, "nicolabotta" notifications@github.com wrote:

@jfdm https://github.com/jfdm I have tried on a fresh repository clone with the same results. Also, a plain cabal install (without the --enable-tests option) fails with the same errror message.

Installing from Hackage does not seem to help either:

nicola@cirrus:~/src$ cabal install idris Resolving dependencies... All the requested packages are already installed: idris-0.12.2

I have used Debian backports in the past but I am not a fan of this solution. There are anyway a number of issues (mainly #3114 https://github.com/idris-lang/Idris-dev/issues/3114, #3246 https://github.com/idris-lang/Idris-dev/issues/3246, #3324 https://github.com/idris-lang/Idris-dev/issues/3324) that make it difficult to design and build my Idris applications at the moment. These issues are not likely to be solved until 1.0 comes out.

For the time being, I will just stay with 98c892c https://github.com/idris-lang/Idris-dev/commit/98c892ce8a99757d00dd4c67dea501ac6ae7d6a0 and regularly check if support for 7.6.3 improves.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/idris-lang/Idris-dev/issues/3350#issuecomment-238504719, or mute the thread https://github.com/notifications/unsubscribe-auth/AABwJ0BuAYLboPXv6xXRCZeF_ba5LOCfks5qeEu2gaJpZM4JfEJT .

nicolabotta commented 8 years ago

@LeifW Sure, I can try that. How should I proceed? Thanks, Nicola

jfdm commented 8 years ago

It's talking about reinstalls. Maybe you could try blowing away your local cabal installs of Haskell libs and start clean slate?

I was afraid it would come to that.

@nicolabotta Essentially it could be that cabal and ghc have become confused. Typically when this happens a fair few programmers remove .cabal/ and .ghc/ and run he commands again. This has the unwelcome side effect that if you have used cabal to installed any other program you then need to reinstall it as well.

Not an ideal solution but a solution nonetheless.

In future, and to try and mitigate cabal confusion, a good rule of thumb that I follow is to only install programs from hackage using cabal, and to build haskell projects locally either in a cabal sandbox or using stack. Stack is an alternate build management system for Haskell that tries to minimise 'cabal hell' buy providing 'known working together on a certain ghc' snapshots of hackage. It is a pretty nice tool for managing the development of haskell projects, however, I think for your needs cabal sandbox's might be better.

Cabal sandboxes build your project local to the project's directory and install locally too. We provide instructions and other information on the Idris GitHub Wiki. Links to this page and other installation instructions can be found in INSTALL.md

Please feel free to take a look at stack and make your own decision; with stack comes the ability to install, locally to your project, a more uptodate version of GHC. More information about stack was available on their website.

I will attempt to install Idris on a clean version of Debian Stable tomorrow when I have access to such box.

nicolabotta commented 8 years ago

@jfdm Thanks for the detailed informations Jan! I do not want to remove the .cabal directory right at the moment. I am just trying to finish a work in Idris. If I remove .cabal, I might end up with no Idris installation at all. I'll give it a try as soon as I am finished with the current work and report.

melted commented 8 years ago

Can you try 'cabal sandbox init' in your idris-dev and see if you can build? The idris will appear in .cabal-sandbox/bin. You can remove the sandbox afterwards with 'cabal sandbox delete'

10 aug. 2016 kl. 12:27 skrev nicolabotta notifications@github.com:

@jfdm Thanks for the detailed informations Jan! I do not want to remove the .cabal directory right at the moment. I am just trying to finish a work in Idris. If I remove .cabal, I might end up with no Idris installation at all. I'll give it a try as soon as I am finished with the current work.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

nicolabotta commented 8 years ago

Can you try 'cabal sandbox init' in your idris-dev and see if you can build?

Sure, here is the outcome:

nicola@cirrus:~/src/Idris-dev$ cabal sandbox init
Writing a default package environment file to
/home/nicola/src/Idris-dev/cabal.sandbox.config
Creating a new sandbox at /home/nicola/src/Idris-dev/.cabal-sandbox
nicola@cirrus:~/src/Idris-dev$ make
cabal install --enable-tests
Resolving dependencies...
In order, the following would be installed:
annotated-wl-pprint-0.7.0 (new package)
ansi-terminal-0.6.2.3 (new package)
ansi-wl-pprint-0.6.7.3 (new package)
appar-0.1.4 (new package)
auto-update-0.1.4 (new package)
base-orphans-0.5.4 (new package)
base64-bytestring-1.0.0.1 (new package)
byteorder-1.0.4 (new package)
bytestring-builder-0.10.8.1.0 -bytestring_has_builder (new package)
clock-0.7.2 (new package)
data-default-class-0.1.2.0 (new package)
data-default-instances-containers-0.0.1 (new package)
data-default-instances-old-locale-0.0.1 (new package)
digest-0.0.1.2 (new package)
directory-1.2.7.0 (new version)
dlist-0.8.0.1 (new package)
data-default-instances-dlist-0.0.1 (new package)
data-default-0.7.1.1 (new package)
easy-file-0.2.1 (new package)
fingertree-0.1.1.0 (new package)
hinotify-0.3.8.1 (new package)
ieee754-0.7.8 (new package)
network-2.6.3.1 (new version)
iproute-1.7.0 (new package)
prelude-extras-0.4.0.3 (new package)
process-1.2.3.0 (latest: 1.4.2.0) (new version)
safe-0.3.9 (new package)
stringsearch-0.3.6.6 (new package)
terminal-size-0.3.2.1 (new package)
text-1.2.2.1 (new version)
blaze-builder-0.4.0.2 (new package)
blaze-markup-0.7.1.0 (new package)
blaze-html-0.8.1.2 (new package)
cookie-0.4.2.1 (new package)
hashable-1.2.4.0 (new version)
nats-1.1.1 (new package)
scientific-0.3.4.9 +bytestring-builder (new package)
tagsoup-0.14 (new package)
transformers-0.5.2.0 (new version)
StateVar-1.1.0.4 (new package)
attoparsec-0.13.0.2 (new version)
css-text-0.1.2.2 (new package)
haskeline-0.7.2.3 (new version)
mtl-2.2.1 (new version)
parsec-3.1.11 (new version)
network-uri-2.6.1.0 (new package)
regex-base-0.93.2 (reinstall) changes: mtl-2.1.2 -> 2.2.1
regex-tdfa-1.2.2 (new package)
streaming-commons-0.1.15.5 +use-bytestring-builder (new package)
transformers-compat-0.5.1.4 (new package)
exceptions-0.8.3 (new package)
mmorph-1.0.6 (new package)
optparse-applicative-0.12.1.0 (new package)
tagged-0.8.5 (new package)
distributive-0.5.0.2 (new package)
reflection-2.1.2 (new package)
temporary-1.2.0.4 (new package)
transformers-base-0.4.4 (new package)
monad-control-1.0.1.0 (new package)
lifted-base-0.2.3.8 (new package)
resourcet-1.1.7.5 (new package)
unbounded-delays-0.1.0.9 (new package)
tasty-0.11.0.3 (new package)
tasty-golden-2.3.1 (new package)
unix-compat-0.4.2.0 (new package)
fsnotify-0.2.1 (new package)
unix-time-0.3.6 (new package)
fast-logger-2.4.6 (new package)
unordered-containers-0.2.7.1 (new version)
aeson-0.7.0.6 (latest: 1.0.0.0) (new package)
semigroups-0.18.2 (new package)
case-insensitive-1.2.0.7 (new version)
charset-0.3.7.1 (new package)
http-types-0.9.1 (new package)
parsers-0.12.4 (new package)
uniplate-1.6.12 (new package)
utf8-string-1.0.1.1 (new package)
vault-0.3.0.6 (new package)
vector-binary-instances-0.2.3.2 (new package)
void-0.7.1 (new package)
contravariant-1.4 (new package)
comonad-5 (new package)
bifunctors-5.4.1 (new package)
profunctors-5.2 (new package)
semigroupoids-5.1 (new package)
free-4.12.4 (new package)
adjunctions-4.3 (new package)
kan-extensions-5.0.1 (new package)
lens-4.14 (new package)
reducers-3.12.1 (new package)
tasty-rerun-1.1.6 (new package)
trifecta-1.6 (new package)
wai-3.2.1.1 (new package)
wai-logger-2.3.0 (new package)
word8-0.1.2 (new package)
wai-extra-3.0.16.1 (new package)
xss-sanitize-0.3.5.7 (new package)
cheapskate-0.1.0.5 (new package)
zip-archive-0.3.0.4 (new package)
idris-0.12.2 *test (new package)
cabal: The following packages are likely to be broken by the reinstalls:
regex-posix-0.95.2
regex-compat-0.95.1
Use --force-reinstalls if you want to install anyway.
Makefile:18: recipe for target 'install' failed
make: *** [install] Error 1
nicola@cirrus:~/src/Idris-dev$

Shall I now try with --force-reinstalls?

nicolabotta commented 8 years ago

Same problem with cabal install --enable-tests --force-reinstalls in sandboxes.

LeifW commented 8 years ago

There is no need to remove your ~/.cabal directory. If you run ghc-pkg list, it'll tell you what packages you have registered with your ghc install; ones installed by root at /usr/lib/ghc-8.0.1/package.conf.d, and then ones installed at the user level at say /home/leif/.ghc/x86_64-linux-8.0.1/package.conf.d. The libraries registered in $HOME/.ghc/your_ghc_version/package.conf.d have their code stored in $HOME/.cabal/lib/your_ghc_version. All you need to do is run ghc-pkg unregister one by one on the ones it says it is going to reinstall (removing any other packages that say they depend on those old versions, as well). You can delete their files out of $HOME/.cabal/lib as you do this to free up space if you wish, but they're irrelevant to ghc after you unregister them from $HOME/.ghc. You can also remove $HOME/.ghc/your_ghc_version/package.conf.d entirely to start from scratch. But this won't hurt your Idris install. I'm assuming that lives in $HOME/.cabal/bin, and the only thing that executable needs is the idris libraries, which it contains an absolute path to (idris --libdir will show you that); somewhere in $HOME/.cabal I'm guessing.

LeifW commented 8 years ago

You can also remove $HOME/.ghc entirely if you wish. The only other thing I know if that lives in there is your ghci_history and any ghci.conf settings.

I don't know that sandboxes will buy you anything if you only build one ghc project. You can just treat your $HOME/.ghc/your_ghc_version/package.conf.d as a sandbox in that case.

nicolabotta commented 8 years ago

@LeifW Thanks Leif! Before removing or unregistering packages, I would like to understand what the problem actually is.

So far, it seems that I am only getting errors from dist/setup/setup.hs, not when trying to reinstall previously installed packaged or when trying to install new packages, see my first post. In particular, the first error

dist/setup/setup.hs:296:26:
    Couldn't match type `PackageDescription' with `[String]'
    Expected type: Args
      Actual type: PackageDescription
    In the return type of a call of `fixPkg'
    In the second argument of `originalTestHook', namely
      `(fixPkg pkg target)'
    In a stmt of a 'do' block:
      originalTestHook args (fixPkg pkg target) local hooks flags

does not appear to be directly related to GHC versions or to reinstalls. I might be wrong, of course.

LeifW commented 8 years ago

Oh shoot - sorry I missed that part before - thanks for pointing it out to me. That's something I don't recall seeing before. Perhaps the only thing it was talking about reinstalling is Idris itself? :| In my dist/setup/setup.hs, where originalTestHook is defined, it's guarded with an #if __GLASGOW_HASKELL__ < 710, and has this comment:

"The "Args" argument of the testHooks has been added in cabal 1.22.0, and should therefore be ignored for prior versions."

And there's an explanatory comment about why they're testing the GHC version and not the Cabal version for that:

"FIXME: We use the GLASGOW_HASKELL macro because MIN_VERSION_cabal seems to be broken !"

You can cd into dist/setup and load setup.hs into ghci, if you want to try poking around at it. Perhaps an ifdef make the wrong choice?

My setup.vesion in that dir says Version {versionBranch = [1,24,0,0], versionTags = []}

LeifW commented 8 years ago

This appears to be the same Setup.hs that's in the top-level of the repo. Perhaps try loading that in ghci and hacking on it to get it to compile?

nicolabotta commented 8 years ago

Right, the problem is the guard. With

nicola@cirrus:~/src/Idris-dev$ diff Setup.hs Setup.hs.0 
289,290c289
< -- originalTestHook _ = testHook simpleUserHooks
< originalTestHook = testHook simpleUserHooks
---
> originalTestHook _ = testHook simpleUserHooks
319,320c318
<    -- , testHook = idrisTestHook ()
<    , testHook = idrisTestHook
---
>    , testHook = idrisTestHook ()
nicola@cirrus:~/src/Idris-dev$

Idris installs fine. Perhaps the condition #if __GLASGOW_HASKELL__ < 710 needs to be strengthened?

Melvar commented 8 years ago

One problem here is that a condition with __GLASGOW_HASKELL__ was used where the actual compatibility condition is the version of Cabal. So an old GHC (< 7.10) with a new version of Cabal (≥ 1.22) will have an error similar to this. I’m not sure how to explain the problem when using GHC 7.6.3 with Cabal 1.20.0.2. If Setup.hs had type signatures, we might have more information now. The reported error is not exactly the same as the one I get with GHC 7.8.4 and Cabal 1.24.0.0, but the difference is explainable by the different GHC version, the content being substantially the same.

I suspected that the reported failure of MIN_VERSION_cabal was due to the fact that cabal is not the package we’re looking for, Cabal is. However, it looks like instead the MIN_VERSION_* macros are generated as an actual header file per-project, which apparently only happens after Setup.hs is compiled because Setup.hs can hook into it.

It seems like we might have to add a new Cabal-Version requirement. The current test condition is certainly wrong and breaks the build for me (GHC 7.8.4, Cabal 1.24.0.0), and removing the condition in favor of the newer-Cabal-matching code makes it work.

dvberkel commented 8 years ago

I had the some problem. I ended up installing the latest stable version that would compile. Just for future reference for me that version was idris-0.12.1 installed with

cabal install idris-0.12.1
nicolabotta commented 8 years ago

Update: now even with Setup.hs modified as described above idris-0.12.3 fails to install on (my) Debian stable:

...
src/Idris/Elab/Clause.hs:763:26:
    Couldn't match expected type `[a0]'
                with actual type `Maybe (Name, [Name])'
    In the return type of a call of `getUnfolds'
    In the first argument of `null', namely `(getUnfolds opts)'
    In the first argument of `not', namely `(null (getUnfolds opts))'

src/Idris/Elab/Clause.hs:965:26:
    Couldn't match expected type `[a1]'
                with actual type `Maybe (Name, [Name])'
    In the return type of a call of `getUnfolds'
    In the first argument of `null', namely `(getUnfolds opts)'
    In the first argument of `not', namely `(null (getUnfolds opts))'

src/Idris/Elab/Clause.hs:1088:26:
    Couldn't match expected type `[a2]'
                with actual type `Maybe (Name, [Name])'
    In the return type of a call of `getUnfolds'
    In the first argument of `null', namely `(getUnfolds opts)'
    In the first argument of `not', namely `(null (getUnfolds opts))'
Failed to install idris-0.12.3
cabal: Error: some packages failed to install:
idris-0.12.3 failed during the building phase. The exception was:
ExitFailure 1

On a fresh Idris-dev repository (without modifications to Setup.hs) installation fails from the very beginning:

nicola@cirrus:~/src/Idris-dev$ cd ..
nicola@cirrus:~/src$ mv Idris-dev Idris-dev.tmp
nicola@cirrus:~/src$ git clone https://github.com/idris-lang/Idris-dev.git
Cloning into 'Idris-dev'...
remote: Counting objects: 55973, done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 55973 (delta 26), reused 0 (delta 0), pack-reused 55904
Receiving objects: 100% (55973/55973), 30.91 MiB | 7.89 MiB/s, done.
Resolving deltas: 100% (37921/37921), done.
Checking connectivity... done.
nicola@cirrus:~/src$ cd Idris-dev
nicola@cirrus:~/src/Idris-dev$ make
cabal install --enable-tests
Resolving dependencies...
In order, the following will be installed:
idris-0.12.3 *test (reinstall) changes: tagged-0.7.1 added, tasty-0.11.0.3
added, tasty-golden-2.3.1 added, tasty-rerun-1.1.6 added
Warning: Note that reinstalls are always dangerous. Continuing anyway...
[1 of 1] Compiling Main             ( dist/setup/setup.hs, dist/setup/Main.o )

dist/setup/setup.hs:296:26:
    Couldn't match type `PackageDescription' with `[String]'
    Expected type: Args
      Actual type: PackageDescription
    In the return type of a call of `fixPkg'
    In the second argument of `originalTestHook', namely
      `(fixPkg pkg target)'
    In a stmt of a 'do' block:
      originalTestHook args (fixPkg pkg target) local hooks flags

dist/setup/setup.hs:296:45:
    Couldn't match expected type `PackageDescription'
                with actual type `LocalBuildInfo'
    In the third argument of `originalTestHook', namely `local'
    In a stmt of a 'do' block:
      originalTestHook args (fixPkg pkg target) local hooks flags
    In the expression:
      do { let target
                 = datadir $ L.absoluteInstallDirs pkg local NoCopyDest;
           originalTestHook args (fixPkg pkg target) local hooks flags }
Failed to install idris-0.12.3
cabal: Error: some packages failed to install:
idris-0.12.3 failed during the configure step. The exception was:
ExitFailure 1
Makefile:18: recipe for target 'install' failed
make: *** [install] Error 1
nicola@cirrus:~/src/Idris-dev$

as reported in my original post. Any chance to get Idris install on Debian stable?

Melvar commented 8 years ago

@nicolabotta: That new error looks like Edwin forgot to check in a file or something. Not something specific to Debian stable.

edwinb commented 8 years ago

I don't believe I forgot to check in anything. The error with 'null' crept in because of a library change in (I think) GHC 7.10 but I undid that one. I have no idea about the Setup.hs error. Does anyone have an idea?

nicolabotta commented 8 years ago

@edwinb The Setup.hs error could be avoided (since Aug. 17 and until about two weeks ago, see posts from Aug. 17 and form Nov. 18 above) with a simple patch:

nicola@cirrus:~/src/Idris-dev$ diff Setup.hs Setup.hs.0 
289,290c289
< -- originalTestHook _ = testHook simpleUserHooks
< originalTestHook = testHook simpleUserHooks
---
> originalTestHook _ = testHook simpleUserHooks
319,320c318
<    -- , testHook = idrisTestHook ()
<    , testHook = idrisTestHook
---
>    , testHook = idrisTestHook ()
nicola@cirrus:~/src/Idris-dev$

With idris-0.12.3 this patch di not work anymore, see my post from Nov. 18 above. With 0.99-git:5245054 the patch works again and I can now install Idris on Debian stable!