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

2002-12-06 Thread Michael Weber
- Forwarded message from Richard Braakman [EMAIL PROTECTED] -

Date: Tue, 03 Dec 2002 03:26:54 +0200
From: Richard Braakman [EMAIL PROTECTED]
Subject: Bug#171518: ghc --make does not play nice with FFI wrapper
To: Debian Bug Tracking System [EMAIL PROTECTED]
Reply-To: Richard Braakman [EMAIL PROTECTED], [EMAIL PROTECTED]
X-Mailer: reportbug 2.9
Message-Id: E18J1pu-0004Vc-00@night

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

I tried to work around it by putting Audio_stub.o on the command line
by hand, but then it fails when compiling from a clean tree, because
it ends up linking the file twice.

Richard Braakman


-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux night 2.4.7 #1 Thu Jun 27 13:02:24 EEST 2002 i686
Locale: LANG=C, LC_CTYPE=fi_FI.ISO8859-1

Versions of packages ghc5 depends on:
ii  gcc   2:2.95.4-17The GNU C compiler.
ii  libc6 2.3.1-5GNU C Library: Shared libraries an
ii  libgmp3   4.0.1-3Multiprecision arithmetic library
ii  libgmp3-dev   4.0.1-3Multiprecision arithmetic library 
ii  libncurses5   5.3.20021109-1 Shared libraries for terminal hand
ii  libreadline4  4.3-4  GNU readline and history libraries
ii  libreadline4-dev  4.3-4  GNU readline and history libraries
ii  perl [perl5]  5.6.1-7Larry Wall's Practical Extraction 

-- no debconf information



- End forwarded message -
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



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

2002-12-06 Thread Simon Marlow
 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
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs