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

README ghci test not working and there is no ~/.cabal/lib/ ... #481

Open
kjcole opened this issue Mar 4, 2024 · 1 comment
Open

README ghci test not working and there is no ~/.cabal/lib/ ... #481

kjcole opened this issue Mar 4, 2024 · 1 comment

Comments

@kjcole
Copy link

kjcole commented Mar 4, 2024

Maybe more documentation needed?

  • Haskell test results in module is not loaded: 'Graphics.Implicit' (./Graphics/Implicit.hs)

This is most likely a problem with your Linux distro and cabal not playing nice. GHC is not configured to see the ImplicitCAD libraries. You can confirm this by trying the test in ~/.cabal/lib/. If that works, you should be able to use ghc anywhere with the -Ldir or -llib options. Alternatively, some people have permanently fixed this by doing the cabal install as root.

A slightly edited log:

$ apt install ghc haskell-stack cabal-install
$ cabal update && cabal install implicit
$ echo "circle(30);" > test.escad
$ extopenscad test.escad
Loading File.
Processing File.
Rendering 2D object from test.escad to test.stl with resolution 2.0 in
box (V2 (-30.0) (-30.0),V2 30.0 30.0) circle 30.0
<<ghc:
  2264880 bytes, 2 GCs, 238032/238032 avg/max bytes residency (1
  samples), 18M in use, 0.005 INIT (0.002 elapsed), 0.004 MUT (0.002
  elapsed), 0.000 GC (0.000 elapsed)
:ghc>>
$ ls
test.escad  test.stl
$ ghci
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Prelude>  import Graphics.Implicit

<no location info>: error:
    Could not find module ‘Graphics.Implicit’
    It is not a module in the current program, or in any known package.
Prelude> ^D
$ locate cabal | grep lib | grep -i implicit | wc -l
117
$ locate cabal | grep lib | grep -i implicit | rev | cut -d "/" -f 2- | rev | sort | uniq | head -n 1
~/.cabal/store/ghc-8.8.4/implicit-0.4.1.0-a990a66c188ce67ca424777aeecf8a34c19946f74d8d9563353b724167c06df9

And within that directory we have /lib/Graphics/ which contains:

  • Implicit
  • Implicit/Export
  • Implicit/Export/Render
  • Implicit/Export/Symbolic
  • Implicit/ExtOpenScad
  • Implicit/ExtOpenScad/Eval
  • Implicit/ExtOpenScad/Parser
  • Implicit/ExtOpenScad/Util
  • Implicit/ObjectUtil

I attempted the import while cd'd to ~/.cabal/ and then to each of the subdirectories, all with the same result.

@kjcole
Copy link
Author

kjcole commented Mar 4, 2024

And copying from the git repo didn't work either.

$ mkdir ~/.cabal/lib
$ cp -rv ~/gits/3D/ImplicitCAD/Graphics ~/.cabal/lib/
...

$ ghci
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
Prelude> import Graphics.Implicit

<no location info>: error:
    Could not find module ‘Graphics.Implicit’
    It is not a module in the current program, or in any known package.
Prelude> ^D
Leaving GHCi.

$ ghci -Llib ~/.cabal/lib/
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
target ‘~/.cabal/lib/’ is not a module name or a source file
Prelude> ^D
Leaving GHCi.

$ ghci -Ldir ~/.cabal/lib/
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
target ‘~/.cabal/lib/’ is not a module name or a source file
Prelude> ^D
Leaving GHCi.

$ ghci -Ldir ~/.cabal/lib
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help
target ‘~/.cabal/lib’ is not a module name or a source file
Prelude> ^D
Leaving GHCi.

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

1 participant