[Haskell-cafe] crash in hs_init_ghc

A.M. agentm at themactionfaction.com
Fri Jun 29 05:18:42 CEST 2012


Hello,

I am trying to load a Haskell module in a C program as a 
dynamically-loaded plugin via FFI.

I am able to compile and link successfully, but I find the following crash.

#0  0x00007f16147da9e7 in ?? () from /usr/lib/ghc/libHSrts_debug-ghc7.4.1.so
#1  0x00007f16147e0970 in hs_init_ghc () from 
/usr/lib/ghc/libHSrts_debug-ghc7.4.1.so
#2  0x00007f16147e0795 in hs_init () from 
/usr/lib/ghc/libHSrts_debug-ghc7.4.1.so
#3  0x00007f1614a44ece in plhaskell_plmain (fcinfo=<optimized out>) at 
plhaskellc.c:26
#4  0x0000000000565e1a in ExecMakeFunctionResult ()
#5  0x00000000005682f2 in ExecProject ()
#6  0x000000000057849a in ExecResult ()
#7  0x0000000000561648 in ExecProcNode ()
#8  0x000000000055ea5a in standard_ExecutorRun ()
#9  0x0000000000628577 in PortalRunSelect ()
#10 0x0000000000629900 in PortalRun ()
#11 0x0000000000625bec in PostgresMain ()
#12 0x00000000005eb429 in ServerLoop ()
#13 0x00000000005ebd3c in PostmasterMain ()
#14 0x0000000000453d20 in main ()

In the trace above, one can see that I am linking against the debugging 
Haskell runtime. hs_init_ghc is called with dual NULL arguments. Is that 
cause for concern?

I noticed that RtsStartup.c does some questionable stuff in a module 
context right away, such as calling "setlocale". Are there other things 
I need to watch out for?

Do I need to build ghc from source in order to debug this further? Any 
advice would be appreciated. This is on Ubuntu 12.04.

Cheers,
M



More information about the Haskell-Cafe mailing list