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

numeric-extras error on Windows #1

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

numeric-extras error on Windows #1

fegu opened this issue Aug 15, 2013 · 17 comments
Assignees
Labels

Comments

@fegu
Copy link

fegu commented Aug 15, 2013

Hi,

I have installed numeric-extras-0.0.3 on Windows.
When I start ghci and type:
import Numeric.Extras
fmod 5.0 1.0
Loading package numeric-extras-0.0.3 ... linking ... : C:\Users\syv
ken\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'

This error is also holding up the install and use of the library diagrams as it depends on numerical-extras. Is there anything I can do to fix this, or help you find this error?

@byorgey
Copy link

byorgey commented Aug 16, 2013

I wonder if this is related at all? http://ghc.haskell.org/trac/ghc/ticket/3242

@ekmett
Copy link
Owner

ekmett commented Aug 16, 2013

@byorgey: sounds right

@fegu: I'd happily take a patch that resolves the issue. I just don't know what the right solution is if mingw is shipping blatantly broken libraries for us to link to.

@ekmett
Copy link
Owner

ekmett commented Aug 16, 2013

If I'm reading it correctly, the tail end of that ticket seems to indicate that currently one can just drop the extra-libraries: m from the cabal file on MinGW. @fegu, if you do that does it build correctly? If so, I can put conditional compilation flags in the cabal file.

@fegu
Copy link
Author

fegu commented Aug 16, 2013

I don't quite follow. I did not have MinGW (http://www.mingw.org/) installed. I downloaded and installed, but no difference. Is MinGW required? Anyway, which cabal file do you mean? There is no mingw on hackage, so no cabal install mingw, and no cabal file for mingw. The cabal file for numeric-extras at http://hackage.haskell.org/packages/archive/numeric-extras/0.0.3/numeric-extras.cabal has only base as a dependency (?)

Please elaborate, and I will try to help out (but I am not well versed in the cabal innards).

@ekmett
Copy link
Owner

ekmett commented Aug 16, 2013

@fegu I was looking through the issue that byorgey linked and it seemed to indicate the windows build issue was driven by the way mingw handles libm as a stub. It offered some fixes and contradictory evidence about what worked or didn't.

I merely suggested that one of those fixes might work, which would be removing the reference to extra-libraries: m from numeric-extras.cabal. That used to not work, but later posts in the thread indicated it might work now. In the process to paying attention to that I never even looked to se, but as you pointed out, I never had any reference to libm here to begin with!

Want to try adding it in and seeing if it helps then? =)

Beyond that I literally have no idea at this point and I'd be debugging by remote control.

If you can figure out how to build it, I'll happily take a patch.

@ghost ghost assigned ekmett Aug 16, 2013
@fegu
Copy link
Author

fegu commented Aug 16, 2013

This issue seems to be limited to use within ghci and use in Setup-files (such as in diagrams-contrib). This means that while it does block the install of diagrams-contrib, it does not block the install of absolutely everything (such as diagrams-svg etc) that references numeric-extras. By avoiding ghci and doing without diagrams-contrib I am getting my task done for now.

@ekmett
Copy link
Owner

ekmett commented Aug 16, 2013

If you ever do figure out a workaround that makes ghci work on windows with
numeric-extras, I'd love to see it.

This sounds like some horrible interaction with the custom in-process
linker GHC uses.

On Fri, Aug 16, 2013 at 8:34 AM, fegu notifications@github.com wrote:

This issue seems to be limited to use within ghci and use in Setup-files
(such as in diagrams-contrib). This means that while it does block the
install of diagrams-contrib, it does not block the install of absolutely
everything (such as diagrams-svg etc) that references numeric-extras. By
avoiding ghci and doing without diagrams-contrib I am getting my task done
for now.


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

@ronslow
Copy link

ronslow commented Sep 22, 2013

Yes, I would be keen to get this working. I'm using https://github.com/bergey/org-babel-diagrams which requires diagrams-builder-cairo. This has a dependency on numeric-extras but also invokes ghci. The result is the org-babel-diagrams won't run on Windows at the moment

@ekmett
Copy link
Owner

ekmett commented Sep 22, 2013

I am curious if this will be fixed by switching to ghc HEAD. I'll have @thoughtpolice crashing on my couch this week for ICFP, maybe I can get him to take a crack at it.

@expipiplus1
Copy link

For what it's worth here's the problem still around two years later:

