Changes between Version 5 and Version 6 of FAQ


Ignore:
Timestamp:
Dec 14, 2005 10:11:10 AM (8 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FAQ

    v5 v6  
    33Please feel free to add stuff here (login '''guest''', password '''guest'''). 
    44 
     5This page is rather long.  We've started to add some sub-headings, but would welcome your help in making it better organsised. 
     6 
     7--------------------------------------- 
     8= GHC on particular platforms = 
     9 
    510== How do I port GHC to platform X? == 
    611 
     
    1419 
    1520The [http://www.haskell.org/ghc/docs/latest/html/building Building Guide] has all the details on how to bootstrap GHC on a new platform. 
     21 
     22 
     23== GHC on Linux == 
     24 
     25=== I Can't run GHCi on Linux, because it complains about a missing {{{libreadline.so.3}}}. === 
     26 
     27The "correct" fix for this problem is to install the correct RPM for the particular flavour of Linux on your machine. If this isn't an option, however, there is a hack that might work: make a symbolic link from {{{libreadline.so.4}}} to {{{libreadline.so.3}}} in {{{/usr/lib}}}. We tried this on a SuSE 7.1 box and it seemed to work, but YMMV. 
     28 
     29== GHC on Solaris == 
     30=== Solaris users may sometimes get link errors due to libraries needed by GNU Readline. === 
     31 
     32We suggest you try linking in some combination of the termcap, curses and ncurses libraries, by giving {{{-ltermcap}}}, {{{-lcurses}}} and {{{-lncurses}}} respectively. If you encounter this problem, we would appreciate feedback on it, since we don't fully understand what's going on here. 
     33The build fails in readline. 
     34 
     35It has been reported that if you have multiple versions of the readline library installed on Linux, then this may cause the build to fail. If you have multiple versions of readline, try uninstalling all except the most recent version. 
     36 
     37== GHC on Windows == 
     38=== My program that uses a really large heap crashes on Windows. === 
     39 
     40For utterly horrible reasons, programs that use more than 128Mb of heap won't work when compiled dynamically on Windows (they should be fine statically compiled). 
     41 
     42=== I can't use readline under GHCi on Windows === 
     43 
     44In order to load the readline package under GHCi on Windows, you need to make a version of the readline library that GHCi can load. Instructions for GHC 6.2.2. are here. 
     45 
     46=== Ctrl-C doesn't work on Windows === 
     47 
     48When running GHC under a Cygwin shell on Windows, Ctrl-C sometimes doesn't work. The workaround is to use Ctrl-Break instead. 
     49 
     50== Why isn't GHC available for .NET? == 
     51 
     52 
     53It wouldd make a lot of sense to give GHC a .NET back end, and it's a 
     54question that comes up regularly.  The reason that we haven't done it 
     55here, at GHC HQ, is because it's a more substantial undertaking than 
     56might at first appear (see below).  Furthermore, it'd permanently add a 
     57complete new back-end platform for us to maintain.  Given our rather 
     58limited development effort, we have so far not bitten 
     59the bullet, and we have no immediate plans to do so. 
     60 
     61It would be a good, well-defined project for someone else to tackle, and 
     62we would love to see it done. There is some good groundwork already done: 
     63 
     64 * Sigbjorn Finne did a simple interop implementation that allows a 
     65   Haskell program to be compiled to native code (as now) but to call 
     66   .NET programs via a variant of the FFI.  I don't think this work is 
     67   in active use, and I'd be surprised if it worked out of the box, but 
     68   it could probably be revived with modest effort 
     69 
     70 * Andre Santos and his colleagues at UFPE in Brazil are working on a 
     71   .NET back end, that generates CLR IL, though I don't know where they 
     72   are up to. 
     73 
     74 * Nigel Perry and Oliver Hunt have a Haskell.NET prototype that works 
     75   using GHC to compile to Core, and then compiling Core to NET.  I'm 
     76   not sure what stage it is at. 
     77 
     78 * GHC.Net would be extra attractive if there was a Visual Studio 
     79   integration for GHC. Substantial progress on this has been made in 
     80   2004 by Simon Marlow, Krasimir Angelov, and Andre Santos and 
     81   colleagues. 
     82 
     83There may be others that I don't know of.  If anyone wants to join in 
     84this effort, do contact the above folk.  And please keep us informed! 
     85 
     86Here's a summary of why it's a non-trivial thing to do: 
     87 
     88 * The first thing is to generate native CLR Intermediate Language 
     89   (IL). That's not really hard.  Requires thinking about 
     90   representations for thunks and functions, and it may not be 
     91   particularly efficient, but it can surely be done.  An open question 
     92   is about whether to generate verifiable IL or not.  The trouble here 
     93   is that Haskell's type system is more expressive than the CLR's in 
     94   some ways, notably the use of higher-kinded type variables.  So, to 
     95   generate verifiable IL one is bound to need some run-time casts, and 
     96   it's not clear how to minimise these. 
     97 
     98At first blush this is *all* you need do.  But it isn't! 
     99 
     100 * Next, you need to think about how to inter-operate with .NET 
     101   libraries.  You don't really want to write "foreign import..." for 
     102   each and every import.  You'd like GHC to read the CLR meta-data 
     103   directly.  But there are lots of tricky issues here; see the paper 
     104   that Mark Shields and I wrote about "Object-oriented style 
     105   overloading for Haskell". 
     106 
     107 * Now you need to figure out how to implement GHC's primitive operations: 
     108    * the I/O monad 
     109    * arbitrary precision arithmetic 
     110    * concurrency 
     111    * exceptions 
     112    * finalisers 
     113    * stable pointers 
     114    * software transactional memory 
     115   Not all of these are necessary, of course, but many are used in the 
     116   libraries.  The CLR supports many of them (e.g. concurrency) but 
     117   with a very different cost model. 
     118 
     119 * Last, you have to figure out what to do for the libraries.  GHC has 
     120   a pretty large library, and you either have to implement the primops 
     121   on which the library is based (see previous point), or re-implement 
     122   it.  For example, GHC's implementation of I/O uses mutable state, 
     123   concurrency, and more besides. For each module, you need to decide 
     124   either to re-implement it using .NET primitives, or to implement the 
     125   stuff the module is based on. 
     126 
     127These challenges are mostly broad rather than deep.  But to get a 
     128production quality implementation that runs a substantial majority of 
     129Haskell programs "out of the box" requires a decent stab at all of them. 
     130 
     131--------------------------------------- 
     132= Other frequently asked questions = 
    16133 
    17134== Do I have to recompile all my code if I upgrade GHC? == 
     
    40157The problem is that your system doesn't have the GMP library installed. If this is a !RedHat distribution, install the RedHat-supplied gmp-devel package, and the gmp package if you don't already have it. There have been reports that installing the !RedHat packages also works for SuSE (SuSE don't supply a shared gmp library). 
    41158 
    42 == I Can't run GHCi on Linux, because it complains about a missing {{{libreadline.so.3}}}. == 
    43  
    44 The "correct" fix for this problem is to install the correct RPM for the particular flavour of Linux on your machine. If this isn't an option, however, there is a hack that might work: make a symbolic link from {{{libreadline.so.4}}} to {{{libreadline.so.3}}} in {{{/usr/lib}}}. We tried this on a SuSE 7.1 box and it seemed to work, but YMMV. 
    45  
    46 == Solaris users may sometimes get link errors due to libraries needed by GNU Readline. == 
    47  
    48 We suggest you try linking in some combination of the termcap, curses and ncurses libraries, by giving {{{-ltermcap}}}, {{{-lcurses}}} and {{{-lncurses}}} respectively. If you encounter this problem, we would appreciate feedback on it, since we don't fully understand what's going on here. 
    49 The build fails in readline. 
    50  
    51 It has been reported that if you have multiple versions of the readline library installed on Linux, then this may cause the build to fail. If you have multiple versions of readline, try uninstalling all except the most recent version. 
    52  
    53159== When I try to start ghci (probably one I compiled myself) it says {{{ghc-5.02: not built for interactive use}}} == 
    54160 
     
    58164 
    59165You should use the {{{-#include}}} option to bring the correct prototype into scope (see [http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#options-C-compiler Section 4.10.5, “Options affecting the C compiler (if applicable)”]). 
    60  
    61 == My program that uses a really large heap crashes on Windows. == 
    62  
    63 For utterly horrible reasons, programs that use more than 128Mb of heap won't work when compiled dynamically on Windows (they should be fine statically compiled). 
    64166 
    65167== GHC doesn't like filenames containing +. == 
     
    142244See [http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation.html#options-output Section 4.6.4, “Redirecting the compilation output(s)”] for more details on the {{{-osuf}}} and {{{-hisuf}}} options. 
    143245 
    144 == I can't use readline under GHCi on Windows == 
    145  
    146 In order to load the readline package under GHCi on Windows, you need to make a version of the readline library that GHCi can load. Instructions for GHC 6.2.2. are here. 
    147  
    148 == Ctrl-C doesn't work on Windows == 
    149  
    150 When running GHC under a Cygwin shell on Windows, Ctrl-C sometimes doesn't work. The workaround is to use Ctrl-Break instead. 
    151  
    152246== I get an error message from GHCi about a "{{{duplicate definition for symbol __module_registered}}}" == 
    153247