Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error installing accelerate-0.13.0.5 using ghc-7.6.3 on OSX #105

Closed
rampion opened this Issue · 10 comments

3 participants

@rampion

I'm having problems installing accelerate-0.13.0.5 using ghc-7.6.3 on OSX.

% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
% cabal --version
cabal-install version 0.14.0
using version 1.14.0 of the Cabal library
% cabal install accelerate-0.13.0.5
Resolving dependencies...
[1 of 1] Compiling Main             ( /var/folders/um/uml4q8NGEqerN2C2Wn4fGU+++TM/-Tmp-/accelerate-0.13.0.5-11834/accelerate-0.13.0.5/Setup.hs, /var/folders/um/uml4q8NGEqerN2C2Wn4fGU+++TM/-Tmp-/accelerate-0.13.0.5-11834/accelerate-0.13
.0.5/dist/setup/Main.o )
Linking /var/folders/um/uml4q8NGEqerN2C2Wn4fGU+++TM/-Tmp-/accelerate-0.13.0.5-11834/accelerate-0.13.0.5/dist/setup/setup ...Configuring accelerate-0.13.0.5...
checking size of CLong... 8
checking size of CULong... 
configure: creating ./config.status
config.status: creating accelerate.buildinfo
Building accelerate-0.13.0.5...
Preprocessing library accelerate-0.13.0.5...
[ 1 of 30] Compiling Data.Array.Accelerate.Debug ( Data/Array/Accelerate/Debug.hs, dist/build/Data/Array/Accelerate/Debug.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package text-0.11.3.1 ... linking ... done.
Loading package hashable-1.1.2.5 ... linking ... done.
Loading package primitive-0.5.0.1 ... linking ... done.
Loading package vector-0.10.0.1 ... linking ... done.
Loading package hashtables-1.1.0.2 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package fclabels-1.1.7.1 ... linking ... done.
[ 2 of 30] Compiling Data.Array.Accelerate.Internal.Check ( Data/Array/Accelerate/Internal/Check.hs, dist/build/Data/Array/Accelerate/Internal/Check.o )
[ 3 of 30] Compiling Data.Array.Accelerate.Type ( Data/Array/Accelerate/Type.hs, dist/build/Data/Array/Accelerate/Type.o )
[ 4 of 30] Compiling Data.Array.Accelerate.Array.Representation ( Data/Array/Accelerate/Array/Representation.hs, dist/build/Data/Array/Accelerate/Array/Representation.o )
[ 5 of 30] Compiling Data.Array.Accelerate.Array.Data ( Data/Array/Accelerate/Array/Data.hs, dist/build/Data/Array/Accelerate/Array/Data.o )

Data/Array/Accelerate/Array/Data.hs:104:26:
    Kind mis-match
    The first argument of `GArrayData' should have kind `* -> *',
    but `ba' has kind `*'
    In the type `ba'
    In the data instance declaration for `GArrayData'

Data/Array/Accelerate/Array/Data.hs:360:27:
    Expecting one more argument to `Ptr'
    In the type `Ptr'
    In the type instance declaration for `ArrayPtrs'
    In the instance declaration for `ArrayElt CULong'
cabal: Error: some packages failed to install:
accelerate-0.13.0.5 failed during the building phase. The exception was:
ExitFailure 1
@rampion

Same errors using cabal-1.16.0.2

@tmcdonell
Collaborator

Looks like it is somehow failing to figure out the size of a CULong...

checking size of CLong... 8
checking size of CULong... 

What do you get when you run this? (in ghci should be fine)

import Foreign
import Foreign.C
putStr . show $ sizeOf (undefined :: CULong)
@rampion

From GHCi it seems to work fine:

% ghci
GHCi, version 7.6.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.
ghci> import Foreign
ghci> import Foreign.C
ghci> sizeOf (undefined :: CULong)
8

Running it in a script seems to work fine, too:

% cat temp.hs
import Foreign
import Foreign.C
main = putStr . show $ sizeOf (undefined :: CULong)
% /usr/bin/ghc -w -ignore-dot-ghci temp.hs && ./temp
8

However, I tried running the command that configure was using to check the size of CULong and got a segfault:

% grep -A 5 "checking size of CULong\\.\\.\\." configure
$as_echo_n "checking size of CULong... " >&6; }

    sizeof_hs_CULong=`$GHC -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "putStr . show $ sizeOf (undefined::CULong)"`
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sizeof_hs_CULong" >&5
$as_echo "$sizeof_hs_CULong" >&6; }

% grep "GHC=" config.log
ac_cv_path_GHC=/usr/bin/ghc
GHC='/usr/bin/ghc'
% /usr/bin/ghc -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "putStr . show $ sizeOf (undefined::CULong)"
zsh: segmentation fault  /usr/bin/ghc -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e
% echo $?
139

For sanity, I also tried checking the size of CLong, which succeeded in the configure, but trying to reproduce that success on the command line also yielded a segfault. As did Int.

% /usr/bin/ghc -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "putStr . show $ sizeOf (undefined::CLong)"
zsh: segmentation fault  /usr/bin/ghc -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e
% /usr/bin/ghc -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "putStr . show $ sizeOf (undefined::Int)"
zsh: segmentation fault  /usr/bin/ghc -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e

So this segfault might be a red herring, and unrelated to why it's failing in configure. I'll keep working to see if I can recreate the behaviour of the configure script.

@rampion

Ok, I'm getting some freaky behaviour now. If I run in /bin/sh, I can recreate the success for sizeOf (undefined::CLong)... sometimes:

sh-3.2$ /usr/bin/ghc -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "putStrLn . show $ sizeOf (undefined::CLong)"
8
sh-3.2$ /usr/bin/ghc -w -ignore-dot-ghci -e "import Foreign" -e "import Foreign.C" -e "putStrLn . show $ sizeOf (undefined::CLong)"
Segmentation fault
sh-3.2$ echo $?
139

I just ran the same command twice in a row - nothing fancy. I can get the same behaviour for CULong or Int.

@tmcdonell
Collaborator

That... is odd. I'll see if there is a better (or at least different) way of doing this. I just came across GHC.Constants which looks promising, so will try using that instead.

@rampion

Running it in gdb, I can recreate the sometimes segfault:

% cd /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3
% gdb ghc
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .... done

warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(darwin64.o)" - no debug information available for "/var/folders/9z/yntzqjqn1j95xbpb6dr3qbww0000gn/T//ccr2b8iU.s".


warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(ffi64.o)" - no debug information available for "../src/x86/ffi64.c".


warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(prep_cif.o)" - no debug information available for "../src/prep_cif.c".


warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(types.o)" - no debug information available for "../src/types.c".


(gdb) run -B. -e "import Foreign" -e "import Foreign.C" -e "putStrLn . show $ sizeOf (undefined :: Int)"
Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e "import Foreign" -e "import Foreign.C" -e "putStrLn . show $ sizeOf (undefined :: Int)"
Reading symbols for shared libraries ++++. done
8

Program exited normally.
(gdb) run -B. -e "import Foreign" -e "import Foreign.C" -e "putStrLn . show $ sizeOf (undefined :: Int)"
Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e "import Foreign" -e "import Foreign.C" -e "putStrLn . show $ sizeOf (undefined :: Int)"
Reading symbols for shared libraries + done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000000b0d0b440
[Switching to process 17064 thread 0x2003]
0x00000001b0d10c44 in stg_ap_v_fast ()
(gdb) where
#0  0x00000001b0d10c44 in stg_ap_v_fast ()
#1  0x0000000000000000 in ?? ()
(gdb)

Those warnings make me wonder who ian is. I've never had a user with that short name on this computer, so I'm guessing they're whoever built the GHC-7.6.3 package I downloaded from haskell.org.

This is obviously long past being a problem with accelerate, so I should migrate further investigation elsewhere. At this point I suspect a bad build of GHC.

@tmcdonell
Collaborator

Wow, yes --- I'd suggest to submit the bug report to GHC.
Thanks very much for your efforts in tracking this down!

@mchakravarty

@rampion I assume ian is Ian Lynagh who, until very recently, was the build engineer for GHC.

Instead of the GHC package, you might want try to install the most recent Haskell Platform. It also includes GHC 7.6.3, and I successfully compiled Accelerate on OS X with it.

@rampion

@tmcdonell Thanks, I filed the bug on GHC's trac.

@mchakravarty I did just install the most recent Haskell Platform (2013.2.0.0) and observed the same behaviour. Since the segfault is intermittent, I have no problem believing that there are good odds of accelerate installing correctly :) (and if not, it's certainly not their fault).

In the short term, I'll probably just hardcode the CULong and CLong sizes in my local copy of the configure file, so I can just install accelerate, quit yak-shaving, and get back to what I was actually doing, which was reading Parallel and Concurrent Programming in Haskell.

@tmcdonell
Collaborator

I think this is making progress on the GHC bug tracker and indicates there is nothing we could do at this end, so will close this for now. Feel free to reopen / create a new if you have further problems, otherwise good luck with Parallel & Concurrent Haskell!

@tmcdonell tmcdonell closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.