~/src
$ git clone git@github.com:ekmett/numeric-extras.git
Cloning into 'numeric-extras'...
remote: Counting objects: 38, done.
remote: Total 38 (delta 0), reused 0 (delta 0), pack-reused 38
Receiving objects: 100% (38/38), 4.98 KiB | 0 bytes/s, done.
Resolving deltas: 100% (17/17), done.
Checking connectivity... done.

~/src
$ cd numeric-extras/

~/src/numeric-extras
$ stack init
Writing default config file to: C:\Users\jophish\src\numeric-extras\stack.yaml
Basing on cabal files:
- C:\Users\jophish\src\numeric-extras\numeric-extras.cabal

Checking against build plan lts-3.6
Selected resolver: lts-3.6
Wrote project config to: C:\Users\jophish\src\numeric-extras\stack.yaml

~/src/numeric-extras
$ stack build
numeric-extras-0.0.3: configure
Configuring numeric-extras-0.0.3...
numeric-extras-0.0.3: build
Preprocessing library numeric-extras-0.0.3...
[1 of 1] Compiling Numeric.Extras   ( Numeric\Extras.hs, .stack-work\dist\x86_64-windows\Cabal-1.22.4.0\build\Numeric\Extras.o )
In-place registering numeric-extras-0.0.3...
numeric-extras-0.0.3: install
Installing library in
C:\Users\jophish\src\numeric-extras\.stack-work\install\x86_64-windows\lts-3.6\7.10.2\lib\x86_64-windows-ghc-7.10.2\numeric-extras-0.0.3-JQjhuS7BHDm7iVmWEmpUVy
Registering numeric-extras-0.0.3...

~/src/numeric-extras
$ stack ghci
numeric-extras-0.0.3-a130817fd0b23c7a181b7deb4a9eb733: unregistering (local file changes)
Configuring GHCi with the following packages: numeric-extras
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Numeric.Extras   ( Numeric\Extras.hs, interpreted )

ByteCodeLink: can't find label
During interactive linking, GHCi couldn't find the following symbol:
  expm1
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
  glasgow-haskell-bugs@haskell.org

@expipiplus1
Copy link

I notice that the package erf-2.0.0.0 builds and runs in ghci without a problem. Could this be due to erf being present here https://github.com/ghc/ghc/blob/master/rts/Linker.c#L558 and expm1 not being in that list?
It seems as though https://github.com/patperry/hs-ieee754 ran into a similar problem with libm on Windows and now ships their own C implementations of some of the functionality.

@mantkiew
Copy link

I have just ran into this today with LTS-5.3, running stack repl in MSYS:

$ stack repl
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
Ok, modules loaded: none.
Prelude> :m + Numeric.Extras
Prelude Numeric.Extras> 50.0 `fmod` 25.0
ghc.exe: unable to load package `numeric-extras-0.1'

@ekmett
Copy link
Owner

ekmett commented Feb 17, 2016

numeric-extras and windows support have had a rather checkered history

On Wed, Feb 17, 2016 at 5:05 PM, Michał Antkiewicz <notifications@github.com

wrote:

I have just ran into this today with LTS-5.3, running stack repl in MSYS:

$ stack repl
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Ok, modules loaded: none.
Prelude> :m + Numeric.Extras
Prelude Numeric.Extras> 50.0 fmod 25.0
ghc.exe: unable to load package `numeric-extras-0.1'


Reply to this email directly or view it on GitHub
#1 (comment)
.

@RyanGlScott
Copy link
Contributor

GHC 8.0 has an improved runtime linker which fixes this issue:

$ ghci
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from C:\Users\RyanGlScott\AppData\Roaming\ghc\ghci.conf
> import Numeric.Extras
> 50.0 `fmod` 25.0
0.0

@RyanGlScott
Copy link
Contributor

For older versions of Windows, it might be possible to guard the implementations of fmod et al. behind a __USE_FFI__ flag à la log-domain. But I don't know off the top of my head how to implement all of the FFI-related functions in numeric-extras in pure Haskell.

Otherwise, we could just say that GHCs older than 8.0 aren't supported on Windows, I suppose.

@ekmett
Copy link
Owner

ekmett commented Mar 10, 2017

I suppose we could just add the check and not build on old GHCs on Windows. It has never worked anyways, so nobody will be caught out in the cold.

@RyanGlScott
Copy link
Contributor

That seems reasonable. I've opened #6, which implements this suggestion.

@ekmett ekmett closed this as completed in #6 Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants