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

diagrams-contrib install error on Haskell Platform 2013.2.0.0 on Windows #14

Closed
fegu opened this issue Aug 15, 2013 · 22 comments
Closed

Comments

@fegu
Copy link

fegu commented Aug 15, 2013

I am sorry for first posting this issue in diagrams/diagrams, but I guess diagrams/diagrams-contrib (here) is better, so here goes.

My quite fresh haskell platform works in every other way, I have several projects compiling and running fine with a lot of dependencies. However, on cabal install diagrams-contrib (or just diagrams) I have an error I haven't been able to resolve:

cabal install diagrams-contrib
[..several lines..]
[10 of 12] Compiling Diagrams.TwoD.Layout.Tree (src\Diagrams\TwoD\Layout\Tree.hs, dist\build\Diagrams\TwoD\Layout\Tree.o)
Loading package ghc-prim ... linking ... done.
[lots of more Loading package...]
Loading package numeric-extras-0.0.3 ... linking ... ghc.exe: C:\Users\syvken\AppData\Roaming\cabal\numeric-extras-0.0.3\ghc-7.6.3\HSnumeric-extras-0.0.3.o: 
unknown symbol _expm1'
ghc.exe: unable to load packagenumeric-extras-0.0.3'
Failed to install diagrams-contrib-0.7
cabal: Error: some packages failed to install:
diagrams-contrib-0.7 failed during the building phase. The exception was:
ExitFailure 1

Could anyone shed some light on this? diagrams-core and diagrams-lib installed fine, as well as svgfonts.

@fegu
Copy link
Author

fegu commented Aug 15, 2013

This seems like a problem with the dependency numeric-extras-0.0.3 on Windows and not a bug/problem in diagrams-contrib per se.

@byorgey
Copy link
Member

byorgey commented Aug 16, 2013

Hmm, strange. I see you have also filed a bug report at ekmett/numeric-extras#1 . I think you're probably right that this is not a diagrams problem per se, but I'm happy to leave this issue open for now since it affects diagrams-contrib, to make it easy for other people having the same issue to find.

In the meantime, note that you can use diagrams just fine without diagrams-contrib. The diagrams package is just a wrapper that pulls in diagrams-core, diagrams-lib, diagrams-svg, and diagrams-contrib. So you can install everything except diagrams-contrib by doing

cabal install diagrams-core diagrams-lib diagrams-svg

@fegu
Copy link
Author

fegu commented Aug 16, 2013

numeric-extras-0.0.3 is a dependency of SVGFonts-1.3.0.2 diagrams-svg-0.7 diagrams-lib-0.7 and intervals-0.2.2. So this issue seems to effectively prevent windows users from using diagrams. I don't know how to resolve this, but since the numeric-extras is quite small, it should be relatively easy to overcome for example by reimplementing with pure methods. I will see what I can do.

@byorgey
Copy link
Member

byorgey commented Aug 16, 2013

Ah, I see, I didn't realize it was also a dependency of diagrams-svg.

@fegu
Copy link
Author

fegu commented Aug 16, 2013

After some testing I have discovered that while this issue prevents diagrams-contrib from installing, it is indeed possible to use the other packages mentioned - as long as they are used in a compiled program and not within ghci. I have successfully installed the other packages and compiled and ran some examples from the tutorial with the SVG backend. The same small tutorial examples does not run when laoded into ghci. For me, this solves the issue (i.e. allows me to do what I wanted to do). At least until I stumble upon something i diagrams-contrib I really need.

@3dGrabber
Copy link

Has anyone made a fix or found a workaround for this?

@fegu
Copy link
Author

fegu commented Oct 24, 2013

I have a possible workaround in mind I never got around to trying because I didn't need the extra packages. I will test it today or tomorrow.

@bergey
Copy link
Member

bergey commented Oct 24, 2013

I've done some testing, but I don't have a workaround. I verified that this bug exists in the version of Diagrams on Hackage and in HEAD, when using Haskell Platform 2013.10 / GHC 7.6.3. I haven't yet build GHC HEAD on Windows to test, but see below.

