Can't compile GHC 6.8.2

Barney Stratford barney_stratford at fastmail.fm
Thu Dec 4 08:23:33 EST 2008


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.

Barney.


More information about the Glasgow-haskell-users mailing list