#3604: Use of template-haskell is broken with shared libraries
-----------------------------+----------------------------------------------
Reporter:  guest             |          Owner:                  
    Type:  bug               |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:  6.12.0 RC1        |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 Consider the following program:

 TH.hs:
 {{{
 {-# LANGUAGE TemplateHaskell #-}
 module TH where

 import Language.Haskell.TH

 spliceMe = [| (\xs -> tail xs ++ init xs) |]
 }}}

 Library.hs
 {{{
 {-# LANGUAGE TemplateHaskell #-}
 module Library where

 import TH

 main = print ($(spliceMe) [1, 2])
 }}}

 Build it like so:

 {{{
 ghc --make -package-name foo-0.2.3 -hide-all-packages -fbuilding-cabal-
 package -no-user-package-conf -i -idist/build -i. -idist/build/autogen
 -Idist/build/a
 utogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h
 -odir dist/build -hidir dist/build -stubdir dist/build -package-id
 base-4.2.0.0-e0460a0a4effe0aca049da0e
 12eab4d3 -package-id template-
 haskell-2.4.0.0-fa9ea4aecb54a2910620fe9afd9f40f1 -O Library -dynamic
 -hisuf dyn_hi -osuf dyn_o -fPIC
 }}}

 And observe the wonderful error:

 {{{
 Creating dist/build (and its parents)
 Creating dist/build/autogen (and its parents)
 Preprocessing library foo-0.2.3...
 Building foo-0.2.3...
 Building library...
 Creating dist/build (and its parents)
 /home/a1333478/bin/ghc --make -package-name foo-0.2.3 -hide-all-packages
 -fbuilding-cabal-package -no-user-package-conf -i -idist/build -i.
 -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include
 -optPdist/build/autogen/cabal_macros.h -odir dist/build -hidir dist/build
 -stubdir dist/build -package-id
 base-4.2.0.0-e0460a0a4effe0aca049da0e12eab4d3 -package-id template-
 haskell-2.4.0.0-fa9ea4aecb54a2910620fe9afd9f40f1 -O Library
 /home/a1333478/bin/ghc --make -package-name foo-0.2.3 -hide-all-packages
 -fbuilding-cabal-package -no-user-package-conf -i -idist/build -i.
 -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include
 -optPdist/build/autogen/cabal_macros.h -odir dist/build -hidir dist/build
 -stubdir dist/build -package-id
 base-4.2.0.0-e0460a0a4effe0aca049da0e12eab4d3 -package-id template-
 haskell-2.4.0.0-fa9ea4aecb54a2910620fe9afd9f40f1 -O Library -dynamic
 -hisuf dyn_hi -osuf dyn_o -fPIC
 [2 of 2] Compiling Library          ( Library.hs, dist/build/Library.dyn_o
 )
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package array-0.3.0.0 ... linking ... done.
 Loading package containers-0.3.0.0 ... linking ... done.
 Loading package pretty-1.0.1.1 ... linking ... done.
 Loading package template-haskell ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 ghc-stage2: dist/build/TH.dyn_o: unknown symbol
 `__stginit_base_Prelude_dyn'
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3604>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to