Unknown symbol `__dso_handle' with Template Haskell and wxHaskell

Hi, I am using Template Haskell and wxHaskell [1]. When Graphics.UI.WX is loaded during THs code generation, I get the following error:
... Loading package wxdirect-0.12.1.3 ... linking ... done. ghc: /usr/local/lib/wxcore-0.12.1.6/ghc-6.12.3/HSwxcore-0.12.1.6.o: unknown symbol `__dso_handle' Loading package wxcore-0.12.1.6 ... linking ... ghc: unable to load package `wxcore-0.12.1.6'
System stats: ghc-6.12.3 template-haskell-2.4.0.1 wx-0.12.1.6 Regards, Alex [1] Example: -- Test.hs ---------------------- {-# LANGUAGE TemplateHaskell #-} module Test2 where import Language.Haskell.TH import qualified Graphics.UI.WX as WX foo :: Q [Dec] foo = do info <- reify ''WX.Color runIO $ print info return [] -- Main.hs ---------------------- {-# LANGUAGE TemplateHaskell #-} module Main where import Test $(foo)

We had this problem with a binding to a C++ library (through a C
wrapper). GHCi and cabal didn't work, but ghc --make did. How are you
compiling exactly when you get this error? This is somehow related to
TH, without it, at least cabal also works. I'm not sure about GHCi.
There's also a relevant bug in the GHC trac, but I can't seem to find
it now.
Erik
On Sat, Dec 25, 2010 at 18:41, Alexander Bau
Hi,
I am using Template Haskell and wxHaskell [1]. When Graphics.UI.WX is loaded during THs code generation, I get the following error:
... Loading package wxdirect-0.12.1.3 ... linking ... done. ghc: /usr/local/lib/wxcore-0.12.1.6/ghc-6.12.3/HSwxcore-0.12.1.6.o: unknown symbol `__dso_handle' Loading package wxcore-0.12.1.6 ... linking ... ghc: unable to load package `wxcore-0.12.1.6'
System stats: ghc-6.12.3 template-haskell-2.4.0.1 wx-0.12.1.6
Regards,
Alex
[1] Example:
-- Test.hs ----------------------
{-# LANGUAGE TemplateHaskell #-} module Test2 where
import Language.Haskell.TH import qualified Graphics.UI.WX as WX
foo :: Q [Dec] foo = do info <- reify ''WX.Color runIO $ print info return []
-- Main.hs ----------------------
{-# LANGUAGE TemplateHaskell #-} module Main where
import Test
$(foo)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

GHCi and cabal didn't work, but ghc --make did.
Neither GHCi, cabal nor ghc --make works. I refactored my code, so that all TH related stuff does not depend on wxHaskell, i.e. wxHaskell doesn't need to be loaded during THs code generation. Then ghc --make works fine. But when using cabal, the same error occurs. It seems to me that TH (when used with cabal) loads all packages specified at "Build-Depends" in your cabal file (whether they are needed or not). ghc --make instead just loads all packages, that are really needed for THs code generation. But this is just a workaround and does not explain why TH does not work with wxHaskell. I think this is somehow related to the inability to use wxHaskell inside of GHCi [1], because then the same error occurs. [1] http://comments.gmane.org/ gmane.comp.lang.haskell.wxhaskell.general/923

It's a side effect of dynamic linking, or, lack of support for it in ghci. You can't work around it. I've tried.
Sent from my iPad
On Dec 27, 2010, at 9:14 PM, Alexander Bau
GHCi and cabal didn't work, but ghc --make did.
Neither GHCi, cabal nor ghc --make works.
I refactored my code, so that all TH related stuff does not depend on wxHaskell, i.e. wxHaskell doesn't need to be loaded during THs code generation. Then ghc --make works fine. But when using cabal, the same error occurs.
It seems to me that TH (when used with cabal) loads all packages specified at "Build-Depends" in your cabal file (whether they are needed or not). ghc --make instead just loads all packages, that are really needed for THs code generation.
But this is just a workaround and does not explain why TH does not work with wxHaskell. I think this is somehow related to the inability to use wxHaskell inside of GHCi [1], because then the same error occurs.
[1] http://comments.gmane.org/ gmane.comp.lang.haskell.wxhaskell.general/923
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
Alexander Bau
-
Erik Hesselink
-
Scott Michel