Opened 14 years ago

Closed 13 years ago

Last modified 47 years ago

#111 closed bug (Fixed)

hsc2hs broken under Win32

Reported by: antonyc Owned by: nobody
Priority: high Milestone:
Component: None Version: 5.04.2
Keywords: Cc:
Operating System: Architecture:
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:



hsc2hs seems to be broken under Win32 with ghc 
5.04.2.  If I take a simple test program and attempt to 
compile it with hsc2hs, I get the following output:

$ make -f Makefile.ghc-win32
hsc2hs Test.hsc
undefined reference to `_imp___iob
undefined reference to `_imp___iob
undefined reference to `_imp___iob
undefined reference to `_imp___iob
undefined reference to `_imp___iob
Test_hsc_make.o(.text+0x3a0):Test_hsc_make.c: more 
undefined references to `_imp
___iob' follow
collect2: ld returned 1 exit status
make: *** [Test.hs] Error 1

antony@AIRSTREAM ~/src/haskell/ffi/hsc2hs

Attachments (1)

hsc2hs-test.2.tar (10.0 KB) - added by antonyc 14 years ago.

Download all attachments as: .zip

Change History (8)

Changed 14 years ago by antonyc

comment:1 Changed 14 years ago by sigbjorn

Logged In: YES 

C compiler mismatch;  use hsc2hs with the option --cc=ghc 
for better results.

comment:2 Changed 14 years ago by antonyc

Logged In: YES 

Thanks for the suggestion, Sigbjorn, but did you actually try 
it?  I get exactly the same output regardless of whether or not 
I use the --cc=ghc option.

comment:3 Changed 14 years ago by sigbjorn

Logged In: YES 

Yes, I did. Better make sure you also use 'ghc' as your 'gcc' 
if you're compiling up any .c files separately.

comment:4 Changed 14 years ago by antonyc

Logged In: YES 

If you look at the above output, you will see that it never gets 
as far as using any ".c files that are compiled seperately".  
The link errors that are reported are directly from hsc2hs 
attempting to compile, link and execute the .c file it produces 
internally (which emits a Haskell source file).

Nevertheless, it turns out that using the --ld=ghc option did 
the trick.  Thanks for pointing me in the right direction.

(GHCers:  Is there some reason to use default values of cc 
and ld that are inconsistent?)

comment:5 Changed 14 years ago by simonmar

Logged In: YES 

Reopened; there appear to be some problems with hsc2hs in 
a standard Windows installation of GHC.

What we've discovered:

 - By default, hsc2hs on windows uses "ghc" as the C
   compiler, and $(WhatGccIsCalled) as the linker, where
   $(WhatGccIsCalled) is set at build time and appears to
   be c:\mingw\bin\gcc on a system we tried it on, but
   might be set to "gcc" in the Windows installer distribution.

 - What we think ought to happen is that the default C
   compiler should be set to whatever GHC is installed
   with this version of hsc2hs, and the linker should
   also be set to the same thing, or at the least should
   point to the gcc installed along with your GHC.

We don't have a suitable test framework set up to make this 
change now, but it ought to be addressed before the next 

comment:6 Changed 13 years ago by simonmar

Logged In: YES 

I think we allege that these problems were fixed in 5.04.3.  
Could you test and let us know, so I can close the bug?  

comment:7 Changed 13 years ago by simonmar

  • Status changed from assigned to closed
Logged In: YES 

Submitter hasn't replied.  We claim this is now fixed (works 
for me, anyhow).
Note: See TracTickets for help on using tickets.