diagrams / diagrams-builder

Utilities for creating diagram-building tools
Other
12 stars 14 forks source link

Cryptic error messages when using the diagrams-builder-cairo #23

Open david-hoze opened 8 years ago

david-hoze commented 8 years ago

Hi, when I compile my latex file using the cairo backend I get

Opening diagrams-latex stream diagrams/pretty-print-problem-diagrams-latex-fig1
.hs Error while compiling diagrams/pretty-print-problem-diagrams-latex-fig1.hs
/tmp/Diagram1804289383846930886.hs:4:8:
    Could not find module ‘Diagrams.Prelude’
    Use -v to see a list of the files searched for.
/tmp/Diagram1804289383846930886.hs:5:8:
    Could not find module ‘Diagrams.Backend.Cairo’
    Use -v to see a list of the files searched for.
/tmp/Diagram1804289383846930886.hs:6:8:
    Could not find module ‘Diagrams.TwoD.Text’
    Use -v to see a list of the files searched for.

Which was not the real bug. I had to catch the temporary file using a hacky loop in /tmp:

cd /tmp
while 1; do cat Diagram* >> bug.hs; done

remove the duplicates (the time it takes to remove the temporary file), and then compile it using:

ghc --make bug.hs

to get the real error message. Happened also to this guy: https://groups.google.com/forum/#!topic/diagrams-discuss/DY3M38X0dbA.

Thanks.

versions used diagrams-builder: 0.7.2.0 ghc: 7.10.2 diagrams-core: 1.3.0.3 diagrams-cairo: 1.3.0.5 NixOS: https://github.com/nixos/nixpkgs/commit/819a375382dc86bcc3ee685bb54eafbf449f0c1f

byorgey commented 8 years ago

Hi there,

How did you build and install diagrams?

If you fix the "real bug" and then compile using the cairo backend does it work, or does it still give the same errors about not being able to find certain modules?

I don't know whether https://groups.google.com/forum/#!topic/diagrams-discuss/DY3M38X0dbA is the same problem. The difference there was the version of GHC used, and the error message received from GHC 7.10 would not have been an error with GHC 7.8, it is due to some changes in the way inferred types are handled.

jwiegley commented 6 years ago

I'm running into this sample problem while trying to use org-babel-diagrams. When I hit C-c C-c to evaluate the code block, I get the same error as above. When I use "trick" to capture the bug.hs file and then run ghc --make bug.hs from within Emacs, it seems to compile just fine. I'm not quite sure, therefore, what the disconnect is that's triggering the failed build.

jwiegley commented 6 years ago

That is:

~ $ diagrams-builder-cairo /var/folders/ds/nt2q1_s57cqgt9g94_vmkjcw0000gn/T/babel-nYlDkB/diagrams-inputPBWNyb
Error while compiling /var/folders/ds/nt2q1_s57cqgt9g94_vmkjcw0000gn/T/babel-nYlDkB/diagrams-inputPBWNyb
/var/folders/ds/nt2q1_s57cqgt9g94_vmkjcw0000gn/T/Diagram70190-0.hs:4:1: error:
    Could not find module ‘Diagrams.Prelude’
    Use -v to see a list of the files searched for.
/var/folders/ds/nt2q1_s57cqgt9g94_vmkjcw0000gn/T/Diagram70190-0.hs:5:1: error:
    Could not find module ‘Diagrams.Backend.Cairo’
    Use -v to see a list of the files searched for.

~ $ ghc --make /var/folders/ds/nt2q1_s57cqgt9g94_vmkjcw0000gn/T/bug.hs
[1 of 1] Compiling Diagram67467     ( /var/folders/ds/nt2q1_s57cqgt9g94_vmkjcw0000gn/T/bug.hs, /var/folders/ds/nt2q1_s57cqgt9g94_vmkjcw0000gn/T/bug.o ) [flags changed]

Where bug.hs should be a capture of what diagrams-builder-cairo is trying to compile.