Re: ANNOUNCE: GHC 7.8.1 Release Candidate 1
I've been attempting to build under Mac OS X Mavericks and have run into some problems. My iconv and gmp are installed in non-standard locations using Fink. When configuring http://www.haskell.org/ghc/dist/7.8.1-rc1/ghc-7.8.20140130-x86_64-apple-darwin-mavericks.tar.bz2 I get: barneys-imac:ghc-7.8.20140130 bjs$ ./configure --prefix=/Users/bjs/Desktop/ghc --with-iconv-includes=/sw/include --with-gmp-includes=/sw/include --with-iconv-libraries=/sw/lib --with-gmp-libraries=/sw/lib configure: WARNING: unrecognized options: --with-iconv-includes, --with-iconv-libraries and then the installed executable can't itself build ghc from source because of the missing iconv libraries. I noticed that ./configure --help doesn't mention --with-iconv-* in the Mavericks install files but it does in the source build. Any ideas? Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Can't compile GHC 6.8.2
I'm trying to compile GHC 6.8.2 using my existing GHC 6.2, but the typechecker refuses to compile. The problem seems to be that the hi-boot files in compiler/typecheck contain some incorrect type signatures. I've fixed most of them, but TcMatches.hi-boot-6 has slightly stumped me. As it stands, it says tcMatchesFun :: Name.Name -> HsExpr.MatchGroup Name.Name -> TcType.BoxyRhoType -> TcRnTypes.TcM (HsBinds.HsWrapper, HsExpr.MatchGroup TcRnTypes.TcId) but it should say something like tcMatchesFun :: Name.Name -> Bool -> HsExpr.MatchGroup Name.Name -> TcType.BoxyRhoType -> TcRnTypes.TcM (HsBinds.HsWrapper, HsExpr.MatchGroup TcRnTypes.TcId) Unfortunately, that doesn't work, as it assumes I meant TcMatches.Bool, so I tried saying Prelude.Bool instead. Now I get the complaint that Prelude.Bool isn't in scope. Has anyone else seen this issue? I've looked for answers in the docs and with Google, but no luck. I'm running Mac OS 10.3, with GHC 6.2 installed under Fink. I borrowed the Fink package for GHC 6.8.2 and adapted it slightly so it would bootstrap from my existing GHC, as the bootstrap code available for download relies on a later version of my OS. GHC 6.2 can't compile GHC 6.10, which is why I'm going for the earlier version. Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: Can't compile GHC 6.8.2
I can now confirm that 6.2 can, in fact, bootstrap 6.8.2 (with the corrections to those hi-boots), although I've still not got the build to complete. If anyone wants to see the patch file, then let me know and I'll send it when I've ironed out the last creases. Thanks to all those who helped out. Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: Can't compile GHC 6.8.2
There's good news and bad news. The good news is that the compilation of my shiny almost-new GHC is complete. The bad news is, it won't link. It's grumbling about ld: /System/Fink/src/fink.build/ghc-6.8.2-1/ghc-6.8.2/rts/libHSrts.a(PrimOps.o) has external relocation entries in non-writable section (__TEXT,__text) for symbols: ___gmpn_cmp ___gmpn_gcd_1 ___gmpz_fdiv_qr ___gmpz_init ___gmpz_tdiv_qr ___gmpz_com ___gmpz_xor ___gmpz_ior ___gmpz_and ___gmpz_divexact ___gmpz_tdiv_r ___gmpz_tdiv_q ___gmpz_gcd ___gmpz_mul ___gmpz_sub ___gmpz_add Looking through the archives, it seems like this is an old favourite bug rearing its ugly head again. The suggested remedy of commenting out the line reading "SRC_HC_OPTS += -fvia-C" in the Makefile won't work, as that line isn't there anyway. The manpage for ld has an option "-read_only_relocs warning" that looks like it might suppress this problem, but I don't fully understand what it's doing. What would you suggest? Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Can't compile GHC 6.8.2
> The heading seems to be: Your build is missing it's required GMP (GNU > Multiple Precision) library No, I have GMP installed, and it's correctly compiling against it. The issue isn't that these symbols are missing altogether, but rather that there's something wrong with them. It looks to me like it's identical to this bug afflicting 6.9: http://hackage.haskell.org/trac/ghc/ticket/2262 Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Can't compile GHC 6.8.2
> The workaround is almost certainly to build the RTS with -fasm. According to http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#options-codegen, -fasm is the default option anyway, or am I missing something here? It looks like this is an issue with the way Apple's version of gcc works. The gmp people are complaining bitterly, saying not to use a Mac at all. Perhaps the real issue here is that I should get a new computer. This old lady's got a bit wrinkly, but there's life in her yet. Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Can't compile GHC 6.8.2
> in the days of ghc-6.2, you got -fvia-C by default The thing is, 6.2 is building 6.8 just fine. Stage 1 is quite happy. The problem arises during linking of Stage 2 - ie 6.8 can't build itself. Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Can't compile GHC 6.8.2
> Do you have a link to something describing the problem? This might be relevant: I don't know. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14612 Further useful information. The problem doesn't manifest itself when compiling GHC 6.6, so the question is what parts of the runtime system changed in the meantime. The changes to rts/Linker.c are just refactorings and addition of 64-bit support. The only other place I can see where those things are mentioned is in rts/PrimOps.cmm. In the meantime, I'll try using a later GCC and see if that helps (assuming I can compile it!). Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Can't compile GHC 6.8.2
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 "[EMAIL PROTECTED]@$(GHC_PATH)@g" -e "[EMAIL PROTECTED]@$(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. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Can't compile GHC 6.8.2
> 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. Here's the patch, which now compiles correctly. diff -u a/rts/package.conf.in b/rts/package.conf.in --- a/rts/package.conf.in Mon Dec 10 18:11:32 2007 +++ b/rts/package.conf.in Thu Dec 11 09:36:54 2008 @@ -150,6 +150,10 @@ , "-u", "base_GHCziConc_ensureIOManagerIsRunning_closure" #endif +#ifdef darwin_HOST_OS + , "-read_only_relocs", "warning" +#endif + framework-dirs: #ifdef HAVE_FRAMEWORK_GMP Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Snow Leopard GHC
I've been trying to get GHC working for x86_64 on Snow Leopard, with a certain amount of success, but have got stuck. Maybe one of you could point me in the right direction. I now have a working compiler, but the linker in the runtime system seems to be missing some stuff. Specifically, in rts/Linker.c, there are references to X86_64_RELOC_UNSIGNED, X86_64_RELOC_SIGNED and so on, but it simply barfs when faced with a X86_64_RELOC_SIGNED_1 etc. I'd thought it would be a matter of adding a few lines of code, but everything I've tried has ended in tears. Trouble is, none of the documentation mentions X86_64_RELOC_SIGNED_1, although it does appear in C headers. It occurs only rarely in source examples, and it really isn't clear to me how I should proceed. Any ideas? Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Snow Leopard GHC
Latest update on getting GHC working 64-bit on Snow Leopard. I've been building 6.8.3, simply because it was the version I had running before so might give fewer problems. To get the compiler working, apply this patch (which I borrowed from the Darcs repository): diff -uit a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -816,6 +816,10 @@ pprDynamicLinkerAsmLabel :: DynamicLinkerLabelInfo -> CLabel -> SDoc #if x86_64_TARGET_ARCH && darwin_TARGET_OS +pprDynamicLinkerAsmLabel CodeStub lbl + = char 'L' <> pprCLabel lbl <> text "$stub" +pprDynamicLinkerAsmLabel SymbolPtr lbl + = char 'L' <> pprCLabel lbl <> text "$non_lazy_ptr" pprDynamicLinkerAsmLabel GotSymbolPtr lbl = pprCLabel lbl <> text "@GOTPCREL" pprDynamicLinkerAsmLabel GotSymbolOffset lbl Make sure you have a working 32-bit GHC as well as libraries (libgmp, etc).for both 32 and 64-bit architectures. Then say ./configure --build=x86_64-apple-darwin --host=x86_64-apple-darwin -- target=x86_64-apple-darwin make It will compile an x86_64 GHC for you, happily unaware that the GHC you're using for the build is a 32-bit one. The stage1 compiler is, of course, a 32-bit binary that produces 64-bit binaries. I found that the resulting compiler can build itself (stage3) and can say Hello World, so it looks like it works correctly. I've still not got GHCi working, though. I've managed to narrow down the source of the trouble with the linker in GHCi, and it looks like there are some bugs as well as missing parts, which is why it kept launching itself to the moon. Still working on that one: patch to follow. For now, you can at least compile your code and run it non-interactively. Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Snow Leopard GHC
Only limited success with GHCi, I'm afraid. The problem seems to be that Snow Leopard is much stricter about security than Leopard was. (Caveat - I don't really know what I'm talking about.) In particular, I don't think it will let you execute code outside of the __TEXT segment, which is exactly what GHCi tries to do - hence the bus errors. I've tried just letting the dynamic linker (dyld) sort everything out for us, but this failed because not all symbols are dynamically linked, and the statically linked ones are invisible to it. One change that will be necessary in any case: towards the end of rts/ Linker.c, change case X86_64_RELOC_SIGNED: ASSERT(reloc->r_pcrel); thing += value - baseValue; break; to case X86_64_RELOC_SIGNED: case X86_64_RELOC_SIGNED_1: case X86_64_RELOC_SIGNED_2: case X86_64_RELOC_SIGNED_4: ASSERT(reloc->r_pcrel); thing += value - baseValue; break; I won't be able to hack on this any more for a few days, as I'm off to the mountains. Maybe someone else can try. Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Snow Leopard GHC
OK, I'm trying to get a more-recent GHC working that has that #ifdef that you mentioned. Specifically, 6.10.4. I've said: ./configure --build=x86_64-apple-darwin --host=x86_64-apple-darwin -- target=x86_64-apple-darwin --with-gmp-includes='/sw/include' --with- gmp-libraries='/sw/lib' make and it fails, saying it can't find libgmp, even though I've just told it where gmp is. I've copied my mk/build.mk straight from my 6.8.3 build, and it says ReadlineIncludePath=/sw/include SRC_CC_OPTS += -I/sw/include -L/sw/lib SRC_HC_OPTS += -I/sw/include -L/sw/lib EXTRA_HSC2HS_OPTS += -I/sw/include EXTRA_LD_OPTS += -L/sw/lib The resulting error message is: [51 of 51] Compiling Distribution.Simple ( Distribution/Simple.hs, dist-bootstrapping/build/Distribution/Simple.o ) ar: creating archive dist-bootstrapping/build/libHSCabal-1.6.0.3.a cd Cabal&& /Users/bjs/Desktop/GHC_Build/ghc-6.10.4/libraries/cabal- bin /Users/bjs/Desktop/GHC_Build/install/bin/ghc /Users/bjs/Desktop/ GHC_Build/ghc-6.10.4/libraries/bootstrapping.conf 1.6.0.3 install -- distpref=dist-bootstrapping --inplace Installing library in /Users/bjs/Desktop/GHC_Build/ghc-6.10.4/libraries/Cabal/dist- bootstrapping/install/usr/local/lib/Cabal-1.6.0.3/ghc-6.8.3 Registering Cabal-1.6.0.3... Reading package info from "dist-bootstrapping/inplace-pkg-config" ... done. Saving old package config file... done. Writing new package config file... done. cd hpc&& /Users/bjs/Desktop/GHC_Build/ghc-6.10.4/libraries/cabal- bin /Users/bjs/Desktop/GHC_Build/install/bin/ghc /Users/bjs/Desktop/ GHC_Build/ghc-6.10.4/libraries/bootstrapping.conf 1.6.0.3 clean -- distpref=dist-bootstrapping cleaning... cd hpc&& /Users/bjs/Desktop/GHC_Build/ghc-6.10.4/libraries/cabal- bin /Users/bjs/Desktop/GHC_Build/install/bin/ghc /Users/bjs/Desktop/ GHC_Build/ghc-6.10.4/libraries/bootstrapping.conf 1.6.0.3 configure -- distpref=dist-bootstrapping --with-compiler=/Users/bjs/Desktop/ GHC_Build/install/bin/ghc --with-hc-pkg=/Users/bjs/Desktop/GHC_Build/ install/bin/ghc-pkg --package-db=/Users/bjs/Desktop/GHC_Build/ ghc-6.10.4/libraries/bootstrapping.conf.tmp Configuring hpc-0.5.0.3... : warning: "__PIC__" redefined : warning: this is the location of the previous definition cd hpc&& /Users/bjs/Desktop/GHC_Build/ghc-6.10.4/libraries/cabal- bin /Users/bjs/Desktop/GHC_Build/install/bin/ghc /Users/bjs/Desktop/ GHC_Build/ghc-6.10.4/libraries/bootstrapping.conf 1.6.0.3 build -- distpref=dist-bootstrapping Preprocessing library hpc-0.5.0.3... ld: library not found for -lgmp collect2: ld returned 1 exit status linking dist-bootstrapping/build/Trace/Hpc/Reflect_hsc_make.o failed command was: /usr/bin/gcc -L/Users/bjs/Desktop/GHC_Build/install/lib/ ghc-6.8.3/lib/directory-1.0.0.1 -L/Users/bjs/Desktop/GHC_Build/install/ lib/ghc-6.8.3/lib/filepath-1.1.0.0 -L/Users/bjs/Desktop/GHC_Build/ install/lib/ghc-6.8.3/lib/old-time-1.0.0.0 -L/Users/bjs/Desktop/ GHC_Build/install/lib/ghc-6.8.3/lib/old-locale-1.0.0.0 -L/Users/bjs/ Desktop/GHC_Build/install/lib/ghc-6.8.3/lib/containers-0.1.0.2 -L/ Users/bjs/Desktop/GHC_Build/install/lib/ghc-6.8.3/lib/array-0.1.0.0 -L/ Users/bjs/Desktop/GHC_Build/install/lib/ghc-6.8.3/lib/base-3.0.2.0 -L/ Users/bjs/Desktop/GHC_Build/install/lib/ghc-6.8.3 -lm -lgmp -ldl dist- bootstrapping/build/Trace/Hpc/Reflect_hsc_make.o -o dist-bootstrapping/ build/Trace/Hpc/Reflect_hsc_make make[1]: *** [bootstrapping.conf] Error 1 make: *** [stage1] Error 2 [~/Desktop/GHC_Build/ghc-6.10.4] bjs$ As you can see, it doesn't even attempt to tell gcc where to find libgmp. This has the feeling of an RTM question, and if it is then I apologise. I've not seen anything about this in the M, though. Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Snow Leopard GHC
As a workaround, you might try to set the appropriate enironment variables Setting LIBRARY_PATH seems to help, but there must be a better way! Thanks. Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: GHC on Snow Leopard: best practices?
I'm back in Cambridge now. Snowdonia was great, and just as wet as expected. As far as I'm aware, nobody's got a fully functioning Snow Leopard GHC yet. Just before going away, I tried to use my partly-functioning 64- bit GHC to build 6.10, but found that the stage 1 compiler segfaulted. My plan now is to get 6.8.3 fully working so that we all have something, if a little old, that works. (This is because I need it for another project.) Once I've managed this, I'll post a full set of instructions to get everyone else going too. Then I plan to attempt to get 6.12 working, and provide a binary that can be used for bootstrapping. (I may need some pointers for this.) Incidentally, 6.12 doesn't appear to be in http://www.haskell.org/ghc/dist/ , only in the Darcs repo. Was that intentional? So far, the sticking point has been getting the interactive linker to work. Snow Leopard has much tighter security than its predecessors, so we have to use mmap. Unfortunately, the mmap version of GHC's linker also requires mremap, which is a Linux-only extension that Snow Leopard doesn't have. See you, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Snow Leopard GHC
I am happy to take care of funnelling Barney's changes into the main repo. However, I think there was at least one more mentioned in another email. The other change is already in the repo. That's where I borrowed it from in the first place. Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Snow Leopard GHC
Latest set of problems. I've tried using the i386 build of GHC 6.10.4 to build the x86_64 version in the manner that I described in an earlier post. I'm not getting any segfaults now, but instead it says the following during make: /Users/bjs/Desktop/GHC_Build/ghc-6.10.4/libraries/cabal-bin /usr/bin/ ghc /Users/bjs/Desktop/GHC_Build/ghc-6.10.4/libraries/ bootstrapping.conf 1.6.0.3 build --distpref dist-install --ghc- option=-H32m --ghc-option=-O --ghc-option=-I/sw/include --ghc-option=- L/sw/lib --ghc-option=-Wall Preprocessing executables for installPackage-1.0... Building installPackage-1.0... [1 of 1] Compiling Main ( installPackage.hs, dist-install/ build/installPackage/installPackage-tmp/Main.o ) /var/folders/IZ/IZ09PkvEHBmw7qmXrvZvFE+++TI/-Tmp-/ghc38027_0/ ghc38027_0.s:3616:0: Bignum number illegal. Absolute 0 assumed. /var/folders/IZ/IZ09PkvEHBmw7qmXrvZvFE+++TI/-Tmp-/ghc38027_0/ ghc38027_0.s:3677:0: Bignum number illegal. Absolute 0 assumed. /var/folders/IZ/IZ09PkvEHBmw7qmXrvZvFE+++TI/-Tmp-/ghc38027_0/ ghc38027_0.s:3709:0: Bignum number illegal. Absolute 0 assumed. etc... Looking in the assembler file, I get stuff like: Lc4a1: jmp *-16(%r13) .long _s3j4_info - _s3j4_info_dsp .text .align 3 _s3lv_info_dsp: .quad _Main_a1_srt-(_s3lv_info)+72 .quad 3 .quad 375900174587920 _s3lv_info: Lc4bb: leaq -16(%rbp),%rax cmpq %r14,%rax (That bignum is at line 3616.) Any ideas what might be causing this? Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Snow Leopard GHC
So which compiler is generating the bogus code here? Is this the stage1 x86-64 compiler, or the i386 compiler? It's the stage1 x86_64 compiler. The problem here is that 375900174587920 doesn't even fit into 64 bits, hence the assembler's complaint. Cheers, Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: ANNOUNCE: GHC 6.12.1 Release Candidate 1
this one built and installed fine on Mac OS X 10.6 :). Interesting, I thought there were still problems there. I assume that's a 32-bit version. The problems manifest themselves only when you compile a 64-bit GHC. I'm still trying to get mine working - no luck yet, but will keep you posted. Barney. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users