
Ian Lynagh:
On Mon, Dec 17, 2007 at 12:53:32PM +1100, Manuel M T Chakravarty wrote:
It seems to be a matter of the precise ld call parameters whether the gmp/ in the ghc repo is used or the external one. In using the stage1 compiler to link the stage2 compiler, the external one wins, but in linking other programs with the stage1 compiler, the internal gmp wins.
Hmm, that's interesting. The internal GMP should only be built if HaveLibGmp != YES and HaveFrameworkGMP != YES, in which case it should always use the internal one, and there shouldn't be an external one to use anyway.
At least on Mac OS (and also on Windows) and probably any other platform, except Linux, this is IMHO the wrong policy. FWIW, the current build system uses the internal GMP even if another one is installed (at least a non-framework one). However, the behaviour is a bit flacky (eg, if package readline is also used, it uses the external GMP due to some difference between the Darwin linker and other Unix linkers). It also needs to recompile installPackage and ifBuildable with the stage1 compiler (like the stuff below utils/) as both go into a binary distribution. I have fixed this all and am currently validating a patch.
Actually, I think, we should use the gmp/ in the ghc repo by default
If you want to use it when building a bindist that might be used on other computers you shold be able to set HaveLibGmp = NO HaveFrameworkGMP = NO in mk/build.mk, although I'm not sure I've ever tried it.
The disadvantages of using it are it might be out of date (we had some Windows segfaults a while ago that were fixed by updating the in-tree gmp) and wasted space.
Sure we waste some space, but the alternative is worse. Programs compiled with GHC will essentially not run on any computer, but the one where they were compiled. For example, the number of Macs with gmp installed is minuscule. The default should be to build programs that run everywhere with minimal hassle (not programs that save some space, but are unusable on most computers). Manuel PS: Readline is a different matter. It is used by ghci, so needs to be installed with ghc, but this dependency does not propagate into compiled programs, unless a program explicitly uses package readline (at which point I believe it is on this program's developer to make sure their users have readline available).