Haskell-Things / ImplicitCAD

A math-inspired CAD program in haskell. CSG, bevels, and shells; 2D & 3D geometry; 2D gcode generation...
https://implicitcad.org/
GNU Affero General Public License v3.0
1.33k stars 141 forks source link

Install procedure doesn't work. #115

Closed drysdam closed 8 years ago

drysdam commented 10 years ago

Debian 7 64-bit here. Followed instructions in FAQ (sudo apt-get install ghc cabal-install; cabal update && cabal install implicit) and got:

extopenscad.hs:26:149: Module Options.Applicative' does not exportreader'

extopenscad.hs:26:169: Module Options.Applicative' does not export(&)' cabal: Error: some packages failed to install: implicit-0.0.3 failed during the building phase. The exception was: ExitFailure 1

drysdam commented 10 years ago

Using the development version, I get up through "cabal configure && cabal install" and then hit:

extopenscad.hs:26:155: Module Options.Applicative' does not exportreader' cabal: Error: some packages failed to install: implicit-0.0.3 failed during the building phase. The exception was: ExitFailure 1

Ofloo commented 10 years ago

Preprocessing executable 'extopenscad' for implicit-0.0.3... [46 of 46] Compiling Main ( extopenscad.hs, dist/build/extopenscad/extopenscad-tmp/Main.o )

extopenscad.hs:26:155: Module Options.Applicative' does not exportreader' Failed to install implicit-0.0.3 cabal: Error: some packages failed to install: implicit-0.0.3 failed during the building phase. The exception was: ExitFailure 1

jeremyashley commented 10 years ago

The latest version of optparse-applicative has changed it's API by removing deprecated methods. Hence its move from version 0.9.x to 0.10; you'll need to restrict the build of implicit to use < 0.10 ie. edit implicit.cabal and add the restriction below prior to building.

   optparse-applicative < 0.10,

Alternatively, edit the haskell source (extopenscad.hs) to change the deprecated references. There are hints on what to do in the github site for optparse.

peti commented 9 years ago

Could we please get an update of this package on Hackage that fixes this build error? We've run into the same issue on NixOS: http://hydra.cryp.to/build/190835/nixlog/1/raw

nmz787 commented 9 years ago

I am getting this same error on ubuntu 14.04 running the installation instructions... I am searching for implicit.cabal now, but it is not apparent where it is located.

Edit: I found the implicit.cabal in a compressed file (implicit-0.0.3.tar.gz), the full path for me was:

/home/myUser/.cabal/packages/hackage.haskell.org/implicit/0.0.3/implicit-0.0.3.tar.gz

Edit again: Editing the implicit.cabal in the tar.gz didn't fix it, when running cabal install implicit I'm getting:

[46 of 46] Compiling Main             ( extopenscad.hs, dist/build/extopenscad/extopenscad-tmp/Main.o )

extopenscad.hs:26:149:
    Module `Options.Applicative' does not export `reader'

extopenscad.hs:26:169:
    Module `Options.Applicative' does not export `(&)'
Failed to install implicit-0.0.3
cabal: Error: some packages failed to install:
implicit-0.0.3 failed during the building phase. The exception was:
ExitFailure 1
nmz787 commented 9 years ago

Ok I ended up finding the commit log for the actual change to the implicit.cabal file, the line needs to be changed to: optparse-applicative >= 0.9.0.0 && < 0.10.0,

Then on the command-line I used: cabal install optparse-applicative-0.9.1.1

then again I ran cabal install implicit.

Actually, before I discovered the command to force the package version, I wrote this Python script to remove the previously-installed version of optparse-applicative. It might not work for you, and it might break your haskell setup, but I didn't have haskell installed before I tried to install implicitCAD, so I figured I could just apt-get remove the whole haskell and cabal packages if I messed things up to bad. I didn't have to go there though!

import subprocess
import os
p1=subprocess.Popen(['ghc-pkg', 'list'],
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE)
s1,e1 = p1.communicate()

