I would like to see Haskell for Gentoo/OSX. Unfortunately this has a bugtracking issue, effectively in order to emerge Haskell you must already have an installed Haskell compiler. I started with the binary MacOSX Tiger package from http://haskell.org/ghc/download_ghc_641.html, which installs into /usr/local. After package.providing dev-lang/ghc-bin-6.4.1 sys-libs/readline-4.3 and keywording dev-lang/ghc-6.4.1-r2.ebuild and dev-haskell/cabal-1.1.3.ebuild for ~ppc-macos, I staretd the ebuild for dev-lang-ghc with GHC=/usr/local/bin/ghc ACCEPT_KEYWORDS="~ppc-macos" USE="-X -opengl -openal" emerge ghc Unfortunately the emerge failed with /usr/local/bin/ghc -H16m -O -optc-nopie -fno-warn-deprecations -istage1/utils -istage1/basicTypes -istage1/types -istage1/hsSyn -istage1/prelude -istage1/rename -istage1/typecheck -istage1/deSugar -istage1/coreSyn -istage1/specialise -istage1/simplCore -istage1/stranal -istage1/stgSyn -istage1/simplStg -istage1/codeGen -istage1/main -istage1/profiling -istage1/parser -istage1/cprAnalysis -istage1/compMan -istage1/ndpFlatten -istage1/iface -istage1/cmm -istage1/nativeGen -istage1/ghci -Istage1 -DGHCI -package template-haskell -package readline -DUSE_READLINE -cpp -fglasgow-exts -fno-generics -Rghc-timing -I. -IcodeGen -InativeGen -Iparser -package unix -ignore-package lang -recomp -Rghc-timing -H16M '-#include "hschooks.h"' -i../lib/compat -ignore-package Cabal -fno-cse -c ghci/InteractiveUI.hs -o stage1/ghci/InteractiveUI.o -ohi stage1/ghci/InteractiveUI.hi powerpc-apple-darwin8-gcc-4.0.0: unrecognized option '-nopie' /var/tmp/portage/ghc-6.4.1-r2/temp/ghc8156.hc: In function 'shL9_ret': /var/tmp/portage/ghc-6.4.1-r2/temp/ghc8156.hc:31763: error: void value not ignored as it ought to be /var/tmp/portage/ghc-6.4.1-r2/temp/ghc8156.hc: In function 'shKR_ret': /var/tmp/portage/ghc-6.4.1-r2/temp/ghc8156.hc:31796: error: void value not ignored as it ought to be <<ghc: 590333932 bytes, 1822 GCs, 12795719/25053680 avg/max bytes residency (8 samples), 63M in use, 0.09 INIT (0.00 elapsed), 6.78 MUT (36.16 elapsed), 5.71 GC (8.90 elapsed) :ghc>> make[2]: *** [stage1/ghci/InteractiveUI.o] Error 1 make[1]: *** [all] Error 1 make: *** [build] Error 1 !!! ERROR: dev-lang/ghc-6.4.1-r2 failed. Is this a bug in the used binary package for ghc? A bug in the ebuild? The downloaded ghc can be used for keywording dev-util/darcs-1.0.5, so it seems to be basically useable. My emerge info Portage 2.1_pre3-r1 (default-darwin/macos/10.4, gcc-4.0.0, libsystem-7.1-r0, 8.5.0 Power Macintosh) ================================================================= System uname: 8.5.0 Power Macintosh powerpc macos-20041118 distcc 2.0.1-zeroconf powerpc-apple-darwin7.0 (protocol 1) (default port 3632) [disabled] dev-lang/python: [Not Present] sys-apps/sandbox: [Not Present] sys-devel/autoconf: [Not Present] sys-devel/automake: [Not Present] sys-devel/binutils: [Not Present] sys-devel/libtool: [Not Present] virtual/os-headers: 7.1 ACCEPT_KEYWORDS="ppc-macos" AUTOCLEAN="yes" CBUILD="powerpc-apple-darwin8" CFLAGS="-O2 -pipe" CHOST="powerpc-apple-darwin8" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig collision-protect distlocks sfperms strict" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/overlays/local" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="ppc aalib audiofile emboss exif expat ffmpeg gdbm gif gmp imagemagick jpeg lcms libwww lua mhash mng nls ogg opengl pcre png ppc-macos qt recode sdl slang svg tiff truetype vorbis elibc_Darwin kernel_Darwin userland_Darwin" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
See also bug #68930
Having a ghc binary working on your machine to start with is a really good start. To get it realy working may need a bit of fiddling. You should probably start with modifying the ghc ebuild to turn off some features. Take a look at what gets turned off for ppc and alpha. Try the same. What gcc version are you using? ghc is known not to work yet with gcc-4.x. Does the ghc you downloaded build ordinary simple programs? Does ghc complie ok from source manually? ie not using the ebuild. Did the macos build that you downloaded need any special source patches when it was built? You might want to check the darwin ports to see if they're using any patches.
(In reply to comment #2) > What gcc version are you using? ghc is known not to work yet with gcc-4.x. That's a problem, as OSX 10.4's default compiler (and the only one we support) is GCC4
Hmm, I wonder how the normal OSX version works then. Perhaps they do have some patches to make it work with gcc 4.
Ok, apparently I was wrong. ghc-6.4.1 on FC4 x86/amd64 uses gcc4. I don't know if the OSX release of ghc-6.4.1 was the vanilla source or with patches. So it may be that there is still a problem with gcc4 on ppc. So I guess the experiment would be to try building ghc manually from the tarball. We could also try contacting the chap who built the OSX binary of ghc-6.4.1.
Just for my understanding, you always need a Haskell compiler before you can build a new one right? So if we can build one, and make a binary package of that for gentoo, we would have a nice starting point of Gentoo + Haskell + OSX, right?
Yes. More specifically ghc requires ghc to build itself. That's why in Gentoo we have both dev-lang/ghc and dev-lang/ghc-bin. The ghc-bin is basically a normal portage .tbz2 file build from the ghc ebuild. So yes, the trick is to start with some non-portage version of ghc. Use that to build the ghc ebuild. And finally use that to make a package for ghc-bin. Eg for sparc & alpha we started with binary packages from debian and used them to bootstrap the gentoo ghc ebuild. For MacOSX you've already got the binary package provided by the ghc hackers. We ought to be able to use that to bootstrap the ghc ebuild.
> Unfortunately the emerge failed with [...] > /var/tmp/portage/ghc-6.4.1-r2/temp/ghc8156.hc: In function 'shL9_ret': [...] Could someone re-run the last ghc-inplace command using -keep-tmp-files and send me the temp file ghc????.hc that causes the error?
Wolfgang, thanks very much for helping us to look into this. If you have any questions about the ebuild side of things do not hesistate to ask. You can ask questions here or in #gentoo-haskell on irc.freenode.net.
Ok, let's see how far I can get this.
ok... % install_name_tool -change /usr/local/lib/libreadline.5.0.dylib /Library/Gentoo/usr/lib/libreadline.5.0.dylib ~/Desktop/ghc-6.4.1/lib/powerpc-apple-darwin/ghc-6.4.1 % ~/Desktop/ghc-6.4.1/lib/powerpc-apple-darwin/ghc-6.4.1 dyld: Library not loaded: /Users/wolfgang/GHC/MacPackage/build-dyn/libraries/readline/libHSreadline_dyn.dylib Referenced from: /Users/grobian/Desktop/ghc-6.4.1/lib/powerpc-apple-darwin/ghc-6.4.1 Reason: image not found Trace/BPT trap This is the 'unix style' thing on the download page (http://www.haskell.org/ghc/download_ghc_641.html). I guess I was a bit too optimistic. I see that it tries to load something from /Users/wolfgang (not me), so I will give install_name_tool some more tries...
ok, otool -L says everything in the ghc-6.4.1/lib/powerpc-apple-darwin dir is looking for libraries in /Users/wolfgang... so I'm wondering what would be the best solution for now...
needs readline really bad, so it's now progressive/prefix stuff
(In reply to comment #12) > ok, otool -L says everything in the ghc-6.4.1/lib/powerpc-apple-darwin dir is > looking for libraries in /Users/wolfgang... so I'm wondering what would be the > best solution for now... The Makefile for the binary package should replace those things with whatever is appropriate for your system when you run 'make' or 'make in-place'. Manual install_name_tool doctoring should only be required if your libreadline-5.0 is not in /usr/local/lib and your libgmp is not the GMP.framework/GMP that ships with my other (.pkg) binary distribution. In that case, you'll only need to use it on the executables, not the libraries.
I switched to the installer "for dummies" :) to be sure. And compiling semi-manual right now (for a while already) to see what happens. Thanks for your comments, I probably should have read the README or something...
> needs readline really bad, so it's now progressive/prefix stuff I had no big problems yet while package.providing readline 4.3 on Tiger So prefix is not really needed.
Any news on this? What are we waiting on atm? It'd be nice to get this supported.
I think time and solutions. Time because compiling it takes ages, and solutions because it didn't compile in the end, IIRC. There was also a problem on my side getting the haskell binary getting to run.
ghc-6.6.1 is in the prefix tree for x86-macos, ppc-macos, x86-solaris and sparc-solaris (untested). A precompiled binary package is available for *-macos for prefix.