Bug#171518: ghc --make does not play nice with FFI wrapper

Simon Marlow simonmar at microsoft.com
Fri Dec 6 04:53:14 EST 2002


> Package: ghc5
> Version: 5.04-1
> Severity: normal
> 
> I have a module SDL.Bare.Audio with this declaration:
> 
> foreign import ccall safe "wrapper"
>   mkSDL_AudioSpec_Callback :: SDL_AudioSpec_Callback u ->
>                               IO (FunPtr (SDL_AudioSpec_Callback u))
> 
> When compiling Audio.hs, this results in the creation and compilation
> of Audio_stub.c.
> 
> Unfortunately, if I'm using ghc --make, if it decides to skip 
> compilation
> of Audio.hs, it never realizes that it also needs to link in 
> Audio_stub.o,
> causing this failure at the end:
> 
> ghc: linking ...
> build/Audio.o(.text+0x89): In function `s3Fk_ret':
> : undefined reference to `SDLziBareziAudio_d3K2'
> collect2: ld returned 1 exit status

Thanks, this is indeed a bug.  The code to look for the stub file
exists, but it was looking for foo.stub_o rather than foo_stub.o
(d'oh!).

Cheers,
	Simon



More information about the Glasgow-haskell-bugs mailing list