Can't compile GHC 6.8.2

Simon Marlow marlowsd at gmail.com
Wed Dec 10 07:05:58 EST 2008


Barney Stratford wrote:
> I have a workaround for the linker bugs that keep popping up under Mac
> OS X, and now have a working GHC 6.8.  I found that saying -fasm didn't
> help matters. Instead, on the assumption that the linker gets it wrong
> and there is in fact nothing wrong with the object file, I applied these
> two patches:
> 
> diff -u a/compiler/Makefile b/compiler/Makefile
> --- a/compiler/Makefile Mon Dec 10 18:11:32 2007
> +++ b/compiler/Makefile Wed Nov 26 09:35:12 2008
> @@ -753,7 +753,7 @@
>  	$(SED) -e "s at GHC_PATH@$(GHC_PATH)@g" -e "s at TOP_ABS@$(FPTOOLS_TOP_ABS)@g" < $< > $@
>  
>  $(INPLACE_PROG): $(INPLACE_SRC)
> -       $(HC) -cpp $(INPLACE_EXTRA_FLAGS) $< -o $@
> +       $(HC) -cpp $(INPLACE_EXTRA_FLAGS) $< -o $@ -optl
> "-Wl,-read_only_relocs,warning"
>  
>  all :: $(INPLACE_PROG)
>  
> diff -u a/mk/target.mk b/mk/target.mk
> --- a/mk/target.mk      Mon Dec 10 18:11:31 2007
> +++ b/mk/target.mk      Thu Nov 27 12:14:02 2008
> @@ -231,7 +231,7 @@
>  
>  ifneq "$(BootingFromHc)" "YES"
>  $(HS_PROG) :: $(OBJS)
> -       $(HC) -o $@ $(HC_OPTS) $(LD_OPTS) $(OBJS)
> +       $(HC) -o $@ $(HC_OPTS) $(LD_OPTS) $(OBJS)  -optl
> "-Wl,-read_only_relocs,warning"
>  else
>  # see bootstrap.mk
>  $(HS_PROG) :: $(OBJS)
> 
> Another way to fix these problems would be to mumble something about
> -segprot __TEXT rwx rwx, but this is definitely a hack.
> 
> I also had to patch Cabal so it ranlibs the libraries it creates (which
> is required under Mac OS), and fixed the .hi-boot files in
> compiler/typecheck. (Shouldn't these be updated automatically?) Without
> those changes, the typechecker won't typecheck. Oh, the irony!
> 
> Perhaps someone that knows more about how the build system works could
> figure out the right way to do these things.

Presumably you'll get the same error when using your new GHC to link any 
Haskell program?  So in fact GHC itself should be adding this option when 
linking the RTS on this platform.  The right place to add this would be in 
rts/package.conf.in, in extra-ld-opts, with suitable platform-specific 
#ifdefs.  If you can whip up a patch and test it, I'll commit.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list