hmatrix installation error on OS X 10.9.4 - haskell

Is anyone successfully using hmatrix-0.16.0.4 on OSX 10.9?
I get the following error:
Prelude> import Numeric.LinearAlgebra
Prelude Numeric.LinearAlgebra> let m = (3><4) [1..] :: Matrix Double
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package primitive-0.5.0.1 ... linking ... done.
Loading package vector-0.10.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package binary-0.5.1.1 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package random-1.0.1.1 ... linking ... done.
Loading package split-0.2.2 ... linking ... done.
Loading package storable-complex-0.2.1 ... linking ... done.
Loading package hmatrix-0.16.0.4 ... linking ... <interactive>:
lookupSymbol failed in relocateSection (relocate external)
/Users/tba/.cabal/lib/x86_64-osx-ghc-7.6.3/hmatrix-0.16.0.4/libHShmatrix-0.16.0.4.a: unknown symbol `___ieee_divdc3'
ghc: unable to load package `hmatrix-0.16.0.4'
I installed using brew install gsl && cabal install hmatrix.
My ghc version is 7.6.3.
I suspect it should be built with gcc (instead of clang) -- how can I change this?
(GitHub ticket)

I fixed the issue by installing ghc 7.8. It's unfortunate that homebrew's "haskell-platform" is so out of date.

Related

GHCi interactive linking error during happstack-server installation