The most general solution to the numeric-extras / ghci problem is for ghci to load dynamic libraries, and not use the current "GHCi linker". This is the future of GHC. It looks like it will be standard behavior of 7.8 on linux, and probably 7.8.? on BSD. See the first two URLs below.

http://ghc.haskell.org/trac/ghc/wiki/DynamicGhcPrograms

http://ghc.haskell.org/trac/ghc/ticket/3658

The next link makes it look pretty unlikely that 7.8.1 will have DYNAMIC_TOO on Windows; hence Windows probably won't have DYNAMIC_GHC_PROGRAMS, hence GHCi will still break on ffi.

http://ghc.haskell.org/trac/ghc/ticket/7134#comment:23

I think the numeric-extras dependency is incurred by way of Intervals. Intervals is a dependency of diagrams-lib. It doesn't seem to be a direct dependency of diagrams-contrib or other packages I have checked out. It's odd to me that -contrib is what fails to build; clearly I don't understand the way Setup.hs invokes numeric-extras, hitting the ghci linker bug.

@byorgey
Copy link
Member

byorgey commented Oct 24, 2013

intervals is a dependency of diagrams-lib because we use it to track numeric precision when computing arc length. It's not a super important part of the API. I wonder if, as a workaround, we could introduce a cabal flag and some CPP hackery that makes it possible to build without the intervals dependency, falling back to some simpler implementations of arc length functions (where "simpler" could be e.g. error "Not built with numeric interval support"). Hackish, certainly, but if this is blocking people from using diagrams at all on Windows it's probably worth it. I'm also open to other, less hackish, solutions.

@bergey
Copy link
Member

bergey commented Oct 24, 2013

That sounds like a very good effort-to-benefit ratio. I think it would also be not-very-hard to fork intervals and remove the numeric-extras dependency, writing a native Haskell fmod. I'd want to ask @ekmett about downsides to that approach, of course.

@ekmett
Copy link

ekmett commented Oct 24, 2013

Or you could just ask me to remove it, send me a patch, or patch it to drop the dependency on windows.

I'm open to these options, too

Sent from my iPhone

On Oct 24, 2013, at 10:32 AM, Daniel Bergey notifications@github.com wrote:

That sounds like a very good effort-to-benefit ratio. I think it would also be not-very-hard to fork intervals and remove the numeric-extras dependency, writing a native Haskell fmod. I'd want to ask @ekmett about downsides to that approach, of course.


Reply to this email directly or view it on GitHub.

@bergey
Copy link
Member

bergey commented Oct 24, 2013

OK, I'll write a patch and see if I can get it working on Windows.

@cartazio
Copy link

is this bug in play with GHC HEAD too? many GHCI linking woes should end with 7.8 ...

@ekmett
Copy link

ekmett commented Oct 24, 2013

They have a fairly long support window, so even if it was working on HEAD
that wouldn't exactly close out the issue. ;)

On Thu, Oct 24, 2013 at 1:34 PM, Carter Tazio Schonwald <
notifications@github.com> wrote:

is this bug in play with GHC HEAD too? many GHCI linking woes _should_end with 7.8 ...


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-27012941
.

@cartazio
Copy link

good point :)

@fegu
Copy link
Author

fegu commented Oct 24, 2013

I did not succeed in my main attempt at a workaround today, but I got another workaround to work. I will describe both here for some input. The descriptions are verbose to give novices a chance to make this work for them.

