Skip to content

ghc -shared broken

Lennart reports that ghc -shared is broken:

$ cat Foo.hs
{-# LANGUAGE ForeignFunctionInterface #-}
module Foo where

f :: Int -> Int
f x = x+1

foreign export ccall f :: Int -> Int

$ ghc -shared Foo.hs
Foo.o:fake:(.text+0x21): undefined reference to `stg_INTLIKE_closure'
Foo.o:fake:(.text+0x28): undefined reference to `stg_ap_pp_info'
Foo_stub.o:Foo_stub.c:(.text+0x9): undefined reference to `rts_lock'
Foo_stub.o:Foo_stub.c:(.text+0x1a): undefined reference to `rts_mkInt'
Foo_stub.o:Foo_stub.c:(.text+0x2e): undefined reference to `rts_apply'
Foo_stub.o:Foo_stub.c:(.text+0x42): undefined reference to `rts_apply'
Foo_stub.o:Foo_stub.c:(.text+0x55): undefined reference to `rts_evalIO'
Foo_stub.o:Foo_stub.c:(.text+0x67): undefined reference to
`rts_checkSchedStatus'
Foo_stub.o:Foo_stub.c:(.text+0x72): undefined reference to `rts_getInt'
Foo_stub.o:Foo_stub.c:(.text+0x7c): undefined reference to `rts_unlock'
Foo_stub.o:Foo_stub.c:(.text+0x97): undefined reference to `getStablePtr'
.....
Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information