static linking

Simon Marlow marlowsd at gmail.com
Wed May 28 05:27:44 EDT 2008


Peter Gammie wrote:
> Hello,
> 
> Further on my static linking woes:
> 
> debian ~$ ghc --version
> The Glorious Glasgow Haskell Compilation System, version 6.8.2
> -debian ~$ cat T.hs
> main :: IO ()
> main = putStrLn "Hello world"
> -debian ~$ ghc -optl-static -static --make T.hs
> Linking T ...
> /usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../lib/librt.a(timer_create.o): 
> In function `timer_create':
> (.text+0x107): undefined reference to `pthread_once'
> ...
> < references to missing pthread symbols >
> 
> Does anyone have static linking working for GHC 6.8.2 and can inform me 
> of the magic incantation? "Get the latest development version from 
> darcs", perhaps?
> 
> BTW when I said "move to the end", I meant "move to the end of -l flags".

We may need to tweak the order of the libraries in rts/package.conf.in 
(this is where -lrt comes from).  The question is, do we need a configure test?

Cheers,
	Simon

> cheers
> peter
> 
> On 27/05/2008, at 10:37 AM, Peter Gammie wrote:
> 
>> Hello,
>>
>> I am having a bit of trouble static linking my program using GHC 6.8.2.
>>
>> In brief: "rt" uses "pthread", but -lrt is the final thing on the 
>> command line passed to the linker, and so the pthread symbols are not 
>> resolved. Manually moving -lpthread to the end of the collect2 command 
>> line does the trick.
>>
>> The question is how to do this using ghc.
>>
>> This is on Debian, using the 6.8.2-5 from unstable.
>>
>> I can provide the command lines if that is helpful.
>>
>> Note the same setup worked fine under GHC 6.6.1.
>>
>> cheers
>> peter
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



More information about the Glasgow-haskell-users mailing list