On Wed, Mar 26, 2008 at 02:11:58PM -0500, Andrew Cone wrote:
> I just pkg_add'ed ghc-6.6.1p0 on OpenBSD 4.2 for x86_64. It seemed to
> install fine, but then when I tried to run ghci, I got the following:
>
> ghc-6.6.1: /usr/local/lib/ghc/HSbase.o: unknown architecture
> Loading package base ... ghc-6.6.1: panic! (the 'impossible' happened)
> (GHC version 6.6.1 for x86_64-unknown-openbsd):
> loadObj: failed
>
> I ran file on that .o, and I got:
> /usr/local/lib/ghc/HSbase.o: ELF 64-bit LSB relocatable, AMD64, version 1,
> not stripped
>
> Is this a problem with the package? Or the port? Or my installation?
Yes. Not any longer. No.
You could update the port to -current (yes, in this special case
it should really work), or just apply the patch below (which is
exactly the diff from OPENBSD_4_2 to -current).
Then, with ghc-6.6.1p0 still installed, rebuild and update it with
env FLAVOR=native_bootstrap make update
After this, you should have a working ghci -- and even a man page
for ghc ;-)
Ciao,
Kili
Index: Makefile
===================================================================
RCS file: /var/cvs/OpenBSD/ports/lang/ghc/Makefile,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -p -r1.24 -r1.25
--- Makefile 22 Jul 2007 22:37:25 -0000 1.24
+++ Makefile 16 Sep 2007 20:05:12 -0000 1.25
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.24 2007/07/22 22:37:25 kili Exp $
+# $OpenBSD: Makefile,v 1.25 2007/09/16 20:05:12 kili Exp $
#
# Ancient versions based on Simon Marlow's port script for FreeBSD:
# $FreeBSD: ports/lang/ghc/Makefile,v 1.13 2002/08/22 12:53:38 obraun Exp $
@@ -8,7 +8,7 @@ COMMENT-main= compiler for the function
COMMENT-doc= documentation for GHC
DISTNAME= ghc-${MODGHC_VER}
-PKGNAME-main= ghc-${MODGHC_VER}p0
+PKGNAME-main= ghc-${MODGHC_VER}p1
PKGNAME-doc= ghc-doc-${MODGHC_VER}
CATEGORIES= lang
HOMEPAGE= http://www.haskell.org/ghc/
@@ -30,6 +30,7 @@ PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
PKG_ARCH-doc= *
+BUILD_DEPENDS= ::textproc/libxslt
LIB_DEPENDS-main= gmp::devel/gmp
RUN_DEPENDS-doc=
RUN_DEPENDS-main=
@@ -90,7 +91,7 @@ CONFIGURE_STYLE= gnu dest
CONFIGURE_ARGS+= --with-gmp-includes=${LOCALBASE}/include \
--with-gmp-libraries=${LOCALBASE}/lib
-FAKE_FLAGS+= "stage=2"
+FAKE_FLAGS+= stage=2
post-extract:
@mv ${WRKDIR}/testsuite ${WRKSRC}
@@ -145,15 +146,19 @@ do-build:
.endif
# Create scripts for the Cabal package registry that will be used for
-# @exec and @unexec.
+# @exec and @unexec. And generate a man page.
post-build:
cd ${WRKBUILD} && sh ${FILESDIR}/mkregunreg.sh ${PREFIX}
+ cd ${WRKBUILD}/docs/man && \
+ env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} ghc.1
post-install:
rm ${PREFIX}/lib/ghc/package.conf
${INSTALL_SCRIPT} ${WRKBUILD}/{un,}register.sh ${PREFIX}/lib/ghc
${INSTALL_DATA_DIR} ${DOC_DIR}
cd ${WRKDIR} && umask 022 && pax -rw ${DOC_FILES} ${DOC_DIR}
+ ${INSTALL_MAN_DIR} ${PREFIX}/man/man1
+ ${INSTALL_MAN} ${WRKBUILD}/docs/man/ghc.1 ${PREFIX}/man/man1
do-regress:
cd ${WRKSRC}/testsuite/tests/ghc-regress && \
Index: patches/patch-rts_Linker_c
===================================================================
RCS file: /var/cvs/OpenBSD/ports/lang/ghc/patches/patch-rts_Linker_c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- patches/patch-rts_Linker_c 21 Jul 2007 17:14:58 -0000 1.1
+++ patches/patch-rts_Linker_c 16 Sep 2007 20:05:12 -0000 1.2
@@ -1,14 +1,13 @@
-$OpenBSD: patch-rts_Linker_c,v 1.1 2007/07/21 17:14:58 kili Exp $
+$OpenBSD: patch-rts_Linker_c,v 1.2 2007/09/16 20:05:12 kili Exp $
We don't have MAP_ANONYMOUS (which is the same as MAP_ANON on Linux,
but the latter has been deprecated). We also don't have that MAP_32BIT
-Linux provides for amd64, so just zap that flag to 0. Note that
-this isn't enough to make ghci work on amd64. The definite solution
-would be real dynamic libraries created and used by GHC, so we could
-drop most of that home-brewn linking code at all.
+Linux provides for amd64, so just zap that flag to 0. In addition
+EM_X86_64 is called EM_AMD64 on OpenBSD, so just replace it to
+reenable GHCi (noted by dons).
--- rts/Linker.c.orig Wed Apr 25 19:10:41 2007
-+++ rts/Linker.c Wed May 23 13:59:08 2007
++++ rts/Linker.c Sun Sep 16 12:27:02 2007
@@ -73,6 +73,11 @@
#endif
@@ -21,3 +20,14 @@ drop most of that home-brewn linking cod
#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) ||
defined(freebsd_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS)
# define OBJFORMAT_ELF
#elif defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
+@@ -2923,8 +2928,8 @@ ocVerifyImage_ELF ( ObjectCode* oc )
+ case EM_IA_64: IF_DEBUG(linker,debugBelch( "ia64" )); break;
+ #endif
+ case EM_PPC: IF_DEBUG(linker,debugBelch( "powerpc32" )); break;
+-#ifdef EM_X86_64
+- case EM_X86_64: IF_DEBUG(linker,debugBelch( "x86_64" )); break;
++#ifdef EM_AMD64
++ case EM_AMD64: IF_DEBUG(linker,debugBelch( "x86_64" )); break;
+ #endif
+ default: IF_DEBUG(linker,debugBelch( "unknown" ));
+ errorBelch("%s: unknown architecture", oc->fileName);
Index: pkg/PLIST-main
===================================================================
RCS file: /var/cvs/OpenBSD/ports/lang/ghc/pkg/PLIST-main,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- pkg/PLIST-main 21 Jul 2007 17:14:58 -0000 1.2
+++ pkg/PLIST-main 16 Sep 2007 20:05:12 -0000 1.3
@@ -1,4 +1,4 @@
[EMAIL PROTECTED] $OpenBSD: PLIST-main,v 1.2 2007/07/21 17:14:58 kili Exp $
[EMAIL PROTECTED] $OpenBSD: PLIST-main,v 1.3 2007/09/16 20:05:12 kili Exp $
@pkgpath lang/ghc
@unexec /usr/bin/env HOME=/nonexistent %D/lib/ghc/unregister.sh
bin/ghc
@@ -1600,4 +1600,5 @@ lib/ghc/register.sh
lib/ghc/template-hsc.h
lib/ghc/unlit
lib/ghc/unregister.sh
[EMAIL PROTECTED] man/man1/ghc.1
@exec /usr/bin/env HOME=/nonexistent %D/lib/ghc/register.sh
--
Porn is the power of greytrapping.
-- Bob Beck