optparse_index = s1.index('optparse-applicative')
s1 = s1[optparse_index:]
optparse_end_index = s1.index('\n')
optparse_pkg = s1[:optparse_end_index]

remove_optparse = subprocess.Popen('ghc-pkg unregister --force %s' % optparse_p$
                 shell=True,
                 stdout=subprocess.PIPE,
                 stderr=subprocess.PIPE)
print remove_optparse.communicate()
p2=subprocess.Popen(['ghc-pkg', 'check'],
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE)
s2,e2 = p2.communicate()

i = e2.index('\n', e2.index('The following packages are broken'))
i = e2.index('\n', i+1)
#i = e.index('\n', i+1)
pkgs = e2[i:-1]
#print pkgs
for pkg in pkgs.splitlines():
  os.system('ghc-pkg unregister --force %s' % pkg)
  print 'removing: %s' % pkg
mmachenry commented 8 years ago

These should be fixed now. Could someone verify that this issue has been resolved? I have no problems building the project now. I will close this issue eventually if I don't hear back.

firegurafiku commented 8 years ago

Unfortunately, on my system (Fedora 21, GHC 7.6.3) installation still fails:

$ cabal install implicit
Resolving dependencies...
Downloading implicit-0.0.4...
Configuring implicit-0.0.4...
Building implicit-0.0.4...
Preprocessing library implicit-0.0.4...
(.....)
Graphics/Implicit/ExtOpenScad/Primitives.hs:429:23:
    Overlapping instances for OTypeMirror String
      arising from a use of `argument'
    Matching instances:
      instance OTypeMirror String
        -- Defined at Graphics/Implicit/ExtOpenScad/Util/OVal.hs:34:30
      instance OTypeMirror a => OTypeMirror [a]
        -- Defined at Graphics/Implicit/ExtOpenScad/Util/OVal.hs:44:31
    In the first argument of `doc', namely `argument "unit"'
    In a stmt of a 'do' block:
      unit :: String <- argument "unit"
                        `doc` "the unit you wish to work in"
    In the expression:
      do { example "unit(\"inch\") {..}";
           unit :: String <- argument "unit"
                             `doc` "the unit you wish to work in";
           let mmRatio "inch" = Just 25.4
               mmRatio "in" = mmRatio "inch"
               mmRatio "foot" = Just 304.8
               mmRatio "ft" = mmRatio "foot"
               mmRatio "yard" = Just 914.4
               mmRatio "yd" = mmRatio "yard"
               mmRatio "mm" = Just 1
               mmRatio "cm" = Just 10
               mmRatio "dm" = Just 100
               mmRatio "m" = Just 1000
               mmRatio "km" = Just 1000000
               mmRatio "\181m" = Just 0.001
               mmRatio "um" = mmRatio "\181m"
               mmRatio "nm" = Just 0.0000001
               mmRatio _ = Nothing;
           return
           $ case mmRatio unit of {
               Nothing -> do { ... }
               Just r
                 -> return
                    $ objMap (Prim.scale (r, r)) (Prim.scale (r, r, r)) children } }
Failed to install implicit-0.0.4
cabal: Error: some packages failed to install:
implicit-0.0.4 failed during the building phase. The exception was:
ExitFailure 1
mmachenry commented 8 years ago

I have merged a pull request addressing GHC-7.6.3 backward compatibility. Can you please try again?

firegurafiku commented 8 years ago

@mmachenry

Yeah, now it builds. I cannot test it at the moment, but it runs:

$ dist/build/extopenscad/extopenscad
Usage: extopenscad [-o|--output FILE] [-f|--format FORMAT] [-r|--resolution RES]
                   [--xml-error] FILE
  Extended OpenSCAD
mmachenry commented 8 years ago

Great, thanks for your help. I'm going to close this issue. Feel free to file any more in the future or reopen this if you have another problem.