problems compiling ghc 3.01 for linux

1998-05-11 Thread Carl R. Witty

I ran into minor problems compiling GHC 3.01 on my up-to-date Debian
Linux machine.  I'm pretty sure that the problem is that I'm using
Libc 6 (GNU libc 2).

Basically, several BSD extensions (in particular, the types caddr_t
and u_long, and the tm_zone and tm_gmtoff members of struct tm) are
not available when _POSIX_SOURCE is defined; I also had to define
_BSD_SOURCE to include them.  (One problem is that configure tests for
feature availability with no _*_SOURCE defines; defining _POSIX_SOURCE
then disables features that configure detected as present.)

Here's the patch I made:

--- stgdefs.h~  Sun Oct  5 13:34:00 1997
+++ stgdefs.h   Sun May 10 15:52:25 1998
@@ -53,10 +53,12 @@
 #ifdef NON_POSIX_SOURCE
 #undef _POSIX_SOURCE
 #undef _POSIX_C_SOURCE
+#define _BSD_SOURCE
 #else
 # ifndef aix_TARGET_OS
 /* already defined on aix */
 #define _POSIX_SOURCE 1
+#define _BSD_SOURCE 1
 # endif
 #ifndef irix_TARGET_OS
 #define _POSIX_C_SOURCE 199301L


While this works for me, I wouldn't suggest that you apply it blindly;
I don't know if it might break other places.  Ideally, it would be
conditioned on having GNU libc 2.0 (Linux libc 6); I don't know how to
check for that here.

Random information about my system:
Linux gemini 2.0.29 #4 Thu Oct 23 00:34:55 PDT 1997 i686 unknown
gcc version 2.7.2.3

Let me know if you have any questions, or want me to test patches.

Carl Witty
[EMAIL PROTECTED]



Re: problems compiling ghc 3.01 for linux

1998-05-11 Thread Simon Marlow

"Carl R. Witty" [EMAIL PROTECTED] writes:

 Here's the patch I made:
 
 --- stgdefs.h~  Sun Oct  5 13:34:00 1997
 +++ stgdefs.h   Sun May 10 15:52:25 1998
 @@ -53,10 +53,12 @@
  #ifdef NON_POSIX_SOURCE
  #undef _POSIX_SOURCE
  #undef _POSIX_C_SOURCE
 +#define _BSD_SOURCE
  #else
  # ifndef aix_TARGET_OS
  /* already defined on aix */
  #define _POSIX_SOURCE 1
 +#define _BSD_SOURCE 1
  # endif
  #ifndef irix_TARGET_OS
  #define _POSIX_C_SOURCE 199301L

Thanks Carl.  Several people have run into this before (check the list
archives), but we still don't have any recent Linux installations here
to test out a proper fix on.  

My suggestion for the time being: add something like this to your
build.mk:

SRC_CC_OPTS += -optc-D_BSD_SOURCE

This avoids patching the source.  You may have to add the flag to
SRC_HC_OPTS too.

Cheers,
Simon

-- 
Simon Marlow [EMAIL PROTECTED]
University of Glasgow   http://www.dcs.gla.ac.uk/~simonm/
finger for PGP public key



Re: problems compiling ghc 3.01 for linux

1998-05-11 Thread Carl R. Witty

Simon Marlow [EMAIL PROTECTED] writes:

 Thanks Carl.  Several people have run into this before (check the list
 archives), but we still don't have any recent Linux installations here
 to test out a proper fix on.  

That's why I said:

 Let me know if you have any questions, or want me to test patches.

(I am keeping up with ghc-current, using anonymous CVS, so if you just
check in a proposed fix and let me know I can tell you if it
compiles.)

Carl Witty
[EMAIL PROTECTED]



Re: problems compiling ghc 3.01 for linux

1998-05-11 Thread simonmar


8Qxd$QC/sdeK{93/{KA]T@gir{b8(rd5/zL85UcsTGty!z9Nx%Z+0e193YVEXFcWdM.]+uyVYA6 
WNNn]tdh-oQ]/#\R;Vts^}W]a%+%VqSEAu
X-URL: http://WWW.CS.Yale.EDU/homes/reid-alastair/
Date: Mon, 11 May 1998 11:03:09 -0300
From: Alastair Reid [EMAIL PROTECTED]
Sender: [EMAIL PROTECTED]
Precedence: bulk
Resent-Date:  Mon, 11 May 1998 16:07:11 +0100
Resent-From: [EMAIL PROTECTED]
Resent-To: [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"


 we still don't have any recent Linux installations here
 to test out a proper fix on.  

Surely someone at Glasgow CS dept can lend you the Redhat CD ROM
 and boot disk?  
If not, Computer World (I think that's the name) isn't too far away.
Or you could order direct from Redhat.  Or save money by ordering
 from Cheap Bytes (but better to pay extra to RH to support further
 development).
Or you can upgrade by ftp - I'm sure there's a mirror near you.

Upgrading only takes about 15 minutes of work - and a couple of hours
of ignoring the machine while it copies files.

(Time estimate based on my experience of Redhat 5.0.  I'm not sure
 how good the other distributions are for upgrading.)

Alastair