I’m trying to build a project in a cabal sandbox that depends on happstack-server, but this package fails to build. Here is the content of .cabal-sandbox/logs/happstack-server-7.4.6.1.log:
Building happstack-server-7.4.6.1...
Preprocessing library happstack-server-7.4.6.1...
[ 1 of 38] Compiling Happstack.Server.Internal.LazyLiner ( src/Happstack/Server/Internal/LazyLiner.hs, dist/dist-sandbox-925bc8f2/build/Happstack/Server/Internal/LazyLiner.o )
[ 2 of 38] Compiling Happstack.Server.Internal.SocketTH ( src/Happstack/Server/Internal/SocketTH.hs, dist/dist-sandbox-925bc8f2/build/Happstack/Server/Internal/SocketTH.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package bytestring-0.10.4.0 ... linking ... done.
Loading package zlib-0.6.1.1 ... linking ... done.
Loading package xhtml-3000.2.1 ... linking ... done.
Loading package utf8-string-0.3.8 ... linking ... done.
Loading package old-locale-1.0.0.6 ... linking ... done.
Loading package old-time-1.1.0.2 ... linking ... done.
Loading package time-1.4.2 ... linking ... done.
Loading package time-compat-0.1.0.3 ... linking ... done.
Loading package stm-2.4.4.1 ... linking ... done.
Loading package threads-0.5.1.3 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package binary-0.8.2.1 ... linking ... done.
Loading package text-1.2.2.0 ... linking ... done.
Loading package system-filepath-0.4.13.4 ... linking ... done.
Loading package syb-0.6 ... linking ... done.
Loading package unix-2.7.0.1 ... linking ... done.
Loading package network-2.6.2.1 ... linking ... done.
Loading package sendfile-0.7.9 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.3.1 ... linking ... done.
Loading package parsec-3.1.9 ... linking ... done.
Loading package network-uri-2.6.0.3 ... linking ... done.
Loading package transformers-compat-0.5.1.4 ... linking ... done.
Loading package transformers-base-0.4.4 ... linking ... done.
Loading package monad-control-1.0.0.5 ... linking ... done.
Loading package html-1.0.1.2 ... linking ... done.
Loading package filepath-1.3.0.2 ... linking ... done.
Loading package directory-1.2.1.0 ... linking ... done.
Loading package process-1.2.0.0 ... linking ... done.
Loading package hslogger-1.2.9 ... linking ... done.
Loading package extensible-exceptions-0.1.1.4 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package exceptions-0.8.2.1 ... linking ... done.
Loading package blaze-builder-0.4.0.1 ... linking ... done.
Loading package blaze-markup-0.7.0.3 ... linking ... done.
Loading package blaze-html-0.8.1.1 ... linking ... done.
Loading package base64-bytestring-1.0.0.1 ... linking ... done.
ByteCodeLink.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
templatezmhaskell_LanguageziHaskellziTHziSyntax_zdfMonadQzuzdczgzgze_closure
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
How can I fix this?
▶ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4
▶ cabal --version
cabal-install version 1.18.1.0
using version 1.18.1.5 of the Cabal library
The problem was due to an older version of template-haskell installed by my OS package manager. This version was taken into account even though I work in a sandbox. I solved the issue by using cabal install --shadow-installed-packages.

Trying Haskells plotList command, and nothing is being shown

So basically i fire up the gchi import the graphics library and then go and do this.
Prelude Graphics.Gnuplot.Simple> plotList [] [(1, 1), (2, 2), (3, 3)]
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package filepath-1.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package unix-2.6.0.1 ... linking ... done.
Loading package directory-1.2.0.1 ... linking ... done.
Loading package process-1.1.0.2 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package data-accessor-0.2.2.6 ... linking ... done.
Loading package data-accessor-transformers-0.2.1.6 ... linking ... done.
Loading package exceptions-0.6.1 ... linking ... done.
Loading package temporary-1.2.0.3 ... linking ... done.
Loading package utility-ht-0.0.10 ... linking ... done.
Loading package gnuplot-0.5.2.2 ... linking ... done.
All this stuff happens, but no image is shown? Do i have to do some sort of main function call to display or how would i go about actually seeing a picture. Thanks for the advice.
Make sure you have the gnuplot binary installed, and not only the Haskell gnuplot package from hackage. The latter doesn't really check whether you have the necessary binary installed. Depending on your platform, it simply invokes a shell command or uses a pipe and doesn't look for the return type, therefore you don't even get an error.
You can check whether you have gnuplot installed via
$ gnuplot --version
If this doesn't give you a version, you either have yet to install gnuplot, or gnuplot isn't in your path.

ghci, linking failed on different libraries

I try to use the Graphalyze library, installed by the standard way cabal install graphalyze. When I import any modules from this package, I face with a trouble.
My project normally loading into WinGHCi, but when I try to use any function, I see:
Loading package bktrees-0.3.1 ... linking ... done.
Loading package filepath-1.3.0.0 ... linking ... done.
Loading package old-time-1.1.0.0 ... linking ... done.
Loading package directory-1.1.0.2 ... linking ... done.
Loading package colour-2.3.3 ... linking ... done.
Loading package dlist-0.5 ... linking ... done.
Loading package polyparse-1.8 ... linking ... done.
Loading package process-1.1.0.1 ... linking ... done.
Loading package temporary-1.1.2.4 ... linking ... done.
Loading package wl-pprint-text-1.1.0.0 ... linking ... done.
Loading package graphviz-2999.16.0.0 ... linking ... done.
Loading package network-2.3.1.0 ... linking ... done.
Loading package HTTP-4000.2.5 ... linking ... done.
Loading package base64-bytestring-1.0.0.1 ... linking ... done.
Loading package blaze-builder-0.3.1.1 ... linking ... done.
Loading package blaze-markup-0.5.1.5 ... linking ... done.
Loading package blaze-html-0.5.1.3 ... linking ... done.
Loading package List-0.5.1 ... linking ... done.
Loading package extensible-exceptions-0.1.1.4 ... linking ... done.
Loading package utf8-string-0.3.7 ... linking ... done.
Loading package hexpat-0.20.3 ... linking ... done.
Loading package syb-0.3.7 ... linking ... done.
Loading package hs-bibutils-5.0 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package json-0.7 ... linking ... done.
Loading package pandoc-types-1.10 ... linking ... done.
Loading package citeproc-hs-0.3.8 ... linking ... done.
Loading package data-default-class-0.0.1 ... linking ... done.
Loading package data-default-instances-base-0.0.1 ... linking ... done.
Loading package data-default-instances-containers-0.0.1 ... linking ... done.
Loading package data-default-instances-dlist-0.0.1 ... linking ... done.
Loading package data-default-instances-old-locale-0.0.1 ... linking ... done.
Loading package data-default-0.5.3 ... linking ... done.
Loading package regex-base-0.93.2 ... linking ... done.
Loading package regex-pcre-builtin-0.94.4.7.8.31 ... linking ... ghc: unable to load package `regex-pcre-builtin-0.94.4.7.8.31'
If I try again without reloading, I see only one string, but on differ library!:
Loading package bktrees-0.3.1 ... linking ... ghc: unable to load package `bktrees-0.3.1'
What is the problem?
I use WinGHCi 1.0.6 and ghc version 7.4.2, in ghci i have the same problem.
Upd: runghc results `HSregex-pcre-builtin-0.94.4.7.8.31.o: unknown symbol __imp__pcre _compile'

regex-pcre: What imports do I need?

I installed my first Haskell package with cabal:
$ cabal install regex-pcre
Could someone post a simple example using pcre regexes so I can figure out what I am supposed to import?
Okay, I figured it out. The module you need is Text.Regex.PCRE. For POSIX regexes, it's Text.Regex.Posix. Here is an example:
ghci>:m +Text.Regex.PCRE
ghci>"heeeee" =~ "hee|he*" :: [[String]]
Loading package array-0.4.0.0 ... linking ... done.
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package regex-base-0.93.2 ... linking ... done.
Loading package regex-pcre-0.94.4 ... linking ... done.
[["hee"]]
ghci>:m -Text.Regex.PCRE
ghci>:m +Text.Regex.Posix
ghci>"heeeee" =~ "hee|he*" :: [[String]]
Loading package regex-posix-0.95.2 ... linking ... done.
[["heeeee"]]

problem running wxHaskell (Windows)

The page: (http://en.wikibooks.org/wiki/Haskell/GUI) describes that to run wx code, one can install wx and then one must "register wxHaskell with GHC" - but I think the binary installer of wxHaskell (http://wxhaskell.sourceforge.net/download.html) does that automatically?
I installed wx-config, and then wxPack, and wxHaskell. and then did cabal install of wx and wxcore. I am running some wx demos from Leksah, which seem mostly good - but they had some weird errors (I found an alleged solution to that: "wxhaskell-labels-cant-display-full-text"), but I wanted to try some things just from GHCi.
I try to run their simple demos, and the the errors:
D:\csPlangs\Haskell\play>ghci -package wx wxGui1.hs
GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.2 ... linking ... done.
Loading package stm-2.2.0.1 ... linking ... done.
Loading package bytestring-0.9.1.10 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package Win32-2.2.0.1 ... linking ... done.
Loading package filepath-1.2.0.0 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.6 ... linking ... done.
Loading package directory-1.1.0.0 ... linking ... done.
Loading package transformers-0.2.2.0 ... linking ... done.
Loading package mtl-2.0.1.0 ... linking ... done.
Loading package parsec-3.1.1 ... linking ... done.
Loading package time-1.2.0.3 ... linking ... done.
Loading package wxdirect-0.12.1.4 ... linking ... done.
Loading package wxcore-0.12.1.7 ... ghc.exe: stdc++: The specified module could
not be found.
<command line>: can't load .so/.DLL for: stdc++ (addDLL: could not load DLL)
And also the [interesting] error:
*Main> q
<interactive>:1:1: Not in scope: `q'
*Main>
ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.0.3 for i386-unknown-mingw32):
thread blocked indefinitely in an MVar operation
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
It appears to be a known problem with the combination of wxHaskell, GHCi, and Windows. From http://www.haskell.org/haskellwiki/WxHaskell/Quick_start
On Windows 7, ghci will complain "can't load .so/.DLL for: std c++ ...". But ghc --make Hello.hs; Hello.exe on the command line works well.
So, you can compile your code. You just can't run it through the interpreter.

Resources