First, my main attempt, where the goal was to ge the package installed. This failed:
numerical-extras is installed and compiles fine (so it's good)
the problem seems to be with ghci-type linking
the problem occurs on compiling to Tree.o the file src\Diagrams\TwoD\Layout\Tree.hs

My thought was to just download the hackage package diagrams-contrib.tar.gz, unzip, untar, manually compile Tree.hs to Tree.o with ghc (which works fine), copy the result from src to the same directory under dist, and then run cabal build. Sadly, cabal build insists on rebuilding Tree.o anyway and still fails in exactly the same way.

Then, second attempt, where goal was just to get to actually use diagrams-contrib and get on with building diagrams. This was successfull.

Just download the source package, unzip+untar and copy the contents of the src directory (i.e. the Diagrams directory and everything below) to your project directory. The package is not installed, but everything seems to work fine as long as you compile your project. Prerequisite: install diagrams-svg (which works fine).

Example:
create directory testproject.
Copy Diagrams-folder to it from src
Copy file Diagrams\Example\Logo.hs to it as well
Add two lines to Logo.hs:

import Diagrams.Backend.SVG.CmdLine
main = defaultMain logo

ghc Logo.hs
Logo.exe -o Logo.svg

note that Logo.hs actually imports Diagrams.TwoD.Layout.Tree which was the (perhaps random) offending part and still works.

@bergey
Copy link
Member

bergey commented Oct 29, 2013

This should be fixed by building against intervals-0.3, which @ekmett released today.

@fegu @3dGrabber Can you confirm that? If so, I'll bump the lower bound and close this issue.

@fegu
Copy link
Author

fegu commented Oct 29, 2013

No, I did cabal update and cabal install intervals just now. It installed intervals-0.3 ok. I even did a ghc-pkg hide intervals-0.2.2 but cabal install diagrams-contrib still gives

[..]
[10 of 12] Compiling Diagrams.TwoD.Layout.Tree (src\Diagrams\TwoD\Layout\Tree.hs, dist\build\Diagrams\TwoD\Layout\Tree.o)
[..]
Loading package numeric-extras-0.0.3 ... linking ... ghc.exe: C:\Users\syvken\Ap
pData\Roaming\cabal\numeric-extras-0.0.3\ghc-7.6.3\HSnumeric-extras-0.0.3.o: unknown symbol _expm1' ghc.exe: unable to load packagenumeric-extras-0.0.3'
Failed to install diagrams-contrib-0.7

@ekmett
Copy link

ekmett commented Oct 29, 2013

Did you remove any direct numeric-extras dependency from diagrams-contrib? You shouldn't need it any more at all.

Sent from my iPhone

On Oct 29, 2013, at 7:22 PM, Finn Espen Gundersen notifications@github.com wrote:

No, I did cabal update and cabal install intervals just now. It installed intervals-0.3 ok. I even did a ghc-pkg hide intervals-0.2.2 but cabal install diagrams-contrib still gives

[..]
[10 of 12] Compiling Diagrams.TwoD.Layout.Tree (src\Diagrams\TwoD\Layout\Tree.hs, dist\build\Diagrams\TwoD\Layout\Tree.o)
[..]
Loading package numeric-extras-0.0.3 ... linking ... ghc.exe: C:\Users\syvken\Ap
pData\Roaming\cabal\numeric-extras-0.0.3\ghc-7.6.3\HSnumeric-extras-0.0.3.o: unknown symbol _expm1'
ghc.exe: unable to load packagenumeric-extras-0.0.3'
Failed to install diagrams-contrib-0.7


Reply to this email directly or view it on GitHub.

@bergey
Copy link
Member

bergey commented Oct 30, 2013

I should have mentioned that it's necessary to rebuild diagrams-lib, using intervals-0.3, before reinstalling diagrams-contrib. Sorry about that. I don't believe that there is any direct numeric-extras dependency.

@fegu
Copy link
Author

fegu commented Oct 31, 2013

OK, so I unregistered diagrams-lib, diagrams-core and intervals-0.2.2. I then downloaded the cabal file of diagrams-lib and changed the line intervals >= 0.2.2 && < 0.3 to intervals >= 0.2.2 && <= 0.3. From there on, install of all diagrams-packages went smoothly. The dependency of diagrams-lib on intervals should be changed (perhaps even to >=3.0?)

@bergey
Copy link
Member

bergey commented Oct 31, 2013

@fegu Thank you, that's good to hear! I will bump the intervals constraint to >= 3.0 in HEAD. That will be in our upcoming 1.0 release, at least.

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

6 participants