[GHC] #13113: Runtime linker errors with CSFML on Windows
GHC
ghc-devs at haskell.org
Thu Jan 12 17:43:13 UTC 2017
#13113: Runtime linker errors with CSFML on Windows
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Runtime | Version: 8.0.2
System (Linker) |
Keywords: | Operating System: Windows
Architecture: | Type of failure: GHCi crash
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Another day, another runtime linker bug on Windows. This time, it's from
the CSFML library (written in C++). I observed this when trying to load
the [http://hackage.haskell.org/package/SFML SFML] Haskell library in
GHCi.
To install CSFML in MSYS2:
{{{
pacman -S mingw-w64-x86_64-csfml
}}}
Here's the Haskell code I'm using:
{{{#!hs
module Main (main) where
import Foreign.Ptr
newtype CircleShape = CircleShape (Ptr CircleShape)
deriving Show
foreign import ccall unsafe "sfCircleShape_create"
sfCircleShape_create :: IO CircleShape
foreign import ccall unsafe "sfCircleShape_copy"
sfCircleShape_copy :: CircleShape -> IO CircleShape
main :: IO ()
main = do
putStrLn "----------------------"
cs1 <- sfCircleShape_create
print cs1
cs2 <- sfCircleShape_copy cs1
print cs2
putStrLn "----------------------"
}}}
Compiling it with `ghc -lcsfml-graphics SFML.hs` on GHC 8.0.2 and HEAD
seems to work fine. But if you run it in GHCi, it breaks.
With GHCi 8.0.2:
{{{
$ ghci -lcsfml-graphics SFML.hs
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
ghc.exe: addDLL: csfml-graphics-2.dll (Win32 error 127): The specified
procedure could not be found.
ghc.exe: Could not load `csfml-graphics-2.dll'. Reason: addDLL: could not
load DLL
Loaded GHCi configuration from
C:\Users\RyanGlScott\AppData\Roaming\ghc\ghci.conf
[1 of 1] Compiling Main ( SFML.hs, interpreted )
Ok, modules loaded: Main.
> main
ByteCodeLink: can't find label
During interactive linking, GHCi couldn't find the following symbol:
sfCircleShape_create
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 at haskell.org
}}}
With GHC HEAD:
{{{
$ ..\..\..\Software\ghc\inplace\bin\ghci -lcsfml-graphics SFML.hs
GHCi, version 8.1.20170108: http://www.haskell.org/ghc/ :? for help
ghc-stage2.exe: addDLL: csfml-graphics-2.dll (Win32 error 127): The
specified procedure could not be found.
ghc-stage2.exe: Could not load `csfml-graphics-2.dll'. Reason: addDLL:
could not load DLL
Loaded GHCi configuration from
C:\Users\RyanGlScott\AppData\Roaming\ghc\ghci.conf
Ok, modules loaded: Main (SFML.o).
> main
ghc-stage2.exe: C:\Users\RyanGlScott\Documents\Hacking\Haskell\SFML.o:
unknown symbol `sfCircleShape_create'
}}}
I also get the same error with Phab:D2941 (#13082) applied.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13113>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list