[GHC] #12496: GHCi reports unknown symbols in Win32 when linking C and C++ libs

GHC ghc-devs at haskell.org
Wed Aug 17 08:51:14 UTC 2016


#12496: GHCi reports unknown symbols in Win32 when linking C and C++ libs
------------------------------+---------------------------------
           Reporter:  pl      |             Owner:
               Type:  bug     |            Status:  new
           Priority:  normal  |         Milestone:
          Component:  GHCi    |           Version:  8.0.1
           Keywords:          |  Operating System:  Windows
       Architecture:  x86     |   Type of failure:  None/Unknown
          Test Case:          |        Blocked By:
           Blocking:          |   Related Tickets:
Differential Rev(s):          |         Wiki Page:
------------------------------+---------------------------------
 GHCi (win32, v8.0.1) gives strange unknown symbols when being run using a
 library that interfaces code written in C or C++. Compiled code runs fine.

 As an example I use the eigen-2.1.6 package from hackage. However, it
 should be noted that I get a similar error message when trying to link a
 package that uses libgsl (gsl has been compiled with the mingw-gcc that
 ships with haskell-platform).

 When I compile the little script from the eigen-manual on hackage
 {{{#!hs
 module Main where
   import Data.Eigen.Matrix
   import Data.Eigen.LA

   main = do
     let
         a :: MatrixXd
         a = fromList [[1,2,3], [4,5,6], [7,8,10]]
         b = fromList [[3],[3],[4]]
         x = solve ColPivHouseholderQR a b
     putStrLn "Here is the matrix A:" >> print a
     putStrLn "Here is the vector b:" >> print b
     putStrLn "The solution is:" >> print x
 }}}
 I get (as expected):
 {{{
 Here is the matrix A:
 Matrix 3x3
 1.0     2.0     3.0
 4.0     5.0     6.0
 7.0     8.0     10.0

 Here is the vector b:
 Matrix 3x1
 3.0
 3.0
 4.0

 The solution is:
 Matrix 3x1
 -2.0
 1.0000000000000016
 0.9999999999999988
 }}}

 However, when I try to run it in GHCi I get
 {{{
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( test.hs, interpreted )
 Ok, modules loaded: Main.
 *Main> main
 ghc.exe: C:/Program Files (x86)/Haskell
 Platform/8.0.1/mingw/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libstdc++.a:
 unknown
 symbol `___emutls_get_address'

 ghc.exe: Could not on-demand load symbol '___cxa_get_globals'

 ghc.exe: C:/Program Files (x86)/Haskell
 Platform/8.0.1/mingw/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libstdc++.a:
 unknown
 symbol `___cxa_get_globals'

 ghc.exe: Could not on-demand load symbol '___cxa_begin_catch'

 ghc.exe: D:\Users\U439644\AppData\Roaming\cabal\i386-windows-
 ghc-8.0.1\eigen-2.1.6-6ZlfU8NIal9qgw3j5GclW\HSeigen-2.1.6-6
 ZlfU8NIal9qgw3j5GclW.o: unknown symbol `___cxa_begin_catch'

 ghc.exe: unable to load package `eigen-2.1.6'
 }}}

 I tried the same on OS X using GHCi v8.0.1. There everything works as
 expected.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12496>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list